[client] spice: use XGrabPointer when in grab mode

People using high DPI mice and mouse accleration require this otherwise
the mouse can escape the window before we can warp it back.
This commit is contained in:
Geoffrey McRae 2021-01-04 13:18:02 +11:00
parent 2bc767430c
commit bfc492421c

View File

@ -1211,8 +1211,29 @@ int eventFilter(void * userdata, SDL_Event * event)
if (params.useSpiceInput)
{
g_cursor.grab = !g_cursor.grab;
if (g_state.wminfo.subsystem != SDL_SYSWM_X11)
SDL_SetWindowGrab(g_state.window, g_cursor.grab);
else
{
if (g_cursor.grab)
{
XGrabPointer(g_state.wminfo.info.x11.display,
g_state.wminfo.info.x11.window,
true,
None,
GrabModeAsync,
GrabModeAsync,
g_state.wminfo.info.x11.window,
None,
CurrentTime);
}
else
{
XUngrabPointer(g_state.wminfo.info.x11.display,
CurrentTime);
}
}
app_alert(
g_cursor.grab ? LG_ALERT_SUCCESS : LG_ALERT_WARNING,