diff options
author | 2019-11-29 16:04:07 +0000 | |
---|---|---|
committer | 2019-11-29 16:04:07 +0000 | |
commit | 1e388329b58499a53a09942a6a8f5d1e99212f9e (patch) | |
tree | dc0b1764a0a2c555e5fea711313e9c39b26c8602 /usr.bin/tmux/resize.c | |
parent | While we learn how the "decaying" histogram works it's helpful to show (diff) | |
download | wireguard-openbsd-1e388329b58499a53a09942a6a8f5d1e99212f9e.tar.xz wireguard-openbsd-1e388329b58499a53a09942a6a8f5d1e99212f9e.zip |
If a window appears in only one attached session, there is no point in
worrying about which is the latest client (there is only one).
Diffstat (limited to 'usr.bin/tmux/resize.c')
-rw-r--r-- | usr.bin/tmux/resize.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/usr.bin/tmux/resize.c b/usr.bin/tmux/resize.c index 46fbb93b195..2ac2993a437 100644 --- a/usr.bin/tmux/resize.c +++ b/usr.bin/tmux/resize.c @@ -1,4 +1,4 @@ -/* $OpenBSD: resize.c,v 1.35 2019/11/28 09:45:16 nicm Exp $ */ +/* $OpenBSD: resize.c,v 1.36 2019/11/29 16:04:07 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -80,7 +80,7 @@ default_window_size(struct client *c, struct session *s, struct window *w, u_int *sx, u_int *sy, u_int *xpixel, u_int *ypixel, int type) { struct client *loop; - u_int cx, cy; + u_int cx, cy, n; const char *value; if (type == -1) @@ -149,12 +149,22 @@ default_window_size(struct client *c, struct session *s, struct window *w, *xpixel = c->tty.xpixel; *ypixel = c->tty.ypixel; } else { + if (w == NULL) + goto manual; + n = 0; + TAILQ_FOREACH(loop, &clients, entry) { + if (!ignore_client_size(loop) && + session_has(loop->session, w)) { + if (++n > 1) + break; + } + } *sx = *sy = UINT_MAX; *xpixel = *ypixel = 0; TAILQ_FOREACH(loop, &clients, entry) { if (ignore_client_size(loop)) continue; - if (w != NULL && loop != w->latest) + if (n > 1 && loop != w->latest) continue; s = loop->session; @@ -204,7 +214,7 @@ recalculate_size(struct window *w) { struct session *s; struct client *c; - u_int sx, sy, cx, cy, xpixel = 0, ypixel = 0; + u_int sx, sy, cx, cy, xpixel = 0, ypixel = 0, n; int type, current, has, changed; if (w->active == NULL) @@ -277,11 +287,19 @@ recalculate_size(struct window *w) changed = 0; break; case WINDOW_SIZE_LATEST: + n = 0; + TAILQ_FOREACH(c, &clients, entry) { + if (!ignore_client_size(c) && + session_has(c->session, w)) { + if (++n > 1) + break; + } + } sx = sy = UINT_MAX; TAILQ_FOREACH(c, &clients, entry) { if (ignore_client_size(c)) continue; - if (c != w->latest) + if (n > 1 && c != w->latest) continue; s = c->session; |