diff options
author | Daniel Friesel <derf@finalrewind.org> | 2017-02-26 15:46:31 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2017-02-26 15:46:31 +0100 |
commit | a0072d60705b9764970d435ec59dfc5c53158748 (patch) | |
tree | 19198c899753f80eae7f39450c075324b6f5e994 /src | |
parent | f05ba61aefee0b5a1f3c3c6413dd5501505f3ef4 (diff) |
Also update window title for thumbnail windows (closes #280)
Diffstat (limited to 'src')
-rw-r--r-- | src/feh.h | 1 | ||||
-rw-r--r-- | src/thumbnail.c | 13 | ||||
-rw-r--r-- | src/winwidget.c | 11 |
3 files changed, 22 insertions, 3 deletions
@@ -138,6 +138,7 @@ void show_mini_usage(void); void slideshow_change_image(winwidget winwid, int change, int render); void slideshow_pause_toggle(winwidget w); char *slideshow_create_name(feh_file * file, winwidget winwid); +char *thumbnail_create_name(feh_file * file, winwidget winwid); void init_keyevents(void); void init_buttonbindings(void); void feh_event_handle_keypress(XEvent * ev); diff --git a/src/thumbnail.c b/src/thumbnail.c index 012d516..c9cc24f 100644 --- a/src/thumbnail.c +++ b/src/thumbnail.c @@ -876,3 +876,16 @@ int feh_thumbnail_setup_thumbnail_dir(void) return status; } + +char *thumbnail_create_name(feh_file * file, winwidget winwid) +{ + char *s = NULL; + + if (!opt.thumb_title) { + s = estrdup(file->filename); + } else { + s = estrdup(feh_printf(opt.thumb_title, file, winwid)); + } + + return(s); +} diff --git a/src/winwidget.c b/src/winwidget.c index 707b060..6f64844 100644 --- a/src/winwidget.c +++ b/src/winwidget.c @@ -634,9 +634,14 @@ 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 && (current_file != NULL)) { - /* title might contain e.g. the zoom specifier -> rewrite */ - char *s = slideshow_create_name(FEH_FILE(current_file->data), winwid); + if (opt.title && (winwid->type != WIN_TYPE_THUMBNAIL_VIEWER) && + (winwid->file != NULL)) { + char *s = slideshow_create_name(FEH_FILE(winwid->file->data), winwid); + winwidget_rename(winwid, s); + free(s); + } else if (opt.thumb_title && (winwid->type == WIN_TYPE_THUMBNAIL_VIEWER) && + (winwid->file != NULL)) { + char *s = thumbnail_create_name(FEH_FILE(winwid->file->data), winwid); winwidget_rename(winwid, s); free(s); } |