From 05599ffd029a3e69c41cfd4a6dabd515c2842614 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Thu, 6 Aug 2026 21:01:06 +1000 Subject: [PATCH] [client] cursor: restore Wayland pointer convergence Keep the tracked Wayland hardware position sourced only from absolute wl_pointer events. Relative motion remains unclipped at output edges, so accumulating it made the client believe the hardware cursor had reached the guest position and caused the corrective warp to be skipped. Keep cursor coordinates in shape-origin form after absolute realignment. Preserve the logical hotspot when a shape-only update changes its hotspot, preventing either path from leaving a permanent offset. --- client/displayservers/Wayland/input.c | 2 -- client/src/core.c | 4 ++-- client/src/main.c | 10 ++++++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/client/displayservers/Wayland/input.c b/client/displayservers/Wayland/input.c index 55e50f02..45fc672e 100644 --- a/client/displayservers/Wayland/input.c +++ b/client/displayservers/Wayland/input.c @@ -338,12 +338,10 @@ static void relativePointerMotionHandler(void * data, { const double dx = wl_fixed_to_double(dxW); const double dy = wl_fixed_to_double(dyW); - wlMotionRel(&wlWm.motion, dx, dy); MTRACE("rel time=%u:%u delta=%.3f,%.3f raw=%.3f,%.3f " "pos=%.3f,%.3f", timeHi, timeLo, dx, dy, wl_fixed_to_double(dxUnaccelW), wl_fixed_to_double(dyUnaccelW), wlWm.motion.x, wlWm.motion.y); - app_updateCursorPos(wlWm.motion.x, wlWm.motion.y); app_handleMouseRelative( dx, diff --git a/client/src/core.c b/client/src/core.c index ac4494f2..637d2be8 100644 --- a/client/src/core.c +++ b/client/src/core.c @@ -845,8 +845,8 @@ void core_handleMouseNormal(double ex, double ey) } while(app_isRunning()); - g_cursor.guest.x = control.cursorPos.x; - g_cursor.guest.y = control.cursorPos.y; + g_cursor.guest.x = control.cursorPos.x - g_cursor.guest.hx; + g_cursor.guest.y = control.cursorPos.y - g_cursor.guest.hy; g_cursor.realign = false; g_cursor.realigning = false; g_cursor.redraw = true; diff --git a/client/src/main.c b/client/src/main.c index b79eb2f1..2e30390b 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -1084,6 +1084,9 @@ int main_cursorThread(void * unused) if (pointer.flags & LG_TRANSPORT_POINTER_SHAPE) { + const int oldHX = g_cursor.guest.hx; + const int oldHY = g_cursor.guest.hy; + switch (pointer.type) { case CURSOR_TYPE_COLOR : cursorType = LG_CURSOR_COLOR ; break; @@ -1106,6 +1109,13 @@ int main_cursorThread(void * unused) } g_cursor.guest.hx = pointer.hx; g_cursor.guest.hy = pointer.hy; + + if (hotspotChanged && g_cursor.guest.valid && + !(pointer.flags & LG_TRANSPORT_POINTER_POSITION)) + { + g_cursor.guest.x += oldHX - pointer.hx; + g_cursor.guest.y += oldHY - pointer.hy; + } } if ((pointer.flags & LG_TRANSPORT_POINTER_COLOR_TRANSFORM) &&