diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2012-04-08 06:47:27 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2012-04-08 06:47:27 +0000 |
commit | cd27efa8187175d44ed88a213a00b3cd5c57f2b0 (patch) | |
tree | 4ca40a9a8cc55bfa5a904b32ee29ce3f5e9aec78 /usr.bin/tmux | |
parent | 2d61ba4635df76e223b6b8c7d10803b1f3e71b97 (diff) |
Do not fire name timer when automatic-rename is off, from Tim Ruehsen a
while ago.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r-- | usr.bin/tmux/cmd-set-option.c | 15 | ||||
-rw-r--r-- | usr.bin/tmux/names.c | 6 | ||||
-rw-r--r-- | usr.bin/tmux/window.c | 6 |
3 files changed, 19 insertions, 8 deletions
diff --git a/usr.bin/tmux/cmd-set-option.c b/usr.bin/tmux/cmd-set-option.c index fd5c013fb28..4babd2a3796 100644 --- a/usr.bin/tmux/cmd-set-option.c +++ b/usr.bin/tmux/cmd-set-option.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-set-option.c,v 1.54 2012/03/17 21:33:33 nicm Exp $ */ +/* $OpenBSD: cmd-set-option.c,v 1.55 2012/04/08 06:47:26 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/names.c b/usr.bin/tmux/names.c index 73be30c24f4..167ae71852c 100644 --- a/usr.bin/tmux/names.c +++ b/usr.bin/tmux/names.c @@ -1,4 +1,4 @@ -/* $OpenBSD: names.c,v 1.13 2012/03/17 18:24:07 nicm Exp $ */ +/* $OpenBSD: names.c,v 1.14 2012/04/08 06:47:26 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/window.c b/usr.bin/tmux/window.c index d1a7dc5d1b1..8f3b2eceda3 100644 --- a/usr.bin/tmux/window.c +++ b/usr.bin/tmux/window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window.c,v 1.78 2012/04/01 20:53:47 nicm Exp $ */ +/* $OpenBSD: window.c,v 1.79 2012/04/08 06:47:26 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -297,9 +297,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) { |