From f7168c8684e7c05cb66307f11ea79e93a8b539ab Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 10 Apr 2010 13:12:14 +0200 Subject: events.c: Make pointer warping work for zoomed images --- ChangeLog | 3 +++ TODO | 2 -- src/events.c | 4 ++-- src/winwidget.h | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 756a6b3..5758a6d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +* git HEAD + * Warp the pointer when reaching a window border in pan mode + Fri Apr 2 16:20:55 CEST 2010 Daniel Friesel * Release v1.4.2 diff --git a/TODO b/TODO index eb222c8..bc90f0e 100644 --- a/TODO +++ b/TODO @@ -23,5 +23,3 @@ On screen 1, it will work if fullscreen is turned off, the window is rendered and moved so that its top corner is only on screen 1, and then fullscreen is turned on (after that, it'll work for all images in the slideshow). Maybe I'll someday find out how to fix that :> - -In zoom / pan mode: Warp the mouse when reaching a screen corner. diff --git a/src/events.c b/src/events.c index 92c01cd..a5af3f2 100644 --- a/src/events.c +++ b/src/events.c @@ -473,7 +473,7 @@ static void feh_event_handle_MotionNotify(XEvent * ev) winwid->click_offset_x -= winwid->w - 4; } else if ((ev->xmotion.x <= 1) && (winwid->click_offset_x - <= winwid->im_w - winwid->w - 3)) + <= (winwid->im_w * winwid->zoom) - winwid->w - 3)) { XWarpPointer(disp, None, winwid->win, 0, 0, 0, 0, winwid->w - 4, ev->xmotion.y); @@ -487,7 +487,7 @@ static void feh_event_handle_MotionNotify(XEvent * ev) winwid->click_offset_y -= winwid->h - 4; } else if ((ev->xmotion.y <= 1) && (winwid->click_offset_y - <= winwid->im_h - winwid->h - 3)) + <= (winwid->im_h * winwid->zoom) - winwid->h - 3)) { XWarpPointer(disp, None, winwid->win, 0, 0, 0, 0, ev->xmotion.x, winwid->h - 4); diff --git a/src/winwidget.h b/src/winwidget.h index 47ebfcc..dd24f8f 100644 --- a/src/winwidget.h +++ b/src/winwidget.h @@ -100,7 +100,7 @@ struct __winwidget { /* New stuff */ int im_x; /* image offset from window top left */ int im_y; /* image offset from window top left */ - double zoom; /* From 0 (not visible) to 100 (actual size) + double zoom; /* From 0 (not visible) to 1.00 (actual size) all the way up to INT_MAX (ouch) */ int click_offset_x; int click_offset_y; -- cgit v1.2.3