From 63493fad2280b186fb609628aaeac2bf5610d37f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 28 Apr 2020 22:23:38 +0530 Subject: [PATCH] Fix a regression that caused clicking in the padding/margins of windows in the stack layout to switch the window to the first window Fixes #2604 --- docs/changelog.rst | 3 +++ kitty/mouse.c | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 0f51123467d..7236d2a13d9 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -14,6 +14,9 @@ To update |kitty|, :doc:`follow the instructions `. - By default, double clicking no longer considers the : as part of words, see :opt:`select_by_word_characters` (:iss:`2602`) +- Fix a regression that caused clicking in the padding/margins of windows in + the stack layout to switch the window to the first window (:iss:`2604`) + 0.17.3 [2020-04-23] -------------------- diff --git a/kitty/mouse.c b/kitty/mouse.c index 8644c7d201a..a81dd7c5543 100644 --- a/kitty/mouse.c +++ b/kitty/mouse.c @@ -514,7 +514,8 @@ window_for_event(unsigned int *window_idx, bool *in_tab_bar) { Tab *t = global_state.callback_os_window->tabs + global_state.callback_os_window->active_tab; for (unsigned int i = 0; i < t->num_windows; i++) { if (contains_mouse(t->windows + i) && t->windows[i].render_data.screen) { - *window_idx = i; return t->windows + i; + *window_idx = i; + return t->windows + i; } } } @@ -529,8 +530,10 @@ closest_window_for_event(unsigned int *window_idx) { Tab *t = global_state.callback_os_window->tabs + global_state.callback_os_window->active_tab; for (unsigned int i = 0; i < t->num_windows; i++) { Window *w = t->windows + i; - double d = distance_to_window(w); - if (d < closest_distance) { ans = w; closest_distance = d; *window_idx = i; } + if (w->visible) { + double d = distance_to_window(w); + if (d < closest_distance) { ans = w; closest_distance = d; *window_idx = i; } + } } } return ans;