From 99be1151f7ae21460aae85a4d017a726033e2ccf Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Mon, 24 Jun 2024 21:17:45 -0500 Subject: [PATCH] Fix web client vid_restart with r_mode -2 If getting the display index of the existing window fails, fallback to the default display size instead of falling back to 640x480. emscripten r_mode -2 worked on window creation but vid_restart fellback to 640x480. --- code/sdl/sdl_glimp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/sdl/sdl_glimp.c b/code/sdl/sdl_glimp.c index 2678dc71..5ce1e47d 100644 --- a/code/sdl/sdl_glimp.c +++ b/code/sdl/sdl_glimp.c @@ -438,10 +438,11 @@ static int GLimp_SetMode(int mode, qboolean fullscreen, qboolean noborder, qbool if( display < 0 ) { ri.Printf( PRINT_DEVELOPER, "SDL_GetWindowDisplayIndex() failed: %s\n", SDL_GetError() ); + display = 0; } } - if( display >= 0 && SDL_GetDesktopDisplayMode( display, &desktopMode ) == 0 ) + if( SDL_GetDesktopDisplayMode( display, &desktopMode ) == 0 ) { displayAspect = (float)desktopMode.w / (float)desktopMode.h;