diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2010-04-09 18:58:32 +0200 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2010-04-09 19:07:56 +0200 |
commit | fbbcc32e0b1ce724b1b30a48c38d4bd0e6c9ffd0 (patch) | |
tree | a4d4a72e97a2b28bd377695b9cecc6b5b67cb43d /src | |
parent | 2845f4504da49fd798cda7fc7bd365d9ad840849 (diff) |
Experimental cursor warping support
Diffstat (limited to 'src')
-rw-r--r-- | src/events.c | 25 |
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); |