diff options
author | 2015-08-28 15:51:48 +0000 | |
---|---|---|
committer | 2015-08-28 15:51:48 +0000 | |
commit | a9de400b55cb60a860ca35ae345e3686ca6abc3a (patch) | |
tree | 6fb6b0f0b2c51ebc39f3f595599f474bc9be1ec5 /usr.bin/tmux/names.c | |
parent | Disable interrupts while the midi uart is not in use. Avoids generating (diff) | |
download | wireguard-openbsd-a9de400b55cb60a860ca35ae345e3686ca6abc3a.tar.xz wireguard-openbsd-a9de400b55cb60a860ca35ae345e3686ca6abc3a.zip |
We now only checking for name changes when the active pane has changed,
but that can only happen when we have already been woken up by a read
event, so there is no need for a timer, we can just check the changed
flag on the end of that read event (we already loop over the windows to
check for bells etc anyway).
Diffstat (limited to 'usr.bin/tmux/names.c')
-rw-r--r-- | usr.bin/tmux/names.c | 34 |
1 files changed, 8 insertions, 26 deletions
diff --git a/usr.bin/tmux/names.c b/usr.bin/tmux/names.c index 1091d26f83b..c407d1d67a2 100644 --- a/usr.bin/tmux/names.c +++ b/usr.bin/tmux/names.c @@ -1,4 +1,4 @@ -/* $OpenBSD: names.c,v 1.26 2015/08/28 13:26:41 nicm Exp $ */ +/* $OpenBSD: names.c,v 1.27 2015/08/28 15:51:48 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -25,37 +25,16 @@ #include "tmux.h" -void window_name_callback(unused int, unused short, void *); - -void -queue_window_name(struct window *w) -{ - struct timeval tv; - - tv.tv_sec = 0; - tv.tv_usec = NAME_INTERVAL * 1000L; - - if (event_initialized(&w->name_timer)) - evtimer_del(&w->name_timer); - evtimer_set(&w->name_timer, window_name_callback, w); - evtimer_add(&w->name_timer, &tv); -} - void -window_name_callback(unused int fd, unused short events, void *data) +check_window_name(struct window *w) { - struct window *w = data; - char *name; + char *name; if (w->active == NULL) return; - if (!options_get_number(&w->options, "automatic-rename")) { - if (event_initialized(&w->name_timer)) - event_del(&w->name_timer); + if (!options_get_number(&w->options, "automatic-rename")) return; - } - queue_window_name(w); if (~w->active->flags & PANE_CHANGED) return; @@ -63,9 +42,12 @@ window_name_callback(unused int fd, unused short events, void *data) name = format_window_name(w); if (strcmp(name, w->name) != 0) { + log_debug("@%u new name %s (was %s)", w->id, name, w->name); window_set_name(w, name); server_status_window(w); - } + } else + log_debug("@%u name not changed (still %s)", w->id, w->name); + free(name); } |