summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog15
-rw-r--r--src/winwidget.c29
2 files changed, 34 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index d984cdf..efcfd4b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+Tue, 09 Sep 2025 21:49:48 +0200 Birte Friesel <derf+feh@finalrewind.org>
+
+* Release v3.11.2
+ * Fix zoom_fit not centering the image correctly if the window is larger
+ than the image
+ * Fix rendering bugs introduced by attempts to fix a --scale-down
+ rendering issue in v3.11 and v3.11.1
+ * Note that this fix comes at the cost of slightly more visible
+ flashing in some cases where feh has to (re-)render an image multiple
+ times, especially if a fixed size is forced by the window manager.
+ While this behaviour can be annoying, it is certainly less annoying than
+ incorrect image offets.
+ * Thanks to Awal Garg for several joint debugging sessions related to
+ --scale-down rendering issues.
+
Fri, 29 Aug 2025 19:14:26 +0200 Birte Friesel <derf+feh@finalrewind.org>
* Release v3.11.1
diff --git a/src/winwidget.c b/src/winwidget.c
index 3b90158..809a0a6 100644
--- a/src/winwidget.c
+++ b/src/winwidget.c
@@ -549,17 +549,15 @@ void winwidget_render_image(winwidget winwid, int resize, int force_alias)
calc_h = lround(winwid->im_h * winwid->zoom);
dw = (winwid->w - winwid->im_x);
dh = (winwid->h - winwid->im_y);
+
+ D(("sx: %4d sy: %4d sw: sh: dx: %4d dy: %4d dw: %4d dh: %4d zoom: %f\n",
+ sx, sy, sw, sh, dx, dy, dw, dh, winwid->zoom));
+
if (calc_w < dw) {
dw = calc_w;
- if (!winwid->full_screen) {
- dx = 0;
- }
}
if (calc_h < dh) {
dh = calc_h;
- if (!winwid->full_screen) {
- dy = 0;
- }
}
if (dw > winwid->w)
dw = winwid->w;
@@ -569,7 +567,7 @@ void winwidget_render_image(winwidget winwid, int resize, int force_alias)
sw = lround(dw / winwid->zoom);
sh = lround(dh / winwid->zoom);
- D(("sx: %d sy: %d sw: %d sh: %d dx: %d dy: %d dw: %d dh: %d zoom: %f\n",
+ D(("sx: %4d sy: %4d sw: %4d sh: %4d dx: %4d dy: %4d dw: %4d dh: %4d zoom: %f\n",
sx, sy, sw, sh, dx, dy, dw, dh, winwid->zoom));
if ((winwid->zoom != 1.0 || winwid->has_rotated) && !force_alias && !winwid->force_aliasing)
@@ -960,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)) {
@@ -1116,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;
}
}