mirror of
https://github.com/tmux/tmux.git
synced 2025-09-02 13:37:12 +00:00
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).
This commit is contained in:
32
names.c
32
names.c
@ -25,37 +25,16 @@
|
||||
|
||||
#include "tmux.h"
|
||||
|
||||
void window_name_callback(unused int, unused short, void *);
|
||||
|
||||
void
|
||||
queue_window_name(struct window *w)
|
||||
check_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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user