diff --git a/src/d_netcmd.c b/src/d_netcmd.c
index fe7e7678fe447cfc186b9eaf4134cb6eeeb6db27..4ad6c8c51f5c62b8870f1db4fb42576f88c03539 100644
--- a/src/d_netcmd.c
+++ b/src/d_netcmd.c
@@ -872,6 +872,10 @@ void D_RegisterClientCommands(void)
 	CV_RegisterVar(&cv_scr_width);
 	CV_RegisterVar(&cv_scr_height);
 
+	CV_RegisterVar(&cv_usewindowedres);
+	CV_RegisterVar(&cv_scr_width_w);
+	CV_RegisterVar(&cv_scr_height_w);
+
 	CV_RegisterVar(&cv_soundtest);
 
 	CV_RegisterVar(&cv_perfstats);
diff --git a/src/screen.c b/src/screen.c
index 770f1c8026aaf4fcb5dd9df97da55271f717b547..19e6bf1bd8292d4b2af9b015af1642f11afb2bfc 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -69,6 +69,10 @@ consvar_t cv_scr_height = CVAR_INIT ("scr_height", "800", CV_SAVE, CV_Unsigned,
 consvar_t cv_scr_depth = CVAR_INIT ("scr_depth", "16 bits", CV_SAVE, scr_depth_cons_t, NULL);
 consvar_t cv_renderview = CVAR_INIT ("renderview", "On", 0, CV_OnOff, NULL);
 
+consvar_t cv_usewindowedres = CVAR_INIT ("usewindowedres", "No", CV_SAVE, CV_YesNo, NULL);
+consvar_t cv_scr_width_w = CVAR_INIT ("scr_width_w", "640", CV_SAVE, CV_Unsigned, NULL);
+consvar_t cv_scr_height_w = CVAR_INIT ("scr_height_w", "400", CV_SAVE, CV_Unsigned, NULL);
+
 CV_PossibleValue_t cv_renderer_t[] = {
 	{1, "Software"},
 #ifdef HWRENDER
@@ -405,7 +409,10 @@ void SCR_ChangeFullscreen(void)
 	if (graphics_started)
 	{
 		VID_PrepareModeList();
-		setmodeneeded = VID_GetModeForSize(vid.width, vid.height) + 1;
+		if (cv_usewindowedres.value == 1 && cv_fullscreen.value == 0)
+			setmodeneeded = VID_GetModeForSize(cv_scr_width_w.value, cv_scr_height_w.value) + 1;
+		else
+			setmodeneeded = VID_GetModeForSize(cv_scr_width.value, cv_scr_height.value) + 1;
 	}
 	return;
 #endif
diff --git a/src/screen.h b/src/screen.h
index 67880e2b964dc16a7693d754a6646bd031f14c04..3077973d24864449c4f4abc21f0979477a31d588 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -190,6 +190,7 @@ extern INT32 scr_bpp;
 extern UINT8 *scr_borderpatch; // patch used to fill the view borders
 
 extern consvar_t cv_scr_width, cv_scr_height, cv_scr_depth, cv_renderview, cv_renderer, cv_fullscreen;
+extern consvar_t cv_scr_width_w, cv_scr_height_w, cv_usewindowedres;
 // wait for page flipping to end or not
 extern consvar_t cv_vidwait;