wayland: Add mouse pointer warp support

The pointer confinement protocol does allow attempted warping the pointer via a hint, provided that the pointer is locked at the time of the request, and the requested coordinates fall within the bounds of the window.

Toggle the pointer locked state and request the pointer warp when the required protocol is available. This is similar to what XWayland does internally.
This commit is contained in:
Frank Praznik
2024-05-01 12:57:39 -04:00
parent 22016228ca
commit 3a6d9c59f4
6 changed files with 108 additions and 52 deletions

View File

@@ -39,9 +39,10 @@ encounter limitations or behavior that is different from other windowing systems
unknown. In most cases, applications don't actually need the global cursor position and should use the window-relative
coordinates as provided by the mouse movement event or from ```SDL_GetMouseState()``` instead.
### Warping the global mouse cursor position via ```SDL_WarpMouseGlobal()``` doesn't work
### Warping the mouse cursor to or from a point outside the window doesn't work
- For security reasons, Wayland does not allow warping the global mouse cursor position.
- The cursor can be warped only within the window with mouse focus, provided that the `zwp_pointer_confinement_v1`
protocol is supported by the compositor.
### The application icon can't be set via ```SDL_SetWindowIcon()```