macOS: Allow scrolling window contents using mouse wheel/trackbar even when the window is not the active window

Fixes #729
This commit is contained in:
Kovid Goyal 2018-07-18 10:34:36 +05:30
parent 2c3235d452
commit 5ae2406a03
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 10 additions and 0 deletions

View File

@ -16,6 +16,9 @@ Changelog
- Add an option :opt:`env` to set environment variables in child processes
from kitty.conf
- macOS: Allow scrolling window contents using mouse wheel/trackbar even when the
window is not the active window (:iss:`729`)
0.11.3 [2018-07-10]
------------------------------

View File

@ -501,6 +501,13 @@ scroll_event(double UNUSED xoffset, double yoffset) {
bool in_tab_bar;
unsigned int window_idx = 0;
Window *w = window_for_event(&window_idx, &in_tab_bar);
if (!w && !in_tab_bar) {
// allow scroll events even if window is not currently focused (in
// which case on some platforms such as macOS the mouse location is zeroed so
// window_for_event() does not work).
Tab *t = global_state.callback_os_window->tabs + global_state.callback_os_window->active_tab;
if (t) w = t->windows + t->active_window;
}
if (w) {
Screen *screen = w->render_data.screen;
if (screen->linebuf == screen->main_linebuf) {