From 0ce15f6b1934148b9f428d80910e0cc18ea617e5 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Tue, 9 Sep 2025 19:44:43 +0200 Subject: 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. --- src/winwidget.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/winwidget.c') 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; } } -- cgit v1.2.3