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:
@@ -157,7 +157,8 @@ bool waylandCursorInit(void)
|
||||
wlWm.cursorSquareBuffer = createSquareCursorBuffer();
|
||||
if (wlWm.cursorSquareBuffer)
|
||||
{
|
||||
wlWm.cursors[LG_POINTER_SQUARE] = wl_compositor_create_surface(wlWm.compositor);
|
||||
wlWm.cursors[LG_POINTER_SQUARE] = wl_compositor_create_surface(wlWm.compositor);
|
||||
wlWm.cursorHot[LG_POINTER_SQUARE] = (struct Point) { 2, 2 };
|
||||
wl_surface_attach(wlWm.cursors[LG_POINTER_SQUARE], wlWm.cursorSquareBuffer, 0, 0);
|
||||
wl_surface_commit(wlWm.cursors[LG_POINTER_SQUARE]);
|
||||
}
|
||||
@@ -213,6 +214,10 @@ void waylandCursorScaleChange(void)
|
||||
memcpy(old, wlWm.cursors, sizeof(old));
|
||||
memset(wlWm.cursors, 0, sizeof(wlWm.cursors));
|
||||
|
||||
/* the diagnostic cursor is not part of the cursor theme */
|
||||
wlWm.cursors[LG_POINTER_SQUARE] = old[LG_POINTER_SQUARE];
|
||||
old[LG_POINTER_SQUARE] = NULL;
|
||||
|
||||
if (wlWm.cursorTheme)
|
||||
wl_cursor_theme_destroy(wlWm.cursorTheme);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user