mirror of https://github.com/encounter/SDL.git
video: Make the mode switching function a NOP if mode switching is disabled
Instead of wrapping individual calls to SDL_SetDisplayModeForDisplay(), just check the flag in the function itself and make it a NOP that cannot fail if the flag is set. Silences some errant "SDL video driver doesn't support changing display mode" log errors.
This commit is contained in:
parent
768b6728bd
commit
69e4c770f3
|
@ -1030,6 +1030,11 @@ SDL_SetDisplayModeForDisplay(SDL_VideoDisplay * display, const SDL_DisplayMode *
|
||||||
SDL_DisplayMode current_mode;
|
SDL_DisplayMode current_mode;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
|
/* Mode switching disabled via driver quirk flag, nothing to do and cannot fail. */
|
||||||
|
if (DisableDisplayModeSwitching(_this)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (mode) {
|
if (mode) {
|
||||||
display_mode = *mode;
|
display_mode = *mode;
|
||||||
|
|
||||||
|
@ -1430,17 +1435,14 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen)
|
||||||
resized = SDL_FALSE;
|
resized = SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Don't try to change the display mode if the driver doesn't want it. */
|
/* only do the mode change if we want exclusive fullscreen */
|
||||||
if (DisableDisplayModeSwitching(_this) == SDL_FALSE) {
|
if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP) {
|
||||||
/* only do the mode change if we want exclusive fullscreen */
|
if (SDL_SetDisplayModeForDisplay(display, &fullscreen_mode) < 0) {
|
||||||
if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP) {
|
return -1;
|
||||||
if (SDL_SetDisplayModeForDisplay(display, &fullscreen_mode) < 0) {
|
}
|
||||||
return -1;
|
} else {
|
||||||
}
|
if (SDL_SetDisplayModeForDisplay(display, NULL) < 0) {
|
||||||
} else {
|
return -1;
|
||||||
if (SDL_SetDisplayModeForDisplay(display, NULL) < 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue