Do not change wheel event reporting when not using high resolution scroll events
This commit is contained in:
parent
14f44e79f7
commit
4d2d9d5574
@ -541,7 +541,8 @@ scroll_event(double UNUSED xoffset, double yoffset, int flags) {
|
|||||||
if (!w) return;
|
if (!w) return;
|
||||||
|
|
||||||
int s;
|
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) {
|
if (yoffset * global_state.callback_os_window->pending_scroll_pixels < 0) {
|
||||||
global_state.callback_os_window->pending_scroll_pixels = 0; // change of direction
|
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);
|
int sz = encode_mouse_event(w, upwards ? GLFW_MOUSE_BUTTON_4 : GLFW_MOUSE_BUTTON_5, PRESS, 0);
|
||||||
if (sz > 0) {
|
if (sz > 0) {
|
||||||
mouse_event_buf[sz] = 0;
|
mouse_event_buf[sz] = 0;
|
||||||
|
if (is_high_resolution) {
|
||||||
for (s = abs(s); s > 0; s--) {
|
for (s = abs(s); s > 0; s--) {
|
||||||
write_escape_code_to_child(screen, CSI, mouse_event_buf);
|
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 {
|
} else {
|
||||||
fake_scroll(abs(s), upwards);
|
fake_scroll(abs(s), upwards);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user