summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2012-02-12 16:12:40 +0100
committerDaniel Friesel <derf@finalrewind.org>2012-02-12 16:12:40 +0100
commitbe7b3df6c008f74b2ebec9a61dda3db7da9a2a9d (patch)
treef513e9d2bcd6d7cb384bade126de5369242231d4 /src
parentb6a1cff6db874f4708d5ff5ea6a17248610b7d90 (diff)
Revert "Merge --scale-down / window dimension change patch"
This reverts commit b6a1cff6db874f4708d5ff5ea6a17248610b7d90.
Diffstat (limited to 'src')
-rw-r--r--src/events.c2
-rw-r--r--src/keyevents.c18
-rw-r--r--src/winwidget.c7
-rw-r--r--src/winwidget.h1
4 files changed, 7 insertions, 21 deletions
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;