summaryrefslogtreecommitdiffstats
path: root/control-notify.c
diff options
context:
space:
mode:
authornicm <nicm>2014-04-23 10:14:29 +0000
committernicm <nicm>2014-04-23 10:14:29 +0000
commit7ab2690be8a451d123b12906b729e163ea37e0dd (patch)
treeea2eaef2fa9ea9861cf333243aa79eebdf79b9ea /control-notify.c
parent64613b9d411a7c76a50a2f9c66df345f082fce25 (diff)
Differentiate between linked and unlinked window closes and renames,
like we already do for adds. From Andre Masella.
Diffstat (limited to 'control-notify.c')
-rw-r--r--control-notify.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/control-notify.c b/control-notify.c
index a298cdc5..4ea1570b 100644
--- a/control-notify.c
+++ b/control-notify.c
@@ -99,14 +99,19 @@ void
control_notify_window_unlinked(unused struct session *s, struct window *w)
{
struct client *c;
+ struct session *cs;
u_int i;
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
c = ARRAY_ITEM(&clients, i);
if (!CONTROL_SHOULD_NOTIFY_CLIENT(c) || c->session == NULL)
continue;
+ cs = c->session;
- control_write(c, "%%window-close @%u", w->id);
+ if (winlink_find_by_window_id(&cs->windows, w->id) != NULL)
+ control_write(c, "%%window-close @%u", w->id);
+ else
+ control_write(c, "%%unlinked-window-close @%u", w->id);
}
}
@@ -134,14 +139,22 @@ void
control_notify_window_renamed(struct window *w)
{
struct client *c;
+ struct session *cs;
u_int i;
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
c = ARRAY_ITEM(&clients, i);
if (!CONTROL_SHOULD_NOTIFY_CLIENT(c) || c->session == NULL)
continue;
+ cs = c->session;
- control_write(c, "%%window-renamed @%u %s", w->id, w->name);
+ if (winlink_find_by_window_id(&cs->windows, w->id) != NULL) {
+ control_write(c, "%%window-renamed @%u %s", w->id,
+ w->name);
+ } else {
+ control_write(c, "%%unlinked-window-renamed @%u %s",
+ w->id, w->name);
+ }
}
}