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.
This commit is contained in:
Zack Middleton 2024-06-24 21:17:45 -05:00
parent c1ab47a764
commit 99be1151f7
1 changed files with 2 additions and 1 deletions

View File

@ -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;