summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2013-11-20 20:53:18 +0100
committerDaniel Friesel <derf@finalrewind.org>2013-11-20 20:53:18 +0100
commit2f09bf037a9e02de6a0df68625f139173495699a (patch)
treeff792f643cc0b660a85c896eb515bd5de794d0ec /src
parentfa727bc857901a5c7b921e681c3ce1dbd5a26377 (diff)
events.c: fix off-by-one pixel error when bottom/right border pointer warping
Diffstat (limited to 'src')
-rw-r--r--src/events.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/events.c b/src/events.c
index fadae9b..15fd0fa 100644
--- a/src/events.c
+++ b/src/events.c
@@ -578,36 +578,36 @@ 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))
+ else if ((ev->xmotion.x <= 1) && (winwid->w <
+ (winwid->im_x + 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))
+ else if ((ev->xmotion.y <= 1) && (winwid->h <
+ (winwid->im_y + winwid->im_h * winwid->zoom)))
{
XWarpPointer(disp, None, winwid->win, 0, 0, 0, 0,
ev->xmotion.x, winwid->h - 4);