aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorAlejandro Marzini2010-08-20 22:56:13 +0000
committerAlejandro Marzini2010-08-20 22:56:13 +0000
commit942e104e3305e60e11bbcd6aac956c2d62c5a605 (patch)
tree53b6131f57f24a09505e982ae4d04e7f79e914fd /backends
parentb0409d673921163085d2e2fa440911080a7cf884 (diff)
downloadscummvm-rg350-942e104e3305e60e11bbcd6aac956c2d62c5a605.tar.gz
scummvm-rg350-942e104e3305e60e11bbcd6aac956c2d62c5a605.tar.bz2
scummvm-rg350-942e104e3305e60e11bbcd6aac956c2d62c5a605.zip
OPENGL: Fix issue with resize events generated after going out of fullscreen mode.
svn-id: r52248
Diffstat (limited to 'backends')
-rw-r--r--backends/graphics/openglsdl/openglsdl-graphics.cpp32
-rw-r--r--backends/graphics/openglsdl/openglsdl-graphics.h8
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