From a4d4cf581932f2403488b393da957ace6856576a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 17 Dec 2021 17:35:13 +0530 Subject: [PATCH] Fix #4367 --- kitty/mouse.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/kitty/mouse.c b/kitty/mouse.c index 65afe7ad6..b80f47e58 100644 --- a/kitty/mouse.c +++ b/kitty/mouse.c @@ -555,8 +555,16 @@ static Window* window_for_event(unsigned int *window_idx, bool *in_tab_bar) { Region central, tab_bar; os_window_regions(global_state.callback_os_window, ¢ral, &tab_bar); - *in_tab_bar = !mouse_in_region(¢ral); - if (!*in_tab_bar && global_state.callback_os_window->num_tabs > 0) { + const bool in_central = mouse_in_region(¢ral); + *in_tab_bar = false; + const OSWindow* w = global_state.callback_os_window; + if (!in_central) { + if ( + (tab_bar.top < central.top && w->mouse_y <= central.top) || + (tab_bar.bottom > central.bottom && w->mouse_y >= central.bottom) + ) *in_tab_bar = true; + } + if (in_central && global_state.callback_os_window->num_tabs > 0) { 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) {