diff options
Diffstat (limited to 'src/events.c')
-rw-r--r-- | src/events.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/events.c b/src/events.c index fadae9b..e6cf0ac 100644 --- a/src/events.c +++ b/src/events.c @@ -378,8 +378,12 @@ static void feh_event_handle_ButtonRelease(XEvent * ev) x /= winwid->zoom; y /= winwid->zoom; thumbfile = feh_thumbnail_get_file_from_coords(x, y); - if (thumbfile) - feh_thumbnail_show_fullsize(thumbfile); + if (thumbfile) { + if (opt.actions[0]) + feh_action_run(thumbfile, opt.actions[0]); + else + feh_thumbnail_show_fullsize(thumbfile); + } } } else { opt.mode = MODE_NORMAL; @@ -578,36 +582,38 @@ static void feh_event_handle_MotionNotify(XEvent * ev) winwidget_sanitise_offsets(winwid); - D(("im_x %d, im_w %d, off %d, mx %d\n", winwid->im_x, - winwid->im_w, winwid->click_offset_x, ev->xmotion.x)); + D(("im_x %d, im_w %d, off %d, mx %d, my %d\n", winwid->im_x, + winwid->im_w, winwid->click_offset_x, ev->xmotion.x, + ev->xmotion.y)); /* XWarpPointer generates a MotionNotify event which we will * parse. Since that event would undo the effect of the pointer * warp, we need to change the click_offset to compensate this. */ - if ((winwid->w - ev->xmotion.x <= 1) - && (winwid->click_offset_x >= winwid->w - 4)) + if ((winwid->w - ev->xmotion.x <= 1) && (winwid->im_x < 0)) { XWarpPointer(disp, None, winwid->win, 0, 0, 0, 0, 3, ev->xmotion.y); winwid->click_offset_x -= winwid->w - 4; } - else if ((ev->xmotion.x <= 1) && (winwid->click_offset_x - <= (winwid->im_w * winwid->zoom) - winwid->w - 3)) + // TODO needlessly warps for certain zoom levels + else if ((ev->xmotion.x <= 1) && (winwid->im_x > + (winwid->w - winwid->im_w * winwid->zoom))) { XWarpPointer(disp, None, winwid->win, 0, 0, 0, 0, winwid->w - 4, ev->xmotion.y); winwid->click_offset_x += winwid->w - 4; } else if ((winwid->h - ev->xmotion.y <= 1) - && (winwid->click_offset_y >= winwid->h - 4)) + && (winwid->im_y < 0)) { XWarpPointer(disp, None, winwid->win, 0, 0, 0, 0, ev->xmotion.x, 3); winwid->click_offset_y -= winwid->h - 4; } - else if ((ev->xmotion.y <= 1) && (winwid->click_offset_y - <= (winwid->im_h * winwid->zoom) - winwid->h - 3)) + // TODO needlessly warps for certain zoomlevels + else if ((ev->xmotion.y <= 1) && (winwid->im_y > + (winwid->h - winwid->im_h * winwid->zoom))) { XWarpPointer(disp, None, winwid->win, 0, 0, 0, 0, ev->xmotion.x, winwid->h - 4); |