summaryrefslogtreecommitdiff
path: root/src/events.c
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2010-09-27 18:33:47 +0200
committerDaniel Friesel <derf@finalrewind.org>2010-09-27 18:33:47 +0200
commitc2ad802b1f647740fbf3b597de73d071404a5432 (patch)
treee04f78f740200547cfb73f8c728e88d1e9b3c74c /src/events.c
parent287687d76c23c0274aa10835c8fcfcafcbc2a021 (diff)
Zoom button: Do 100% zoom upon release, not click.
Fixes the annoying 100% zoom and then continuing where it was.
Diffstat (limited to 'src/events.c')
-rw-r--r--src/events.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/events.c b/src/events.c
index 5a4a059..36379b1 100644
--- a/src/events.c
+++ b/src/events.c
@@ -114,16 +114,12 @@ static void feh_event_handle_ButtonPress(XEvent * ev)
winwid->click_offset_x = ev->xbutton.x;
winwid->click_offset_y = ev->xbutton.y;
winwid->old_zoom = winwid->zoom;
- winwid->zoom = 1.0;
/* required to adjust the image position in zoom mode */
winwid->im_click_offset_x = (winwid->click_offset_x
- winwid->im_x) / winwid->old_zoom;
winwid->im_click_offset_y = (winwid->click_offset_y
- winwid->im_y) / winwid->old_zoom;
-
- winwidget_center_image(winwid);
- winwidget_render_image(winwid, 0, 0);
}
} else if (ev->xbutton.button == opt.reload_button) {
D(("Reload Button Press event\n"));
@@ -242,7 +238,15 @@ static void feh_event_handle_ButtonRelease(XEvent * ev)
D(("Disabling mode\n"));
opt.mode = MODE_NORMAL;
winwid->mode = MODE_NORMAL;
- winwidget_sanitise_offsets(winwid);
+
+ if ((ev->xbutton.button == opt.zoom_button)
+ && (ev->xbutton.x == winwid->click_offset_x)
+ && (ev->xbutton.y == winwid->click_offset_y)) {
+ winwid->zoom = 1.0;
+ winwidget_center_image(winwid);
+ } else
+ winwidget_sanitise_offsets(winwid);
+
winwidget_render_image(winwid, 0, 1);
}
} else if ((ev->xbutton.button == opt.blur_button)