diff options
author | Daniel Friesel <derf@finalrewind.org> | 2022-06-10 21:03:41 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2022-06-10 21:03:41 +0200 |
commit | 05a07126569fe2d2168ab3077a0891c4c872e389 (patch) | |
tree | 1755ac0d261f302d0c8cf43c2a81aab0f447c1c7 | |
parent | 16b08055436194ff4ae0ac70fea77e8cc97cf840 (diff) |
MotionNotify handler: only call generic handler if winwid != NULL
Closes #656
-rw-r--r-- | src/events.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/events.c b/src/events.c index 81b7157..524ccad 100644 --- a/src/events.c +++ b/src/events.c @@ -681,16 +681,18 @@ static void feh_event_handle_MotionNotify(XEvent * ev) } else { while (XCheckTypedWindowEvent(disp, ev->xmotion.window, MotionNotify, ev)); winwid = winwidget_get_from_window(ev->xmotion.window); - if ((winwid != NULL) && (winwid->type == WIN_TYPE_THUMBNAIL)) { - feh_thumbnail *thumbnail; - int x, y; - - x = (ev->xbutton.x - winwid->im_x) / winwid->zoom; - y = (ev->xbutton.y - winwid->im_y) / winwid->zoom; - thumbnail = feh_thumbnail_get_thumbnail_from_coords(x, y); - feh_thumbnail_select(winwid, thumbnail); - } else { - feh_event_handle_generic(winwid, ev->xmotion.state | Mod3Mask, NoSymbol, 0); + if (winwid != NULL) { + if (winwid->type == WIN_TYPE_THUMBNAIL) { + feh_thumbnail *thumbnail; + int x, y; + + x = (ev->xbutton.x - winwid->im_x) / winwid->zoom; + y = (ev->xbutton.y - winwid->im_y) / winwid->zoom; + thumbnail = feh_thumbnail_get_thumbnail_from_coords(x, y); + feh_thumbnail_select(winwid, thumbnail); + } else { + feh_event_handle_generic(winwid, ev->xmotion.state | Mod3Mask, NoSymbol, 0); + } } } return; |