summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2010-04-09 23:34:24 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2010-04-09 23:34:24 +0200
commite35b7ca36f6764206a6676ef4a9e4c197475e023 (patch)
tree86c67e107575fe54575325c8eee2f5a41464b21f
parentfbbcc32e0b1ce724b1b30a48c38d4bd0e6c9ffd0 (diff)
events.c: Fix pointer warping a bit. Still has bugs, though.
-rw-r--r--src/events.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/events.c b/src/events.c
index a9e7ea2..742f65a 100644
--- a/src/events.c
+++ b/src/events.c
@@ -465,28 +465,35 @@ static void feh_event_handle_MotionNotify(XEvent * ev)
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) {
+ if ((winwid->w - ev->xmotion.x <= 1)
+ && (winwid->click_offset_x >= winwid->w - 4))
+ {
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) {
+ else if ((ev->xmotion.x <= 0) && (winwid->click_offset_x
+ <= winwid->im_w - winwid->w - 3))
+ {
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) {
+ else if ((winwid->h - ev->xmotion.y <= 1)
+ && (winwid->click_offset_y >= winwid->h - 4))
+ {
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) {
+ else if ((ev->xmotion.y <= 0) && (winwid->click_offset_y
+ <= winwid->im_h - winwid->h - 3))
+ {
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);