summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--src/slideshow.c11
-rw-r--r--src/winwidget.c20
3 files changed, 23 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 8167640..b29c07e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
* git HEAD
* Replace autoconf by config.mk
- * patch: Use z key to randomly jump in the filelist
+ * patch by decklin: Use z key to randomly jump in the filelist
+ * patch by muennich: Correctly set [Paused] window title in slideshow mode
* Fix problems with unexpectedly empty filelists
Tue Mar 16 07:56:36 CET 2010 Daniel Friesel <derf@chaosdorf.de>
diff --git a/src/slideshow.c b/src/slideshow.c
index 314374c..0d509e4 100644
--- a/src/slideshow.c
+++ b/src/slideshow.c
@@ -280,20 +280,13 @@ void slideshow_change_image(winwidget winwid, int change)
void slideshow_pause_toggle(winwidget w)
{
- char *title, *new_title;
- int len;
-
if (!opt.paused) {
opt.paused = 1;
-
- len = strlen(w->name) + sizeof(" [Paused]") + 1;
- new_title = emalloc(len);
- snprintf(new_title, len, "%s [Paused]", w->name);
- title = estrdup(w->name);
- winwidget_rename(w, new_title);
} else {
opt.paused = 0;
}
+
+ winwidget_rename(w, NULL);
}
char *slideshow_create_name(feh_file * file)
diff --git a/src/winwidget.c b/src/winwidget.c
index 6280f46..5ee7ace 100644
--- a/src/winwidget.c
+++ b/src/winwidget.c
@@ -868,10 +868,28 @@ winwidget winwidget_get_from_window(Window win)
void winwidget_rename(winwidget winwid, char *newname)
{
+ /* newname == NULL -> update current title */
+ char *p_str;
+
D_ENTER(4);
+ if (newname == NULL)
+ newname = estrdup(winwid->name ? winwid->name : "");
if (winwid->name)
free(winwid->name);
- winwid->name = estrdup(newname);
+
+ winwid->name = emalloc(strlen(newname) + 10);
+ strcpy(winwid->name, newname);
+
+ if (strlen(winwid->name) > 9)
+ p_str = winwid->name + strlen(winwid->name) - 9;
+ else
+ p_str = winwid->name;
+
+ if (opt.paused && strcmp(p_str, " [Paused]") != 0)
+ strcat(winwid->name, " [Paused]");
+ else if (!opt.paused && strcmp(p_str, " [Paused]") == 0)
+ *p_str = '\0';
+
winwidget_update_title(winwid);
D_RETURN_(4);
}