Cancel momentum scroll on button and key events

This commit is contained in:
Kovid Goyal
2026-01-09 13:15:37 +05:30
parent 3232551c39
commit 779fb0d5c5
2 changed files with 3 additions and 0 deletions

1
glfw/internal.h vendored
View File

@@ -886,6 +886,7 @@ int _glfwPlatformSetWindowBlur(_GLFWwindow* handle, int value);
MonitorGeometry _glfwPlatformGetMonitorGeometry(_GLFWmonitor* monitor);
bool _glfwPlatformGrabKeyboard(bool grab);
void glfw_handle_scroll_event_for_momentum(_GLFWwindow *w, const GLFWScrollEvent *ev, bool stopped, bool is_finger_based);
#define glfw_cancel_momentum_scroll() glfw_handle_scroll_event_for_momentum(NULL, NULL, false, false)
char* _glfw_strdup(const char* source);

2
glfw/wl_init.c vendored
View File

@@ -135,6 +135,7 @@ static void pointerHandleButton(void* data UNUSED,
uint32_t button,
uint32_t state)
{
glfw_cancel_momentum_scroll();
_glfw.wl.serial = serial; _glfw.wl.input_serial = serial; _glfw.wl.pointer_serial = serial;
_GLFWwindow* window = _glfw.wl.pointerFocus;
@@ -395,6 +396,7 @@ static void keyboardHandleKey(void* data UNUSED,
uint32_t key,
uint32_t state)
{
glfw_cancel_momentum_scroll();
_GLFWwindow* window = _glfwWindowForId(_glfw.wl.keyboardFocusId);
if (!window)
return;