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
This commit is contained in:
Kovid Goyal
2020-04-28 22:23:38 +05:30
parent 696b857f91
commit 63493fad22
2 changed files with 9 additions and 3 deletions

View File

@@ -14,6 +14,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
- 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]
--------------------

View File

@@ -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;