[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.
This commit is contained in:
Geoffrey McRae
2026-08-06 21:01:06 +10:00
parent 5ab10614f2
commit 05599ffd02
3 changed files with 12 additions and 4 deletions

View File

@@ -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,

View File

@@ -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;

View File

@@ -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) &&