diff options
Diffstat (limited to 'src/winwidget.c')
-rw-r--r-- | src/winwidget.c | 29 |
1 files changed, 19 insertions, 10 deletions
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; } } |