mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-25 09:17:12 +01:00
x11: make sure SDL_GetGlobalMouseState notices mouse warping through SDL APIs.
This commit is contained in:
parent
0782f9be51
commit
c9e73c3e00
@ -308,23 +308,27 @@ X11_ShowCursor(SDL_Cursor * cursor)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
WarpMouseInternal(Window xwindow, const int x, const int y)
|
||||||
|
{
|
||||||
|
SDL_VideoData *videodata = (SDL_VideoData *) SDL_GetVideoDevice()->driverdata;
|
||||||
|
Display *display = videodata->display;
|
||||||
|
X11_XWarpPointer(display, None, xwindow, 0, 0, 0, 0, x, y);
|
||||||
|
X11_XSync(display, False);
|
||||||
|
videodata->global_mouse_changed = SDL_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
X11_WarpMouse(SDL_Window * window, int x, int y)
|
X11_WarpMouse(SDL_Window * window, int x, int y)
|
||||||
{
|
{
|
||||||
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
|
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
|
||||||
Display *display = data->videodata->display;
|
WarpMouseInternal(data->xwindow, x, y);
|
||||||
|
|
||||||
X11_XWarpPointer(display, None, data->xwindow, 0, 0, 0, 0, x, y);
|
|
||||||
X11_XSync(display, False);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
X11_WarpMouseGlobal(int x, int y)
|
X11_WarpMouseGlobal(int x, int y)
|
||||||
{
|
{
|
||||||
Display *display = GetDisplay();
|
WarpMouseInternal(DefaultRootWindow(GetDisplay()), x, y);
|
||||||
|
|
||||||
X11_XWarpPointer(display, None, DefaultRootWindow(display), 0, 0, 0, 0, x, y);
|
|
||||||
X11_XSync(display, False);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user