diff --git a/src/m_menu.c b/src/m_menu.c
index 592bb55de4f0918c16323b293fa7a0b7568fdefe..9e571eb6f5b7b3c78f7b854d3a08a8fbc6cb9b1a 100644
--- a/src/m_menu.c
+++ b/src/m_menu.c
@@ -13645,7 +13645,7 @@ static void M_HandleVideoMode(INT32 ch)
 			if (vid.width == modedescs[vidm_selected].width && vid.height == modedescs[vidm_selected].height)
 			{
 				S_StartSound(NULL, sfx_strpst);
-				SCR_SetDefaultMode();
+				SCR_SetDefaultMode(vid.width, vid.height);
 			}
 			else
 			{
diff --git a/src/screen.c b/src/screen.c
index 89e03e03dc1a3787ba2bf889fffe17d5bc12a502..59d94e0faad60bf02e03d34eaa409960737b5258 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -456,10 +456,10 @@ void SCR_CheckDefaultMode(void)
 }
 
 // sets the modenum as the new default video mode to be saved in the config file
-void SCR_SetDefaultMode(void)
+void SCR_SetDefaultMode(INT32 width, INT32 height)
 {
-	CV_SetValue(cv_fullscreen.value ? &cv_scr_width : &cv_scr_width_w, vid.width);
-	CV_SetValue(cv_fullscreen.value ? &cv_scr_height : &cv_scr_height_w, vid.height);
+	CV_SetValue(cv_fullscreen.value ? &cv_scr_width : &cv_scr_width_w, width);
+	CV_SetValue(cv_fullscreen.value ? &cv_scr_height : &cv_scr_height_w, height);
 }
 
 // Change fullscreen on/off according to cv_fullscreen
diff --git a/src/screen.h b/src/screen.h
index edcfaadee277cd0f0327b5d28e9c75721beb9bdb..42d62aa990f9344e3aa3e7018d990a289d8031ec 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -202,8 +202,8 @@ void SCR_Recalc(void);
 // Check parms once at startup
 void SCR_CheckDefaultMode(void);
 
-// Set the mode number which is saved in the config
-void SCR_SetDefaultMode(void);
+// Set the resolution which is saved in the config
+void SCR_SetDefaultMode(INT32 width, INT32 height);
 
 void SCR_CalculateFPS(void);
 
diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c
index 846b4c742d3f66217c0668bf013b50835763b727..c29bafa7c19081067003493c8215a28200e7b3d1 100644
--- a/src/sdl/i_video.c
+++ b/src/sdl/i_video.c
@@ -671,7 +671,11 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
 		case SDL_WINDOWEVENT_MAXIMIZED:
 			break;
 		case SDL_WINDOWEVENT_SIZE_CHANGED:
-			SCR_SetWindowSize(evt.data1, evt.data2);
+			if ((SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN_DESKTOP) == 0)
+			{
+				SCR_SetWindowSize(evt.data1, evt.data2);
+				SCR_SetDefaultMode(evt.data1, evt.data2);
+			}
 			break;
 	}