Send wheel events to program when it asks to grab mouse, even in main screen

This matches behavior of other terminals and I dont have a strong
preference either way. Fixes #2939
This commit is contained in:
Kovid Goyal 2020-08-27 21:48:41 +05:30
parent 601d37aa3d
commit 0bff30e954
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 13 additions and 12 deletions

View File

@ -24,6 +24,10 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
- Allow specifying watchers in session files and via a command line argument - Allow specifying watchers in session files and via a command line argument
(:iss:`2933`) (:iss:`2933`)
- When in the main screen and a program grabs the mouse, do not use the scroll
wheel events to scroll the scrollback buffer, instead send them to the
program (:iss:`2939`)
0.18.3 [2020-08-11] 0.18.3 [2020-08-11]
------------------- -------------------

View File

@ -702,20 +702,17 @@ scroll_event(double UNUSED xoffset, double yoffset, int flags, int modifiers) {
} }
if (s == 0) return; if (s == 0) return;
bool upwards = s > 0; bool upwards = s > 0;
if (screen->linebuf == screen->main_linebuf) { if (screen->modes.mouse_tracking_mode) {
screen_history_scroll(screen, abs(s), upwards); int sz = encode_mouse_scroll(w, upwards, modifiers);
} else { if (sz > 0) {
if (screen->modes.mouse_tracking_mode) { mouse_event_buf[sz] = 0;
int sz = encode_mouse_scroll(w, upwards, modifiers); for (s = abs(s); s > 0; s--) {
if (sz > 0) { write_escape_code_to_child(screen, CSI, mouse_event_buf);
mouse_event_buf[sz] = 0;
for (s = abs(s); s > 0; s--) {
write_escape_code_to_child(screen, CSI, mouse_event_buf);
}
} }
} else {
fake_scroll(w, abs(s), upwards);
} }
} else {
if (screen->linebuf == screen->main_linebuf) screen_history_scroll(screen, abs(s), upwards);
else fake_scroll(w, abs(s), upwards);
} }
} }