From 205175c4e5c822eb96531e8cff00a08bcf8b0deb Mon Sep 17 00:00:00 2001 From: Cameron Cawley Date: Wed, 11 Mar 2020 19:01:49 +0000 Subject: [PATCH] SDL: Don't allow switching to and from fullscreen if it isn't supported --- backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp | 2 -- backends/graphics/gph/gph-graphics.cpp | 3 --- backends/graphics/openpandora/op-graphics.cpp | 1 - backends/graphics/sdl/sdl-graphics.cpp | 4 ++-- backends/graphics/surfacesdl/surfacesdl-graphics.cpp | 8 +++----- backends/platform/dingux/dingux.cpp | 2 ++ backends/platform/symbian/src/SymbianOS.cpp | 1 + 7 files changed, 8 insertions(+), 13 deletions(-) diff --git a/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp b/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp index 147476e19e8..e96be076048 100644 --- a/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp +++ b/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp @@ -453,8 +453,6 @@ void DINGUXSdlGraphicsManager::setupHardwareSize() { _videoMode.hardwareWidth = _videoMode.screenWidth / 2; _videoMode.hardwareHeight = _videoMode.screenHeight / 2; - - _videoMode.fullscreen = true; } else { SurfaceSdlGraphicsManager::setupHardwareSize(); } diff --git a/backends/graphics/gph/gph-graphics.cpp b/backends/graphics/gph/gph-graphics.cpp index e411f930b2b..7935893e7c9 100644 --- a/backends/graphics/gph/gph-graphics.cpp +++ b/backends/graphics/gph/gph-graphics.cpp @@ -422,9 +422,6 @@ void GPHGraphicsManager::hideOverlay() { } void GPHGraphicsManager::setupHardwareSize() { - // We don't offer anything other than fullscreen on GPH devices so let's not even pretend. - _videoMode.fullscreen = true; - // Set the hardware stats to match the LCD. _videoMode.hardwareWidth = 320; _videoMode.hardwareHeight = 240; diff --git a/backends/graphics/openpandora/op-graphics.cpp b/backends/graphics/openpandora/op-graphics.cpp index d6c16462e82..3cc8c59907a 100644 --- a/backends/graphics/openpandora/op-graphics.cpp +++ b/backends/graphics/openpandora/op-graphics.cpp @@ -53,7 +53,6 @@ bool OPGraphicsManager::loadGFXMode() { SDL_ShowCursor(SDL_ENABLE); SDL_SetCursor(hiddenCursor); - _videoMode.fullscreen = true; return SurfaceSdlGraphicsManager::loadGFXMode(); } diff --git a/backends/graphics/sdl/sdl-graphics.cpp b/backends/graphics/sdl/sdl-graphics.cpp index 36dde9a26eb..07baf967637 100644 --- a/backends/graphics/sdl/sdl-graphics.cpp +++ b/backends/graphics/sdl/sdl-graphics.cpp @@ -337,7 +337,7 @@ bool SdlGraphicsManager::notifyEvent(const Common::Event &event) { } void SdlGraphicsManager::toggleFullScreen() { - if (!hasFeature(OSystem::kFeatureFullscreenMode)) + if (!g_system->hasFeature(OSystem::kFeatureFullscreenMode)) return; beginGFXTransaction(); @@ -357,7 +357,7 @@ Common::Keymap *SdlGraphicsManager::getKeymap() { Keymap *keymap = new Keymap(Keymap::kKeymapTypeGlobal, "sdl-graphics", _("Graphics")); Action *act; - if (hasFeature(OSystem::kFeatureFullscreenMode)) { + if (g_system->hasFeature(OSystem::kFeatureFullscreenMode)) { act = new Action("FULS", _("Toggle fullscreen")); act->addDefaultInputMapping("A+RETURN"); act->addDefaultInputMapping("A+KP_ENTER"); diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp index cef17e9585a..2d5952a3720 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp @@ -194,12 +194,7 @@ SurfaceSdlGraphicsManager::SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSou #endif _scalerType = 0; -#ifndef __SYMBIAN32__ _videoMode.fullscreen = ConfMan.getBool("fullscreen"); -#else - _videoMode.fullscreen = true; -#endif - _videoMode.filtering = ConfMan.getBool("filtering"); #if SDL_VERSION_ATLEAST(2, 0, 0) _videoMode.stretchMode = STRETCH_FIT; @@ -1494,6 +1489,9 @@ bool SurfaceSdlGraphicsManager::saveScreenshot(const Common::String &filename) c void SurfaceSdlGraphicsManager::setFullscreenMode(bool enable) { Common::StackLock lock(_graphicsMutex); + if (!g_system->hasFeature(OSystem::kFeatureFullscreenMode)) + return; + if (_oldVideoMode.setup && _oldVideoMode.fullscreen == enable) return; diff --git a/backends/platform/dingux/dingux.cpp b/backends/platform/dingux/dingux.cpp index afd80acc1b8..54e5a2c3e08 100644 --- a/backends/platform/dingux/dingux.cpp +++ b/backends/platform/dingux/dingux.cpp @@ -27,6 +27,8 @@ #include "backends/graphics/dinguxsdl/dinguxsdl-graphics.h" void OSystem_SDL_Dingux::initBackend() { + ConfMan.registerDefault("fullscreen", true); + // Create the events manager if (_eventSource == 0) _eventSource = new DINGUXSdlEventSource(); diff --git a/backends/platform/symbian/src/SymbianOS.cpp b/backends/platform/symbian/src/SymbianOS.cpp index 5fa21aed68e..ba96e32ed4b 100644 --- a/backends/platform/symbian/src/SymbianOS.cpp +++ b/backends/platform/symbian/src/SymbianOS.cpp @@ -97,6 +97,7 @@ void OSystem_SDL_Symbian::initBackend() { // Symbian OS should have joystick_num set to 0 in the ini file, // but uiq devices might refuse opening the joystick ConfMan.setInt("joystick_num", 0); + ConfMan.setBool("fullscreen", true); ConfMan.flushToDisk(); GUI::Actions::init();