Fix scrollbar hit region to account for window margin (issue #9756)

Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/eb5869d6-9938-4ff3-87fb-34fe14694d6c

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-03-27 05:25:06 +00:00
committed by GitHub
parent e8461b2a9f
commit 24414f6189
2 changed files with 14 additions and 0 deletions

View File

@@ -188,6 +188,8 @@ Detailed list of changes
- Fix a spurious mouse button release event being sent when dragging out of an OS window causes focus loss
- Fix scrollbar hover/interaction not working when the scrollbar is drawn in the window margin area (:iss:`9756`)
0.46.2 [2026-03-21]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -1012,6 +1012,18 @@ mouse_region(bool detect_borders, bool detect_title_bar) {
}
}
}
// If no window was found via contains_mouse, check if the mouse is in any
// window's scrollbar hit area. The scrollbar may be drawn in the margin
// which is outside the area covered by contains_mouse.
if (!ans.window && OPT(scrollbar_interactive)) {
for (unsigned int i = 0; i < t->num_windows; i++) {
Window *win = t->windows + i;
if (!win->visible || !win->render_data.screen) continue;
if (get_scrollbar_hit_type(win, w->mouse_x, w->mouse_y) != SCROLLBAR_HIT_NONE) {
ans.window_idx = i; ans.window = win; break;
}
}
}
}
return ans;
}