Skip to content

Commit

Permalink
Fix web client vid_restart with r_mode -2
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
zturtleman authored and mgerhardy committed Jul 27, 2024
1 parent 8eaf5e5 commit ce8e98b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion code/sdl/sdl_glimp.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,10 +415,11 @@ static int GLimp_SetMode(int mode, qboolean fullscreen, qboolean noborder, qbool
display = SDL_GetWindowDisplayIndex(SDL_window);
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) {
glConfig.displayAspect = (float)desktopMode.w / (float)desktopMode.h;

ri.Printf(PRINT_ALL, "Display aspect: %.3f\n", glConfig.displayAspect);
Expand Down

0 comments on commit ce8e98b

Please sign in to comment.