summaryrefslogtreecommitdiffstats
path: root/server-client.c
diff options
context:
space:
mode:
authornicm <nicm>2021-08-27 17:15:57 +0000
committernicm <nicm>2021-08-27 17:15:57 +0000
commitfd756a150b43d319d08ac4117f34edef9e0438c4 (patch)
tree003f77b6051466412eba1fa0260b9e95c89e3923 /server-client.c
parent24636be42b4b0463afe5c72e1d982f28729a0579 (diff)
Allow control mode clients to set a hard limit on the window width and
height, GitHub issue 2594.
Diffstat (limited to 'server-client.c')
-rw-r--r--server-client.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/server-client.c b/server-client.c
index ac9a7475..062e72d4 100644
--- a/server-client.c
+++ b/server-client.c
@@ -2443,7 +2443,7 @@ server_client_get_flags(struct client *c)
}
/* Get client window. */
-static struct client_window *
+struct client_window *
server_client_get_client_window(struct client *c, u_int id)
{
struct client_window cw = { .window = id };
@@ -2451,6 +2451,21 @@ server_client_get_client_window(struct client *c, u_int id)
return (RB_FIND(client_windows, &c->windows, &cw));
}
+/* Add client window. */
+struct client_window *
+server_client_add_client_window(struct client *c, u_int id)
+{
+ struct client_window *cw;
+
+ cw = server_client_get_client_window(c, id);
+ if (cw == NULL) {
+ cw = xcalloc(1, sizeof *cw);
+ cw->window = id;
+ RB_INSERT(client_windows, &c->windows, cw);
+ }
+ return cw;
+}
+
/* Get client active pane. */
struct window_pane *
server_client_get_pane(struct client *c)
@@ -2479,12 +2494,7 @@ server_client_set_pane(struct client *c, struct window_pane *wp)
if (s == NULL)
return;
- cw = server_client_get_client_window(c, s->curw->window->id);
- if (cw == NULL) {
- cw = xcalloc(1, sizeof *cw);
- cw->window = s->curw->window->id;
- RB_INSERT(client_windows, &c->windows, cw);
- }
+ cw = server_client_add_client_window(c, s->curw->window->id);
cw->pane = wp;
log_debug("%s pane now %%%u", c->name, wp->id);
}