diff options
author | 2019-03-12 13:56:30 +0000 | |
---|---|---|
committer | 2019-03-12 13:56:30 +0000 | |
commit | db993454abd2c5952a13e7cdd9a242b40879596a (patch) | |
tree | 148a8eae622f28cc05332b6f948b0f60fc644728 | |
parent | Fix wrapping after origin mode change. (diff) | |
download | wireguard-openbsd-db993454abd2c5952a13e7cdd9a242b40879596a.tar.xz wireguard-openbsd-db993454abd2c5952a13e7cdd9a242b40879596a.zip |
Fix resizing of control clients, should be ignored until SIZECHANGED flag set.
-rw-r--r-- | usr.bin/tmux/cmd-new-session.c | 6 | ||||
-rw-r--r-- | usr.bin/tmux/resize.c | 44 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 5 | ||||
-rw-r--r-- | usr.bin/tmux/window.c | 6 |
4 files changed, 31 insertions, 30 deletions
diff --git a/usr.bin/tmux/cmd-new-session.c b/usr.bin/tmux/cmd-new-session.c index c611e2f6e30..a3fa8c87783 100644 --- a/usr.bin/tmux/cmd-new-session.c +++ b/usr.bin/tmux/cmd-new-session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-new-session.c,v 1.114 2018/10/18 08:38:01 nicm Exp $ */ +/* $OpenBSD: cmd-new-session.c,v 1.115 2019/03/12 13:56:30 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -222,9 +222,7 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item) if (!detached && !is_control) { sx = c->tty.sx; sy = c->tty.sy; - if (!is_control && - sy > 0 && - options_get_number(global_s_options, "status")) + if (sy > 0 && options_get_number(global_s_options, "status")) sy--; } else { value = options_get_string(global_s_options, "default-size"); diff --git a/usr.bin/tmux/resize.c b/usr.bin/tmux/resize.c index 8eb264fcdf7..70289b358db 100644 --- a/usr.bin/tmux/resize.c +++ b/usr.bin/tmux/resize.c @@ -1,4 +1,4 @@ -/* $OpenBSD: resize.c,v 1.28 2019/03/04 09:29:52 nicm Exp $ */ +/* $OpenBSD: resize.c,v 1.29 2019/03/12 13:56:30 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -61,6 +61,18 @@ resize_window(struct window *w, u_int sx, u_int sy) notify_window("window-layout-changed", w); } +static int +ignore_client_size(struct client *c) +{ + if (c->session == NULL) + return (1); + if (c->flags & CLIENT_NOSIZEFLAGS) + return (1); + if ((c->flags & CLIENT_CONTROL) && (~c->flags & CLIENT_SIZECHANGED)) + return (1); + return (0); +} + void default_window_size(struct session *s, struct window *w, u_int *sx, u_int *sy, int type) @@ -77,9 +89,7 @@ default_window_size(struct session *s, struct window *w, u_int *sx, u_int *sy, if (type == WINDOW_SIZE_LARGEST) { *sx = *sy = 0; TAILQ_FOREACH(c, &clients, entry) { - if (c->session == NULL) - continue; - if (c->flags & CLIENT_NOSIZEFLAGS) + if (ignore_client_size(c)) continue; if (w != NULL && !session_has(c->session, w)) continue; @@ -99,9 +109,7 @@ default_window_size(struct session *s, struct window *w, u_int *sx, u_int *sy, } else { *sx = *sy = UINT_MAX; TAILQ_FOREACH(c, &clients, entry) { - if (c->session == NULL) - continue; - if (c->flags & CLIENT_NOSIZEFLAGS) + if (ignore_client_size(c)) continue; if (w != NULL && !session_has(c->session, w)) continue; @@ -146,7 +154,7 @@ recalculate_sizes(void) struct client *c; struct window *w; u_int sx, sy, cx, cy; - int flags, type, current, has, changed; + int type, current, has, changed; /* * Clear attached count and update saved status line information for @@ -162,21 +170,13 @@ recalculate_sizes(void) * client. */ TAILQ_FOREACH(c, &clients, entry) { - if ((s = c->session) == NULL) - continue; - - flags = c->flags; - if (flags & CLIENT_SUSPENDED) - continue; - if ((flags & CLIENT_CONTROL) && (~flags & CLIENT_SIZECHANGED)) + if (ignore_client_size(c)) continue; - if (c->tty.sy <= status_line_size(c)) c->flags |= CLIENT_STATUSOFF; else c->flags &= ~CLIENT_STATUSOFF; - - s->attached++; + c->session->attached++; } /* Walk each window and adjust the size. */ @@ -194,8 +194,10 @@ recalculate_sizes(void) if (type == WINDOW_SIZE_LARGEST) { sx = sy = 0; TAILQ_FOREACH(c, &clients, entry) { - if ((s = c->session) == NULL) + if (ignore_client_size(c)) continue; + s = c->session; + if (current) has = (s->curw->window == w); else @@ -216,8 +218,10 @@ recalculate_sizes(void) } else { sx = sy = UINT_MAX; TAILQ_FOREACH(c, &clients, entry) { - if ((s = c->session) == NULL) + if (ignore_client_size(c)) continue; + s = c->session; + if (current) has = (s->curw->window == w); else diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index bf37ab2ae58..0428bceeec5 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.858 2019/03/12 11:16:50 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.859 2019/03/12 13:56:30 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -1393,8 +1393,7 @@ struct client { CLIENT_REDRAWSTATUSALWAYS| \ CLIENT_REDRAWBORDERS) #define CLIENT_NOSIZEFLAGS \ - (CLIENT_EXIT| \ - CLIENT_DEAD| \ + (CLIENT_DEAD| \ CLIENT_SUSPENDED| \ CLIENT_DETACHING) int flags; diff --git a/usr.bin/tmux/window.c b/usr.bin/tmux/window.c index 4bcab2d7bde..686fdccb6c1 100644 --- a/usr.bin/tmux/window.c +++ b/usr.bin/tmux/window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window.c,v 1.218 2019/03/12 11:16:50 nicm Exp $ */ +/* $OpenBSD: window.c,v 1.219 2019/03/12 13:56:30 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -503,8 +503,8 @@ window_get_active_at(struct window *w, u_int x, u_int y) struct window_pane *wp; TAILQ_FOREACH(wp, &w->panes, entry) { - if (!window_pane_visible(wp)) - continue; + if (!window_pane_visible(wp)) + continue; if (x < wp->xoff || x > wp->xoff + wp->sx) continue; if (y < wp->yoff || y > wp->yoff + wp->sy) |