diff options
Diffstat (limited to 'backends/graphics')
-rw-r--r-- | backends/graphics/openglsdl/openglsdl-graphics.cpp | 32 | ||||
-rw-r--r-- | backends/graphics/openglsdl/openglsdl-graphics.h | 8 |
2 files changed, 31 insertions, 9 deletions
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp index e4881a105e..23eee0ff75 100644 --- a/backends/graphics/openglsdl/openglsdl-graphics.cpp +++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp @@ -36,7 +36,8 @@ OpenGLSdlGraphicsManager::OpenGLSdlGraphicsManager() _lastFullscreenModeWidth(0), _lastFullscreenModeHeight(0), _desktopWidth(0), - _desktopHeight(0) { + _desktopHeight(0), + _ignoreResizeFrames(0) { // Initialize SDL video subsystem if (SDL_InitSubSystem(SDL_INIT_VIDEO) == -1) { @@ -222,6 +223,12 @@ void OpenGLSdlGraphicsManager::warpMouse(int x, int y) { setMousePos(scaledX, scaledY); } +void OpenGLSdlGraphicsManager::updateScreen() { + if (_ignoreResizeFrames) + _ignoreResizeFrames -= 1; + + OpenGLGraphicsManager::updateScreen(); +} // // Intern @@ -500,6 +507,10 @@ void OpenGLSdlGraphicsManager::toggleFullScreen(bool loop) { setFullscreenMode(!_videoMode.fullscreen); } endGFXTransaction(); + + // Ignore resize events for the next 10 frames + _ignoreResizeFrames = 10; + #ifdef USE_OSD char buffer[128]; if (_videoMode.fullscreen) @@ -564,14 +575,17 @@ bool OpenGLSdlGraphicsManager::notifyEvent(const Common::Event &event) { break;*/ // HACK: Handle special SDL event case OSystem_SDL::kSdlEventResize: - beginGFXTransaction(); - // Set the new screen size. It is saved on the mouse event as part of HACK, - // there is no common resize event - _videoMode.hardwareWidth = event.mouse.x; - _videoMode.hardwareHeight = event.mouse.y; - _screenResized = true; - _transactionDetails.sizeChanged = true; - endGFXTransaction(); + // Do not resize if ignoring resize events. + if (!_ignoreResizeFrames) { + beginGFXTransaction(); + // Set the new screen size. It is saved on the mouse event as part of HACK, + // there is no common resize event + _videoMode.hardwareWidth = event.mouse.x; + _videoMode.hardwareHeight = event.mouse.y; + _screenResized = true; + _transactionDetails.sizeChanged = true; + endGFXTransaction(); + } return true; default: diff --git a/backends/graphics/openglsdl/openglsdl-graphics.h b/backends/graphics/openglsdl/openglsdl-graphics.h index 1a54dccbcd..8c7ff35764 100644 --- a/backends/graphics/openglsdl/openglsdl-graphics.h +++ b/backends/graphics/openglsdl/openglsdl-graphics.h @@ -53,6 +53,8 @@ public: virtual bool notifyEvent(const Common::Event &event); + virtual void updateScreen(); + protected: virtual void internUpdateScreen(); @@ -96,6 +98,12 @@ protected: // If screen was resized by the user bool _screenResized; + + // Ignore resize events for the number of updateScreen() calls. + // Normaly resize events are user generated when resizing the window + // from its borders, but in some cases a resize event can be generated + // after a fullscreen change. + int _ignoreResizeFrames; }; #endif |