summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2025-09-09 19:44:43 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2025-09-09 19:44:43 +0200
commit0ce15f6b1934148b9f428d80910e0cc18ea617e5 (patch)
treec7cb271a33db7bc31af9f7b3c3259f4f79ee3df2 /src
parent856cb97e527c2cde795f42960fab3a22612471cb (diff)
winwidget_center_image: do not hardcode x/y = 0
Previously, the zoom_fit / zoom_fill actions would place an image in a non-fullscreen setting at the top-left corner (x/y = 0) if the window was larger than required. Now, the image is centered correctly.
Diffstat (limited to 'src')
-rw-r--r--src/winwidget.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/winwidget.c b/src/winwidget.c
index cd117ac..69b7033 100644
--- a/src/winwidget.c
+++ b/src/winwidget.c
@@ -1118,11 +1118,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;
}
}