]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
vid: don't overwrite vid_width and vid_height when using vid_desktopfullscreen
authorbones_was_here <bones_was_here@xonotic.au>
Wed, 10 Apr 2024 15:35:45 +0000 (01:35 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Thu, 11 Apr 2024 12:12:59 +0000 (22:12 +1000)
This allows the player's windowed mode preferences to be saved by
default.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
vid_shared.c

index b119a3ac32c74d2e1da595fd40b20a651b7b41dc..ef0649288be99b65f43a56a596b1c988c9ad536b 100644 (file)
@@ -1443,9 +1443,13 @@ static int VID_Mode(int fullscreen, int width, int height, int bpp, float refres
 
                Con_Printf("Video Mode: %s %dx%dx%dx%.2fhz%s on display %i\n", mode.fullscreen ? "fullscreen" : "window", mode.width, mode.height, mode.bitsperpixel, mode.refreshrate, mode.stereobuffer ? " stereo" : "", vid.displayindex);
 
-               Cvar_SetValueQuick(&vid_fullscreen, vid.mode.fullscreen);
-               Cvar_SetValueQuick(&vid_width, vid.mode.width);
-               Cvar_SetValueQuick(&vid_height, vid.mode.height);
+               // desktopfullscreen doesn't need fallback mode saved so let cvars store windowed mode dimensions
+               if (!vid_desktopfullscreen.integer) // maybe checking SDL_WINDOW_FULLSCREEN_DESKTOP is better?
+               {
+                       Cvar_SetValueQuick(&vid_fullscreen, vid.mode.fullscreen);
+                       Cvar_SetValueQuick(&vid_width, vid.mode.width);
+                       Cvar_SetValueQuick(&vid_height, vid.mode.height);
+               }
                Cvar_SetValueQuick(&vid_bitsperpixel, vid.mode.bitsperpixel);
                Cvar_SetValueQuick(&vid_samples, vid.mode.samples);
                if(vid_userefreshrate.integer)