summaryrefslogtreecommitdiff
path: root/src/winwidget.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/winwidget.c')
-rw-r--r--src/winwidget.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/winwidget.c b/src/winwidget.c
index cd117ac..809a0a6 100644
--- a/src/winwidget.c
+++ b/src/winwidget.c
@@ -500,10 +500,8 @@ void winwidget_render_image(winwidget winwid, int resize, int force_alias)
} else {
winwid->im_x = - opt.offset_x * winwid->zoom;
}
- } else if (!opt.scale_down || (winwid->w != winwid->im_w)) {
- winwid->im_x = (int) (winwid->w - (winwid->im_w * winwid->zoom)) >> 1;
} else {
- winwid->im_x = 0;
+ winwid->im_x = (int) (winwid->w - (winwid->im_w * winwid->zoom)) >> 1;
}
if (opt.offset_flags & YValue) {
if (opt.offset_flags & YNegative) {
@@ -511,10 +509,8 @@ void winwidget_render_image(winwidget winwid, int resize, int force_alias)
} else {
winwid->im_y = - opt.offset_y * winwid->zoom;
}
- } else if (!opt.scale_down || (winwid->h != winwid->im_h)) {
- winwid->im_y = (int) (winwid->h - (winwid->im_h * winwid->zoom)) >> 1;
} else {
- winwid->im_y = 0;
+ winwid->im_y = (int) (winwid->h - (winwid->im_h * winwid->zoom)) >> 1;
}
}
@@ -962,7 +958,18 @@ void winwidget_resize(winwidget winwid, int w, int h, int force_resize)
winwid->had_resize = 1;
XFlush(disp);
- winwidget_get_geometry(winwid, NULL);
+ /*
+ * Note:
+ * While calling winwidget_get_geometry(winwid, NULL); at this point
+ * would help alleviate flashing issues that can occur when feh has
+ * to render a window two times in a row, or renders the initial image
+ * with a resolution that differs from the one that is needed to
+ * accomodate the resize.
+ *
+ * However, it would also break --scale-down in floating setups. As
+ * flashing is less annoying, we do not call winwidget_get_geometry.
+ * here.
+ */
if (force_resize && (opt.geom_flags & (WidthValue | HeightValue))
&& (winwid->type != WIN_TYPE_THUMBNAIL)) {
@@ -1118,11 +1125,11 @@ void winwidget_center_image(winwidget winwid)
if (opt.geom_flags & WidthValue)
winwid->im_x = ((int)opt.geom_w - lround(winwid->im_w * winwid->zoom)) >> 1;
else
- winwid->im_x = 0;
+ winwid->im_x = (int) (winwid->w - lround(winwid->im_w * winwid->zoom)) >> 1;
if (opt.geom_flags & HeightValue)
winwid->im_y = ((int)opt.geom_h - lround(winwid->im_h * winwid->zoom)) >> 1;
else
- winwid->im_y = 0;
+ winwid->im_y = (int) (winwid->h - lround(winwid->im_h * winwid->zoom)) >> 1;
}
}