summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/resize.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2020-01-28 13:23:24 +0000
committernicm <nicm@openbsd.org>2020-01-28 13:23:24 +0000
commited53a239c35a152a94dbd2854e7afe37dc9799eb (patch)
tree41b65e8202553013607ca61321672997c68ab7e7 /usr.bin/tmux/resize.c
parentIgnore empty commands rather than adding them to the command list rather (diff)
downloadwireguard-openbsd-ed53a239c35a152a94dbd2854e7afe37dc9799eb.tar.xz
wireguard-openbsd-ed53a239c35a152a94dbd2854e7afe37dc9799eb.zip
If ALL clients are readonly, allow them to affect the size, suggested by Thomas Sattler.
Diffstat (limited to 'usr.bin/tmux/resize.c')
-rw-r--r--usr.bin/tmux/resize.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/usr.bin/tmux/resize.c b/usr.bin/tmux/resize.c
index 2fc565c4d71..0a226756e3a 100644
--- a/usr.bin/tmux/resize.c
+++ b/usr.bin/tmux/resize.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: resize.c,v 1.37 2020/01/28 08:06:11 nicm Exp $ */
+/* $OpenBSD: resize.c,v 1.38 2020/01/28 13:23:24 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -66,10 +66,26 @@ resize_window(struct window *w, u_int sx, u_int sy, int xpixel, int ypixel)
static int
ignore_client_size(struct client *c)
{
+ struct client *loop;
+
if (c->session == NULL)
return (1);
if (c->flags & CLIENT_NOSIZEFLAGS)
return (1);
+ if (c->flags & CLIENT_READONLY) {
+ /*
+ * Ignore readonly clients if there are any attached clients
+ * that aren't readonly.
+ */
+ TAILQ_FOREACH (loop, &clients, entry) {
+ if (loop->session == NULL)
+ continue;
+ if (loop->flags & CLIENT_NOSIZEFLAGS)
+ continue;
+ if (~loop->flags & CLIENT_READONLY)
+ return (1);
+ }
+ }
if ((c->flags & CLIENT_CONTROL) && (~c->flags & CLIENT_SIZECHANGED))
return (1);
return (0);