From 6ffb7e700763040f04cfdeffccf59b808491ce06 Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Thu, 11 Apr 2024 01:35:45 +1000 Subject: [PATCH] vid: don't overwrite vid_width and vid_height when using vid_desktopfullscreen This allows the player's windowed mode preferences to be saved by default. Signed-off-by: bones_was_here --- vid_shared.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/vid_shared.c b/vid_shared.c index b119a3ac..ef064928 100644 --- a/vid_shared.c +++ b/vid_shared.c @@ -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) -- 2.39.2