[client] wm: added new platform agnostic wmWarpMouse

This commit is contained in:
Geoffrey McRae
2021-01-10 15:43:49 +11:00
parent 8466e57468
commit fc0d82d490
3 changed files with 22 additions and 12 deletions

View File

@@ -135,3 +135,23 @@ void wmUngrabAll()
wmUngrabPointer();
wmUngrabKeyboard();
}
void wmWarpMouse(int x, int y)
{
switch(g_state.wminfo.subsystem)
{
case SDL_SYSWM_X11:
XWarpPointer(
g_state.wminfo.info.x11.display,
None,
g_state.wminfo.info.x11.window,
0, 0, 0, 0,
x, y);
XSync(g_state.wminfo.info.x11.display, False);
break;
default:
SDL_WarpMouseInWindow(g_state.window, x, y);
break;
}
}