From ee380451caf23b0a8929c629916cb298f5e9822d Mon Sep 17 00:00:00 2001 From: Quantum Date: Mon, 3 May 2021 18:43:03 -0400 Subject: [PATCH] [client] wayland: synchronize host cursor position with guest This mirrors the x11 implementation, allowing the pointer to move correctly into overlapping windows. --- client/displayservers/Wayland/cursor.c | 4 ---- client/displayservers/Wayland/input.c | 8 ++++++++ client/displayservers/Wayland/wayland.h | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/client/displayservers/Wayland/cursor.c b/client/displayservers/Wayland/cursor.c index ca4e8925..c97b42ae 100644 --- a/client/displayservers/Wayland/cursor.c +++ b/client/displayservers/Wayland/cursor.c @@ -106,7 +106,3 @@ void waylandShowPointer(bool show) wlWm.showPointer = show; wl_pointer_set_cursor(wlWm.pointer, wlWm.pointerEnterSerial, show ? wlWm.cursor : NULL, 0, 0); } - -void waylandGuestPointerUpdated(double x, double y, int localX, int localY) -{ -} diff --git a/client/displayservers/Wayland/input.c b/client/displayservers/Wayland/input.c index 97053d38..bb3993c4 100644 --- a/client/displayservers/Wayland/input.c +++ b/client/displayservers/Wayland/input.c @@ -413,3 +413,11 @@ void waylandRealignPointer(void) if (!wlWm.warpSupport) app_resyncMouseBasic(); } + +void waylandGuestPointerUpdated(double x, double y, int localX, int localY) +{ + if (!wlWm.warpSupport || !wlWm.pointerInSurface) + return; + + waylandWarpPointer(localX, localY, false); +} diff --git a/client/displayservers/Wayland/wayland.h b/client/displayservers/Wayland/wayland.h index b8ee071a..fdd9899f 100644 --- a/client/displayservers/Wayland/wayland.h +++ b/client/displayservers/Wayland/wayland.h @@ -190,7 +190,6 @@ void waylandCBRelease(void); // cursor module bool waylandCursorInit(void); void waylandCursorFree(void); -void waylandGuestPointerUpdated(double x, double y, int localX, int localY); void waylandShowPointer(bool show); // gl module @@ -228,6 +227,7 @@ void waylandUngrabKeyboard(void); void waylandUngrabPointer(void); void waylandRealignPointer(void); void waylandWarpPointer(int x, int y, bool exiting); +void waylandGuestPointerUpdated(double x, double y, int localX, int localY); // output module bool waylandOutputInit(void);