aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2012-04-10 09:57:08 +0000
committerTiago Cunha <tcunha@gmx.com>2012-04-10 09:57:08 +0000
commitce67a44a94a9d524ec8f45a452dde37fd7ea991f (patch)
tree39a8d4dc31815afe7e4cdc5d1963d2931d63fa63
parent14e5cdf02e5a618733c0ba1e11563c851602ec83 (diff)
downloadrtmux-ce67a44a94a9d524ec8f45a452dde37fd7ea991f.tar.gz
rtmux-ce67a44a94a9d524ec8f45a452dde37fd7ea991f.tar.bz2
rtmux-ce67a44a94a9d524ec8f45a452dde37fd7ea991f.zip
Sync OpenBSD patchset 1091:
Do not fire name timer when automatic-rename is off, from Tim Ruehsen a while ago.
-rw-r--r--cmd-set-option.c13
-rw-r--r--names.c4
-rw-r--r--window.c4
3 files changed, 16 insertions, 5 deletions
diff --git a/cmd-set-option.c b/cmd-set-option.c
index 5bb0a9f4..3d4e7001 100644
--- a/cmd-set-option.c
+++ b/cmd-set-option.c
@@ -87,6 +87,7 @@ cmd_set_option_exec(struct cmd *self, struct cmd_ctx *ctx)
struct winlink *wl;
struct client *c;
struct options *oo;
+ struct window *w;
const char *optstr, *valstr;
u_int i;
@@ -147,6 +148,18 @@ cmd_set_option_exec(struct cmd *self, struct cmd_ctx *ctx)
return (-1);
}
+ /* Start or stop timers when automatic-rename changed. */
+ if (strcmp (oe->name, "automatic-rename") == 0) {
+ for (i = 0; i < ARRAY_LENGTH(&windows); i++) {
+ if ((w = ARRAY_ITEM(&windows, i)) == NULL)
+ continue;
+ if (options_get_number(&w->options, "automatic-rename"))
+ queue_window_name(w);
+ else if (event_initialized(&w->name_timer))
+ evtimer_del(&w->name_timer);
+ }
+ }
+
/* Update sizes and redraw. May not need it but meh. */
recalculate_sizes();
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
diff --git a/names.c b/names.c
index 1dbc26dd..d077abe7 100644
--- a/names.c
+++ b/names.c
@@ -49,9 +49,7 @@ window_name_callback(unused int fd, unused short events, void *data)
struct window *w = data;
char *name, *wname;
- queue_window_name(w); /* XXX even if the option is off? */
- if (!options_get_number(&w->options, "automatic-rename"))
- return;
+ queue_window_name(w); /* stopped when option turned off */
if (w->active->screen != &w->active->base)
name = NULL;
diff --git a/window.c b/window.c
index 800a716c..fac56dc6 100644
--- a/window.c
+++ b/window.c
@@ -294,9 +294,9 @@ window_create1(u_int sx, u_int sy)
w->sx = sx;
w->sy = sy;
- queue_window_name(w);
-
options_init(&w->options, &global_w_options);
+ if (options_get_number(&w->options, "automatic-rename"))
+ queue_window_name(w);
for (i = 0; i < ARRAY_LENGTH(&windows); i++) {
if (ARRAY_ITEM(&windows, i) == NULL) {