summaryrefslogtreecommitdiff
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
parent287687d76c23c0274aa10835c8fcfcafcbc2a021 (diff)
Zoom button: Do 100% zoom upon release, not click.
Fixes the annoying 100% zoom and then continuing where it was.
-rw-r--r--ChangeLog1
-rw-r--r--man/feh.pre9
-rw-r--r--src/events.c14
3 files changed, 14 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index cca9f5a..e8bc369 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,7 @@ git HEAD
* Do not change to the next slide when executing an action with ; as first
character (this character is stripped when executing the action)
* Speed up panning, zooming etc. by hiding image overlay text
+ * Zoom button: Zoom to 100% on button release, not button click
Tue, 24 Aug 2010 19:23:36 +0200 Daniel Friesel <derf@chaosdorf.de>
diff --git a/man/feh.pre b/man/feh.pre
index 7c6f064..7605bb2 100644
--- a/man/feh.pre
+++ b/man/feh.pre
@@ -779,11 +779,10 @@ will warp your cursor to the opposite border so you can continue panning.
.Pp
When clicking the zoom button and immediately releasing it, the image will be
back at 100% zoom. When clicking it and moving the mouse while holding the
-button down, the zoom will be continued at the previous zoom level. Do not let
-the short snapback to 100% confuse you, it'll be removed as soon as you move
-the mouse. The zoom will always happen so that the pixel on which you entered
-the zoom mode remains stationary. So, to enlarge a specific part of an image,
-click the zoom button on that part.
+button down, the zoom will be continued at the previous zoom level. The zoom
+will always happen so that the pixel on which you entered the zoom mode
+remains stationary. So, to enlarge a specific part of an image, click the
+zoom button on that part.
.
.Sh SIGNALS
In slideshow mode,
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)