summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/events.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/events.c b/src/events.c
index 7db319d..a9e7ea2 100644
--- a/src/events.c
+++ b/src/events.c
@@ -462,6 +462,31 @@ static void feh_event_handle_MotionNotify(XEvent * ev)
winwidget_sanitise_offsets(winwid);
+ D(4, ("im_x %d, im_w %d, off %d, mx %d\n", winwid->im_x,
+ winwid->im_w, winwid->click_offset_x, ev->xmotion.x));
+
+ if (winwid->w - ev->xmotion.x <= 1) {
+ 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 <= 0) {
+ XWarpPointer(disp, None, winwid->win, 0, 0, 0, 0,
+ winwid->im_w - 4, ev->xmotion.y);
+ winwid->click_offset_x += winwid->w - 3;
+ }
+ else if (winwid->h - ev->xmotion.y <= 1) {
+ 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 <= 0) {
+ XWarpPointer(disp, None, winwid->win, 0, 0, 0, 0,
+ ev->xmotion.x, winwid->im_h - 4);
+ winwid->click_offset_y += winwid->h - 3;
+ }
+
+
if ((winwid->im_x != orig_x)
|| (winwid->im_y != orig_y))
winwidget_render_image(winwid, 0, 0);