Release pointer buttons without replaying stale motion (#803)

* Fix cursor warping on native touch down

* Preserve input cleanup without replaying stale pointer motion

---------

Co-authored-by: siyuan.qsy <siyuan.qsy@alibaba-inc.com>
This commit is contained in:
asdf17128andsiyuan.qsy authored and GitHub committed 2026-10-14 23:37:35 -04:00
1 parent 700bf18ab2
commit 9cc802dc9c
3 files changed
+163 -1

No files matched your search

+18 -1
View File
@@ -2609,7 +2609,24 @@ static void pointer_delta(double dx, double dy) {
}
static void pointer_button(uint32_t button, int pressed) {
pointer_input(0, 0, 1, button, pressed);
if (pressed) {
pointer_input(0, 0, 1, button, pressed);
return;
}
// Releases also clean up interrupted gestures. Deliver them to the existing
// pointer focus without motion or hit-testing: native touch has independent
// coordinates, so replaying g_ptr_x/y here can warp the game cursor.
uint32_t t = now_ms();
for (int i = 0; i < g_nptrs; i++) {
struct seat_pointer *sp = &g_ptrs[i];
if (!sp->focus) continue;
wl_pointer_send_button(sp->ptr, wl_display_next_serial(g_display), t, button,
WL_POINTER_BUTTON_STATE_RELEASED);
if (wl_resource_get_version(sp->ptr) >= WL_POINTER_FRAME_SINCE_VERSION)
wl_pointer_send_frame(sp->ptr);
}
g_grab = NULL;
wl_display_flush_clients(g_display);
}
static void deliver_pointer(const struct input_msg *m) {