From a618271e1287c90653cdda4442868c2d4e94de49 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Mon, 10 Sep 2018 07:19:17 +0100 Subject: [PATCH] Bring back window_pane_visible to stop input going to panes which are hidden by zoom. --- input-keys.c | 2 ++ tmux.h | 1 + window.c | 19 ++++++++++++++----- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/input-keys.c b/input-keys.c index d3ff0dc0..f0a38c09 100644 --- a/input-keys.c +++ b/input-keys.c @@ -249,6 +249,8 @@ input_key_mouse(struct window_pane *wp, struct mouse_event *m) return; if (cmd_mouse_at(wp, m, &x, &y, 0) != 0) return; + if (!window_pane_visible(wp)) + return; /* If this pane is not in button or all mode, discard motion events. */ if (MOUSE_DRAG(m->b) && diff --git a/tmux.h b/tmux.h index 9308f6e5..6c5d4402 100644 --- a/tmux.h +++ b/tmux.h @@ -2177,6 +2177,7 @@ int window_pane_set_mode(struct window_pane *, void window_pane_reset_mode(struct window_pane *); void window_pane_key(struct window_pane *, struct client *, struct session *, key_code, struct mouse_event *); +int window_pane_visible(struct window_pane *); u_int window_pane_search(struct window_pane *, const char *); const char *window_printable_flags(struct winlink *); struct window_pane *window_pane_find_up(struct window_pane *); diff --git a/window.c b/window.c index cf29ae48..aabfbdf1 100644 --- a/window.c +++ b/window.c @@ -1286,15 +1286,24 @@ window_pane_key(struct window_pane *wp, struct client *c, struct session *s, return; if (options_get_number(wp->window->options, "synchronize-panes")) { TAILQ_FOREACH(wp2, &wp->window->panes, entry) { - if (wp2 == wp || wp2->mode != NULL) - continue; - if (wp2->fd == -1 || wp2->flags & PANE_INPUTOFF) - continue; - input_key(wp2, key, NULL); + if (wp2 != wp && + wp2->mode == NULL && + wp2->fd != -1 && + (~wp2->flags & PANE_INPUTOFF) && + window_pane_visible(wp2)) + input_key(wp2, key, NULL); } } } +int +window_pane_visible(struct window_pane *wp) +{ + if (~wp->window->flags & WINDOW_ZOOMED) + return (1); + return (wp == wp->window->active); +} + u_int window_pane_search(struct window_pane *wp, const char *searchstr) {