From 46d1a866d8df71344f08e9a14a1b003961b43c8c Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Sun, 23 Dec 2018 18:54:15 -0500 Subject: [PATCH] Another attempt to lock the mouse --- src/sdl/i_video.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 4c80c389..b93d570a 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1319,10 +1319,6 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen) return SDL_FALSE; } - SDL_RaiseWindow(window); - SDL_SetRelativeMouseMode(SDL_TRUE); - SDL_SetWindowGrab(window, SDL_TRUE); - // Renderer-specific stuff #ifdef HWRENDER if (rendermode == render_opengl) @@ -1560,6 +1556,15 @@ void I_StartupGraphics(void) if (!disable_mouse) SDL_ShowCursor(SDL_DISABLE); SDLdoUngrabMouse(); + SDL_RaiseWindow(window); + + if (mousegrabok && !M_CheckParm("-nomouse")) + { + SDL_SetRelativeMouseMode(SDL_TRUE); + } + + SDL_SetWindowGrab(window, SDL_TRUE); + graphics_started = true; }