mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-10 00:28:20 +00:00
[client] wm: added new platform agnostic wmWarpMouse
This commit is contained in:
parent
8466e57468
commit
fc0d82d490
@ -846,18 +846,7 @@ static void warpMouse(int x, int y, bool disable)
|
||||
if (g_cursor.pos.x == x && g_cursor.pos.y == y)
|
||||
return;
|
||||
|
||||
if (g_state.wminfo.subsystem == 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);
|
||||
}
|
||||
else
|
||||
SDL_WarpMouseInWindow(g_state.window, x, y);
|
||||
wmWarpMouse(x, y);
|
||||
}
|
||||
|
||||
static bool isValidCursorLocation(int x, int y)
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -23,3 +23,4 @@ void wmGrabKeyboard();
|
||||
void wmUngrabKeyboard();
|
||||
void wmGrabAll();
|
||||
void wmUngrabAll();
|
||||
void wmWarpMouse(int x, int y);
|
||||
|
Loading…
Reference in New Issue
Block a user