mirror of https://github.com/encounter/SDL.git
Fixed warping back into the window when gaining focus with warp relative mode enabled
This commit is contained in:
parent
0ffd985972
commit
06aca7edaa
|
@ -866,7 +866,7 @@ SDL_GetGlobalMouseState(int *x, int *y)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
SDL_PerformWarpMouseInWindow(SDL_Window *window, int x, int y, SDL_bool ignore_relative_mode)
|
SDL_PerformWarpMouseInWindow(SDL_Window *window, int x, int y, SDL_bool ignore_relative_mode)
|
||||||
{
|
{
|
||||||
SDL_Mouse *mouse = SDL_GetMouse();
|
SDL_Mouse *mouse = SDL_GetMouse();
|
||||||
|
|
|
@ -152,6 +152,9 @@ extern int SDL_SendMouseButtonClicks(SDL_Window * window, SDL_MouseID mouseID, U
|
||||||
/* Send a mouse wheel event */
|
/* Send a mouse wheel event */
|
||||||
extern int SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, float x, float y, SDL_MouseWheelDirection direction);
|
extern int SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, float x, float y, SDL_MouseWheelDirection direction);
|
||||||
|
|
||||||
|
/* Warp the mouse within the window, potentially overriding relative mode */
|
||||||
|
extern void SDL_PerformWarpMouseInWindow(SDL_Window *window, int x, int y, SDL_bool ignore_relative_mode);
|
||||||
|
|
||||||
/* Shutdown the mouse subsystem */
|
/* Shutdown the mouse subsystem */
|
||||||
extern void SDL_MouseQuit(void);
|
extern void SDL_MouseQuit(void);
|
||||||
|
|
||||||
|
|
|
@ -3038,7 +3038,7 @@ SDL_OnWindowFocusGained(SDL_Window * window)
|
||||||
if (mouse && mouse->relative_mode) {
|
if (mouse && mouse->relative_mode) {
|
||||||
SDL_SetMouseFocus(window);
|
SDL_SetMouseFocus(window);
|
||||||
if (mouse->relative_mode_warp) {
|
if (mouse->relative_mode_warp) {
|
||||||
SDL_WarpMouseInWindow(window, window->w/2, window->h/2);
|
SDL_PerformWarpMouseInWindow(window, window->w/2, window->h/2, SDL_TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue