Skip to content

Commit

Permalink
Fix a regression that caused clicking in the padding/margins of windo…
Browse files Browse the repository at this point in the history
…ws in the stack layout to switch the window to the first window

Fixes #2604
  • Loading branch information
kovidgoyal committed Apr 28, 2020
1 parent 696b857 commit 63493fa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions docs/changelog.rst
Expand Up @@ -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]
--------------------
Expand Down
9 changes: 6 additions & 3 deletions kitty/mouse.c
Expand Up @@ -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;
}
}
}
Expand All @@ -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;
Expand Down

0 comments on commit 63493fa

Please sign in to comment.