From: bones_was_here Date: Mon, 30 Jan 2023 20:01:16 +0000 (+1000) Subject: Simplify VID_SetMouse() calling logic X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=2a97ec851bd607510e33148335fc61d51e7138cf;p=xonotic%2Fdarkplaces.git Simplify VID_SetMouse() calling logic Signed-off-by: bones_was_here --- diff --git a/cl_screen.c b/cl_screen.c index b9b2f64d..e4ba43d9 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -2326,16 +2326,12 @@ void CL_UpdateScreen(void) qglFlush(); // ensure that the commands are submitted to the GPU before we do other things - if (!vid_activewindow) - VID_SetMouse(false, false, false); - else if (key_consoleactive) - VID_SetMouse(vid.fullscreen, false, false); - else if (key_dest == key_menu_grabbed) - VID_SetMouse(true, vid_mouse.integer && !in_client_mouse && !vid_touchscreen.integer, !vid_touchscreen.integer); - else if (key_dest == key_menu || scr_loading) - VID_SetMouse(vid.fullscreen, vid_mouse.integer && !in_client_mouse && !vid_touchscreen.integer, !vid_touchscreen.integer); + if (!vid_activewindow || key_consoleactive) + VID_SetMouse(false, false); + else if (key_dest == key_menu || key_dest == key_menu_grabbed || scr_loading) + VID_SetMouse(vid_mouse.integer && !in_client_mouse && !vid_touchscreen.integer, !vid_touchscreen.integer); else - VID_SetMouse(vid.fullscreen, vid_mouse.integer && !cl.csqc_wantsmousemove && cl_prydoncursor.integer <= 0 && (!cls.demoplayback || cl_demo_mousegrab.integer) && !vid_touchscreen.integer, !vid_touchscreen.integer); + VID_SetMouse(vid_mouse.integer && !cl.csqc_wantsmousemove && cl_prydoncursor.integer <= 0 && (!cls.demoplayback || cl_demo_mousegrab.integer) && !vid_touchscreen.integer, !vid_touchscreen.integer); VID_Finish(); } diff --git a/vid.h b/vid.h index 8b8fa3f5..3cf85379 100644 --- a/vid.h +++ b/vid.h @@ -223,7 +223,7 @@ qbool VID_HasScreenKeyboardSupport(void); void VID_ShowKeyboard(qbool show); qbool VID_ShowingKeyboard(void); -void VID_SetMouse (qbool fullscreengrab, qbool relative, qbool hidecursor); +void VID_SetMouse(qbool relative, qbool hidecursor); void VID_Finish (void); void VID_Restart_f(struct cmd_state_s *cmd); diff --git a/vid_null.c b/vid_null.c index 5ebb7757..39459ee7 100644 --- a/vid_null.c +++ b/vid_null.c @@ -51,7 +51,7 @@ static void InitSig(void) } #endif -void VID_SetMouse (qbool fullscreengrab, qbool relative, qbool hidecursor) +void VID_SetMouse(qbool relative, qbool hidecursor) { } diff --git a/vid_sdl.c b/vid_sdl.c index 5845e073..0a6bb75e 100644 --- a/vid_sdl.c +++ b/vid_sdl.c @@ -371,7 +371,7 @@ qbool VID_ShowingKeyboard(void) return SDL_IsTextInputActive() != 0; } -void VID_SetMouse(qbool fullscreengrab, qbool relative, qbool hidecursor) +void VID_SetMouse(qbool relative, qbool hidecursor) { #ifndef DP_MOBILETOUCH #ifdef MACOSX @@ -384,7 +384,7 @@ void VID_SetMouse(qbool fullscreengrab, qbool relative, qbool hidecursor) vid_usingmouse = relative; cl_ignoremousemoves = 2; vid_usingmouse_relativeworks = SDL_SetRelativeMouseMode(relative ? SDL_TRUE : SDL_FALSE) == 0; -// Con_Printf("VID_SetMouse(%i, %i, %i) relativeworks = %i\n", (int)fullscreengrab, (int)relative, (int)hidecursor, (int)vid_usingmouse_relativeworks); +// Con_Printf("VID_SetMouse(%i, %i) relativeworks = %i\n", (int)relative, (int)hidecursor, (int)vid_usingmouse_relativeworks); #ifdef MACOSX if(relative) { @@ -1655,7 +1655,7 @@ qbool VID_InitMode(viddef_mode_t *mode) void VID_Shutdown (void) { VID_EnableJoystick(false); - VID_SetMouse(false, false, false); + VID_SetMouse(false, false); SDL_DestroyWindow(window); window = NULL;