aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/graphics/openglsdl/openglsdl-graphics.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp
index f3aba1fcf4..b10c94b03f 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -241,6 +241,15 @@ void OpenGLSdlGraphicsManager::updateScreen() {
bool OpenGLSdlGraphicsManager::setupFullscreenMode() {
SDL_Rect const* const*availableModes = SDL_ListModes(NULL, SDL_FULLSCREEN | SDL_OPENGL);
+ // SDL_ListModes() returns -1 in case any dimension is okay. In that
+ // case we'll reuse the current desktop resolution for fullscreen.
+ if (availableModes == (void *)-1) {
+ _videoMode.hardwareWidth = _desktopWidth;
+ _videoMode.hardwareHeight = _desktopHeight;
+ _videoMode.activeFullscreenMode = -2;
+ return true;
+ }
+
// If -2, autodetect the fullscreen mode
// The last used fullscreen mode will be prioritized, if there is no last fullscreen
// mode, the desktop resolution will be used, and in case the desktop resolution