diff options
author | Johannes Schickel | 2013-10-17 23:53:51 +0200 |
---|---|---|
committer | Johannes Schickel | 2013-10-19 22:17:42 +0200 |
commit | 53f9c0d69b96a6394aa90caf437d3a90b0affd3e (patch) | |
tree | 295ca87fc3dabe9a6196332b0e53495b60535c49 | |
parent | ed180f6b67b0f8c0bedfca7117ab279349c45e1e (diff) | |
download | scummvm-rg350-53f9c0d69b96a6394aa90caf437d3a90b0affd3e.tar.gz scummvm-rg350-53f9c0d69b96a6394aa90caf437d3a90b0affd3e.tar.bz2 scummvm-rg350-53f9c0d69b96a6394aa90caf437d3a90b0affd3e.zip |
SDL: Send EVENT_SCREEN_CHANGED after receiving SDL_VIDEORESIZE when necessary.
This fixes some ugly crashes when resizing the window in OpenGL mode.
-rw-r--r-- | backends/events/sdl/sdl-events.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/backends/events/sdl/sdl-events.cpp b/backends/events/sdl/sdl-events.cpp index e2ef7f6bf6..e84a8f8c01 100644 --- a/backends/events/sdl/sdl-events.cpp +++ b/backends/events/sdl/sdl-events.cpp @@ -391,8 +391,17 @@ bool SdlEventSource::dispatchSDLEvent(SDL_Event &ev, Common::Event &event) { return false; case SDL_VIDEORESIZE: - if (_graphicsManager) + if (_graphicsManager) { _graphicsManager->notifyResize(ev.resize.w, ev.resize.h); + + // If the screen changed, send an Common::EVENT_SCREEN_CHANGED + int screenID = ((OSystem_SDL *)g_system)->getGraphicsManager()->getScreenChangeID(); + if (screenID != _lastScreenID) { + _lastScreenID = screenID; + event.type = Common::EVENT_SCREEN_CHANGED; + return true; + } + } return false; case SDL_QUIT: |