Do not change wheel event reporting when not using high resolution scroll events

This commit is contained in:
Kovid Goyal 2018-08-31 15:28:48 +05:30
parent 14f44e79f7
commit 4d2d9d5574
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -541,7 +541,8 @@ scroll_event(double UNUSED xoffset, double yoffset, int flags) {
if (!w) return;
int s;
if (flags & 1) {
bool is_high_resolution = flags & 1;
if (is_high_resolution) {
if (yoffset * global_state.callback_os_window->pending_scroll_pixels < 0) {
global_state.callback_os_window->pending_scroll_pixels = 0; // change of direction
}
@ -567,9 +568,15 @@ scroll_event(double UNUSED xoffset, double yoffset, int flags) {
int sz = encode_mouse_event(w, upwards ? GLFW_MOUSE_BUTTON_4 : GLFW_MOUSE_BUTTON_5, PRESS, 0);
if (sz > 0) {
mouse_event_buf[sz] = 0;
if (is_high_resolution) {
for (s = abs(s); s > 0; s--) {
write_escape_code_to_child(screen, CSI, mouse_event_buf);
}
} else {
// Since we are sending a mouse button 4/5 event, we ignore 's'
// and simply send one event per received scroll event
write_escape_code_to_child(screen, CSI, mouse_event_buf);
}
}
} else {
fake_scroll(abs(s), upwards);