mirror of
https://github.com/tmux/tmux.git
synced 2026-03-05 23:35:35 +00:00
Format layout change string once per window in control notify, from
Conor Taylor in GitHub issue 4848.
This commit is contained in:
@@ -51,29 +51,24 @@ control_notify_window_layout_changed(struct window *w)
|
|||||||
template = "%layout-change #{window_id} #{window_layout} "
|
template = "%layout-change #{window_id} #{window_layout} "
|
||||||
"#{window_visible_layout} #{window_raw_flags}";
|
"#{window_visible_layout} #{window_raw_flags}";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* When the last pane in a window is closed it won't have a layout root
|
||||||
|
* and we don't need to inform the client about the layout change
|
||||||
|
* because the whole window will go away soon.
|
||||||
|
*/
|
||||||
|
wl = TAILQ_FIRST(&w->winlinks);
|
||||||
|
if (wl == NULL || w->layout_root == NULL)
|
||||||
|
return;
|
||||||
|
cp = format_single(NULL, template, NULL, NULL, wl, NULL);
|
||||||
|
|
||||||
TAILQ_FOREACH(c, &clients, entry) {
|
TAILQ_FOREACH(c, &clients, entry) {
|
||||||
if (!CONTROL_SHOULD_NOTIFY_CLIENT(c) || c->session == NULL)
|
if (!CONTROL_SHOULD_NOTIFY_CLIENT(c) || c->session == NULL)
|
||||||
continue;
|
continue;
|
||||||
s = c->session;
|
s = c->session;
|
||||||
|
if (winlink_find_by_window_id(&s->windows, w->id) != NULL)
|
||||||
if (winlink_find_by_window_id(&s->windows, w->id) == NULL)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* When the last pane in a window is closed it won't have a
|
|
||||||
* layout root and we don't need to inform the client about the
|
|
||||||
* layout change because the whole window will go away soon.
|
|
||||||
*/
|
|
||||||
if (w->layout_root == NULL)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
wl = winlink_find_by_window(&s->windows, w);
|
|
||||||
if (wl != NULL) {
|
|
||||||
cp = format_single(NULL, template, c, NULL, wl, NULL);
|
|
||||||
control_write(c, "%s", cp);
|
control_write(c, "%s", cp);
|
||||||
free(cp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
free(cp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user