From ac0e8b024707ac16b1960bc167961170e956cb0f Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Mon, 4 Jan 2021 13:17:17 +0200 Subject: App: Drag-and-drop events passed to all widgets --- src/app.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/app.c b/src/app.c index 82232afa..01f62bba 100644 --- a/src/app.c +++ b/src/app.c @@ -535,19 +535,22 @@ void processEvents_App(enum iAppEventMode eventMode) { d->isRunning = iFalse; goto backToMainLoop; case SDL_DROPFILE: { - iBool newTab = iFalse; - if (elapsedSeconds_Time(&d->lastDropTime) < 0.1) { - /* Each additional drop gets a new tab. */ - newTab = iTrue; - } - d->lastDropTime = now_Time(); - if (startsWithCase_CStr(ev.drop.file, "gemini:") || - startsWithCase_CStr(ev.drop.file, "file:")) { - postCommandf_App("~open newtab:%d url:%s", newTab, ev.drop.file); - } - else { - postCommandf_App( - "~open newtab:%d url:%s", newTab, makeFileUrl_CStr(ev.drop.file)); + iBool wasUsed = processEvent_Window(d->window, &ev); + if (!wasUsed) { + iBool newTab = iFalse; + if (elapsedSeconds_Time(&d->lastDropTime) < 0.1) { + /* Each additional drop gets a new tab. */ + newTab = iTrue; + } + d->lastDropTime = now_Time(); + if (startsWithCase_CStr(ev.drop.file, "gemini:") || + startsWithCase_CStr(ev.drop.file, "file:")) { + postCommandf_App("~open newtab:%d url:%s", newTab, ev.drop.file); + } + else { + postCommandf_App( + "~open newtab:%d url:%s", newTab, makeFileUrl_CStr(ev.drop.file)); + } } break; } -- cgit v1.2.3