From 60f91708042e317bd319001c5aa4c8bfa4d6c250 Mon Sep 17 00:00:00 2001 From: Dane Jensen Date: Fri, 24 Jul 2026 16:09:21 -0700 Subject: [PATCH] Fixed `control_window_changed_layout_cb` It now emits the correct client informatiom. --- cmd-list-panes.c | 3 ++- cmd-list-sessions.c | 3 ++- cmd-list-windows.c | 3 ++- control-notify.c | 11 ++++++----- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/cmd-list-panes.c b/cmd-list-panes.c index 54c8db7d3..0d805d1f8 100644 --- a/cmd-list-panes.c +++ b/cmd-list-panes.c @@ -97,6 +97,7 @@ cmd_list_panes_window(struct cmd *self, struct session *s, struct winlink *wl, struct cmdq_item *item, int type) { struct args *args = cmd_get_args(self); + struct client *c = cmdq_get_client(item); struct window_pane *wp, **l; u_int i, n; struct format_tree *ft; @@ -147,7 +148,7 @@ cmd_list_panes_window(struct cmd *self, struct session *s, struct winlink *wl, wp = l[i]; ft = format_create(cmdq_get_client(item), item, FORMAT_NONE, 0); format_add(ft, "line", "%u", n); - format_defaults(ft, NULL, s, wl, wp); + format_defaults(ft, c, s, wl, wp); if (filter != NULL) { expanded = format_expand(ft, filter); diff --git a/cmd-list-sessions.c b/cmd-list-sessions.c index 07a622979..7eb644d8f 100644 --- a/cmd-list-sessions.c +++ b/cmd-list-sessions.c @@ -53,6 +53,7 @@ static enum cmd_retval cmd_list_sessions_exec(struct cmd *self, struct cmdq_item *item) { struct args *args = cmd_get_args(self); + struct client *c = cmdq_get_client(item); struct session **l; u_int n, i; struct format_tree *ft; @@ -76,7 +77,7 @@ cmd_list_sessions_exec(struct cmd *self, struct cmdq_item *item) for (i = 0; i < n; i++) { ft = format_create(cmdq_get_client(item), item, FORMAT_NONE, 0); format_add(ft, "line", "%u", i); - format_defaults(ft, NULL, l[i], NULL, NULL); + format_defaults(ft, c, l[i], NULL, NULL); if (filter != NULL) { expanded = format_expand(ft, filter); diff --git a/cmd-list-windows.c b/cmd-list-windows.c index 40f8c2db5..13d430886 100644 --- a/cmd-list-windows.c +++ b/cmd-list-windows.c @@ -60,6 +60,7 @@ cmd_list_windows_exec(struct cmd *self, struct cmdq_item *item) { struct args *args = cmd_get_args(self); struct cmd_find_state *target = cmdq_get_target(item); + struct client *c = cmdq_get_client(item); struct winlink *wl, **l; struct session *s; u_int i, n; @@ -94,7 +95,7 @@ cmd_list_windows_exec(struct cmd *self, struct cmdq_item *item) s = wl->session; ft = format_create(cmdq_get_client(item), item, FORMAT_NONE, 0); format_add(ft, "line", "%u", n); - format_defaults(ft, NULL, s, wl, NULL); + format_defaults(ft, c, s, wl, NULL); if (filter != NULL) { expanded = format_expand(ft, filter); diff --git a/control-notify.c b/control-notify.c index 6fec1683f..5ea914f3d 100644 --- a/control-notify.c +++ b/control-notify.c @@ -82,19 +82,20 @@ control_window_layout_changed_cb(__unused const char *name, * 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) + if (TAILQ_FIRST(&w->winlinks) == NULL || w->layout_root == NULL) return; - cp = format_single(NULL, template, NULL, NULL, wl, NULL); TAILQ_FOREACH(c, &clients, entry) { if (!CONTROL_SHOULD_NOTIFY_CLIENT(c) || c->session == NULL) continue; s = c->session; - if (winlink_find_by_window_id(&s->windows, w->id) != NULL) + wl = winlink_find_by_window_id(&s->windows, w->id); + if (wl != NULL) { + cp = format_single(NULL, template, c, s, wl, NULL); control_write(c, "%s", cp); + free(cp); + } } - free(cp); } /* Notify control clients that window pane changed. */