]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Simplify VID_SetMouse() calling logic
authorbones_was_here <bones_was_here@xonotic.au>
Mon, 30 Jan 2023 20:01:16 +0000 (06:01 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Mon, 30 Jan 2023 20:01:16 +0000 (06:01 +1000)
Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
cl_screen.c
vid.h
vid_null.c
vid_sdl.c

index b9b2f64df237b7543ca5696fafecabedf3c2b2be..e4ba43d90301a49d84a77c15c2b7776409deadd1 100644 (file)
@@ -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 8b8fa3f5da0e277ac010f4d053076d56ab08e232..3cf85379894b389f21f6e581c65b4a653b4d7935 100644 (file)
--- 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);
index 5ebb7757cbb7c7602bdda239002434e9ae7f638d..39459ee7ccd49f2403d6ea7b38ba9d44fd87b178 100644 (file)
@@ -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)
 {
 }
 
index 5845e07356c1a3342641b5ccef32be31d4cb86d2..0a6bb75e4ff0fa10161cc28f60bf7532936c996d 100644 (file)
--- 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;