Initial implementation of momentum for finger based scrolling on Wayland

Needs configuration and possibly the parameter adjustment once pixel
scrolling is merged.
This commit is contained in:
Kovid Goyal
2026-01-05 19:52:44 +05:30
parent cd25248e08
commit e1199bcee2
6 changed files with 326 additions and 7 deletions

13
glfw/wl_init.c vendored
View File

@@ -221,15 +221,14 @@ pointer_handle_frame(void *data UNUSED, struct wl_pointer *pointer UNUSED) {
ev.offset_type = GLFW_SCROLL_OFFEST_HIGHRES;
ev.x_offset = info.continuous.x;
}
float scale = (float)_glfwWaylandWindowScale(window);
ev.x_offset *= scale; ev.y_offset *= scale;
ev.x_offset *= -1;
glfw_handle_scroll_event_for_momentum(
window, &ev, MAX(info.y_start_time, info.x_start_time), info.y_stop_received || info.x_stop_received,
info.source_type == WL_POINTER_AXIS_SOURCE_FINGER);
/* clear pointer_curr_axis_info for next frame */
memset(&info, 0, sizeof(info));
if (ev.y_offset != 0.0f || ev.x_offset != 0.0f) {
float scale = (float)_glfwWaylandWindowScale(window);
ev.x_offset *= scale; ev.y_offset *= scale;
ev.x_offset *= -1;
_glfwInputScroll(window, &ev);
}
}
static void