From 44d33fc2a05415cf20af360ee9f8bffd0d40460d Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 11 Jan 2017 20:56:04 +0100 Subject: rewrite window title whenever the image is rendered (closes #266) --- src/slideshow.c | 2 ++ src/winwidget.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/src/slideshow.c b/src/slideshow.c index 87ab29e..b15c360 100644 --- a/src/slideshow.c +++ b/src/slideshow.c @@ -615,6 +615,8 @@ char *feh_printf(char *str, feh_file * file, winwidget winwid) if (winwid) { snprintf(buf, sizeof(buf), "%.2f", winwid->zoom); strncat(ret, buf, sizeof(ret) - strlen(ret) - 1); + } else { + strncat(ret, "1.00", sizeof(ret) - strlen(ret) - 1); } break; case '%': diff --git a/src/winwidget.c b/src/winwidget.c index 758183b..e92f1c3 100644 --- a/src/winwidget.c +++ b/src/winwidget.c @@ -634,6 +634,12 @@ void winwidget_render_image(winwidget winwid, int resize, int force_alias) feh_draw_info(winwid); if (winwid->errstr) feh_draw_errstr(winwid); + if (opt.title) { + /* title might contain e.g. the zoom specifier -> rewrite */ + char *s = slideshow_create_name(FEH_FILE(current_file->data), winwid); + winwidget_rename(winwid, s); + free(s); + } } else if ((opt.mode == MODE_ZOOM) && !antialias) feh_draw_zoom(winwid); -- cgit v1.2.3