diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | src/events.c | 2 | ||||
-rw-r--r-- | src/keyevents.c | 18 | ||||
-rw-r--r-- | src/winwidget.c | 7 | ||||
-rw-r--r-- | src/winwidget.h | 1 |
5 files changed, 7 insertions, 25 deletions
@@ -1,7 +1,3 @@ -git HEAD - - * Patch to improve --scale-down behaviour when window size is changed - Thu, 02 Feb 2012 21:04:06 +0100 Daniel Friesel <derf@finalrewind.org> * Release v2.3 diff --git a/src/events.c b/src/events.c index 9fb2379..0d5e07d 100644 --- a/src/events.c +++ b/src/events.c @@ -235,7 +235,6 @@ 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->has_manual_zoom = 1; /* required to adjust the image position in zoom mode */ winwid->im_click_offset_x = (winwid->click_offset_x @@ -333,7 +332,6 @@ static void feh_event_handle_ButtonRelease(XEvent * ev) && (ev->xbutton.x == winwid->click_offset_x) && (ev->xbutton.y == winwid->click_offset_y)) { winwid->zoom = 1.0; - winwid->has_manual_zoom = 0; winwidget_center_image(winwid); } else winwidget_sanitise_offsets(winwid); diff --git a/src/keyevents.c b/src/keyevents.c index c551ae3..0ada751 100644 --- a/src/keyevents.c +++ b/src/keyevents.c @@ -573,9 +573,6 @@ void feh_event_handle_keypress(XEvent * ev) feh_event_invoke_action(winwid, 9); } else if (feh_is_kp(&keys.zoom_in, keysym, state)) { - if (!winwid->has_manual_zoom) - winwid->has_manual_zoom = 1; - winwid->old_zoom = winwid->zoom; winwid->zoom = winwid->zoom * 1.25; @@ -590,9 +587,6 @@ void feh_event_handle_keypress(XEvent * ev) winwidget_render_image(winwid, 0, 0); } else if (feh_is_kp(&keys.zoom_out, keysym, state)) { - if (!winwid->has_manual_zoom) - winwid->has_manual_zoom = 1; - winwid->old_zoom = winwid->zoom; winwid->zoom = winwid->zoom * 0.80; @@ -607,17 +601,17 @@ void feh_event_handle_keypress(XEvent * ev) winwidget_render_image(winwid, 0, 0); } else if (feh_is_kp(&keys.zoom_default, keysym, state)) { - if (!winwid->has_manual_zoom) - winwid->has_manual_zoom = 1; - winwid->zoom = 1.0; + /* --scale-down will revert our operation if old_zoom == 1.0 */ + if (opt.scale_down) + winwid->old_zoom = 1.001; winwidget_center_image(winwid); winwidget_render_image(winwid, 0, 0); + /* --scale-down will also do weird stuff if zoom is 1.0 */ + if (opt.scale_down) + winwid->zoom = 1.001; } else if (feh_is_kp(&keys.zoom_fit, keysym, state)) { - if (!winwid->has_manual_zoom) - winwid->has_manual_zoom = 1; - feh_calc_needed_zoom(&winwid->zoom, winwid->im_w, winwid->im_h, winwid->w, winwid->h); winwidget_center_image(winwid); winwidget_render_image(winwid, 0, 0); diff --git a/src/winwidget.c b/src/winwidget.c index 36720ac..ae34045 100644 --- a/src/winwidget.c +++ b/src/winwidget.c @@ -71,7 +71,6 @@ static winwidget winwidget_allocate(void) ret->im_y = 0; ret->zoom = 1.0; ret->old_zoom = 1.0; - ret->has_manual_zoom = 0; ret->click_offset_x = 0; ret->click_offset_y = 0; @@ -395,9 +394,6 @@ void winwidget_render_image(winwidget winwid, int resize, int force_alias) if (winwid->im_y > winwid->h) winwid->im_y = winwid->h; - if (!winwid->has_manual_zoom && winwid->zoom < 1.0) - winwid->zoom = 1.0; - D(("winwidget_render_image resize %d force_alias %d im %dx%d\n", resize, force_alias, winwid->im_w, winwid->im_h)); @@ -405,7 +401,7 @@ void winwidget_render_image(winwidget winwid, int resize, int force_alias) if (!winwid->full_screen && opt.scale_down && ((winwid->w < winwid->im_w) || (winwid->h < winwid->im_h)) && - (!winwid->has_manual_zoom)) { + (winwid->old_zoom == 1.0)) { D(("scaling down image %dx%d\n", winwid->w, winwid->h)); feh_calc_needed_zoom(&(winwid->zoom), winwid->im_w, winwid->im_h, winwid->w, winwid->h); @@ -954,7 +950,6 @@ void feh_debug_print_winwid(winwidget w) void winwidget_reset_image(winwidget winwid) { - winwid->has_manual_zoom = 0; winwid->zoom = 1.0; winwid->old_zoom = 1.0; winwid->im_x = 0; diff --git a/src/winwidget.h b/src/winwidget.h index 3a99868..33ad945 100644 --- a/src/winwidget.h +++ b/src/winwidget.h @@ -108,7 +108,6 @@ struct __winwidget { */ double zoom; double old_zoom; - unsigned char has_manual_zoom; int click_offset_x; int click_offset_y; |