mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-18 20:18:59 +00:00
x11: Ungrab before attempting a confinement grab with XInput2 enabled
If XInput2 is enabled, it will grab the pointer on button presses, which results in XGrabPointer returning AlreadyGrabbed. Clear any existing grabs before attempting the confinement grab to avoid a timeout scenario.
This commit is contained in:
parent
4919359a6f
commit
4eb08a6154
1 changed files with 8 additions and 0 deletions
|
|
@ -1855,6 +1855,14 @@ int X11_SetWindowMouseGrab(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* If XInput2 is enabled, it will grab the pointer on button presses,
|
||||
* which results in XGrabPointer returning AlreadyGrabbed. Clear any
|
||||
* existing grabs before attempting the confinement grab.
|
||||
*/
|
||||
if (data->xinput2_mouse_enabled) {
|
||||
X11_XUngrabPointer(display, CurrentTime);
|
||||
}
|
||||
|
||||
/* Try to grab the mouse */
|
||||
if (!data->videodata->broken_pointer_grab) {
|
||||
const unsigned int mask = ButtonPressMask | ButtonReleaseMask | PointerMotionMask | FocusChangeMask;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue