mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-08-09 08:41:31 +00:00
[client] cursor: improve Wayland hotspot alignment
Center the Wayland diagnostic cursor on its actual pointer hotspot and preserve it while cursor themes are reloaded for output-scale changes. Round fractional guest positions to the nearest logical pixel instead of biasing synchronization toward the top-left corner. Resynchronize the hardware pointer when a cursor shape changes its hotspot. Only perform the extra synchronization when the hotspot actually changes, and update the basic-mode projection at the same time.
This commit is contained in:
@@ -1076,6 +1076,7 @@ int main_cursorThread(void * unused)
|
||||
|
||||
const bool wasRendered = g_cursor.guest.visible &&
|
||||
(g_cursor.draw || !g_params.useSpiceInput);
|
||||
bool hotspotChanged = false;
|
||||
|
||||
if (pointer.flags & LG_TRANSPORT_POINTER_VISIBLE_VALID)
|
||||
g_cursor.guest.visible =
|
||||
@@ -1094,8 +1095,8 @@ int main_cursorThread(void * unused)
|
||||
continue;
|
||||
}
|
||||
|
||||
g_cursor.guest.hx = pointer.hx;
|
||||
g_cursor.guest.hy = pointer.hy;
|
||||
hotspotChanged =
|
||||
g_cursor.guest.hx != pointer.hx || g_cursor.guest.hy != pointer.hy;
|
||||
if (!RENDERER(onMouseShape, cursorType, pointer.width, pointer.height,
|
||||
pointer.pitch, pointer.shape))
|
||||
{
|
||||
@@ -1103,6 +1104,8 @@ int main_cursorThread(void * unused)
|
||||
g_state.transportOps->releasePointer(g_state.transport, &pointer);
|
||||
continue;
|
||||
}
|
||||
g_cursor.guest.hx = pointer.hx;
|
||||
g_cursor.guest.hy = pointer.hy;
|
||||
}
|
||||
|
||||
if ((pointer.flags & LG_TRANSPORT_POINTER_COLOR_TRANSFORM) &&
|
||||
@@ -1132,9 +1135,14 @@ int main_cursorThread(void * unused)
|
||||
core_alignToGuest();
|
||||
app_resyncMouseBasic();
|
||||
}
|
||||
core_handleGuestMouseUpdate();
|
||||
}
|
||||
|
||||
if (hotspotChanged)
|
||||
app_resyncMouseBasic();
|
||||
|
||||
if ((pointer.flags & LG_TRANSPORT_POINTER_POSITION) || hotspotChanged)
|
||||
core_handleGuestMouseUpdate();
|
||||
|
||||
app_updateMouseState();
|
||||
g_cursor.redraw = false;
|
||||
RENDERER(onMouseEvent,
|
||||
|
||||
Reference in New Issue
Block a user