aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2013-10-20 22:27:50 +0200
committerKamil Zbróg2013-10-24 12:59:16 +0100
commit2784901dac98f5972327a82bde147026cf7d7aee (patch)
tree06140c429b7510070332d0459cbc8c05adc143e6 /backends/graphics/surfacesdl/surfacesdl-graphics.cpp
parentaebe01f7ecf2faf884a027f5dabf7989bfaae32a (diff)
downloadscummvm-rg350-2784901dac98f5972327a82bde147026cf7d7aee.tar.gz
scummvm-rg350-2784901dac98f5972327a82bde147026cf7d7aee.tar.bz2
scummvm-rg350-2784901dac98f5972327a82bde147026cf7d7aee.zip
SDL: Clean up graphics manager switching slighty.
Sadly this also requires us to extend GraphicsManager for this SDL specific feature. However, since that's only used in the SDL backend and Tizen it should be fine for now...
Diffstat (limited to 'backends/graphics/surfacesdl/surfacesdl-graphics.cpp')
-rw-r--r--backends/graphics/surfacesdl/surfacesdl-graphics.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index 871c6c49b2..ba8807aaf4 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -193,10 +193,6 @@ SurfaceSdlGraphicsManager::SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSou
}
SurfaceSdlGraphicsManager::~SurfaceSdlGraphicsManager() {
- // Unregister the event observer
- if (g_system->getEventManager()->getEventDispatcher() != NULL)
- g_system->getEventManager()->getEventDispatcher()->unregisterObserver(this);
-
unloadGFXMode();
if (_mouseSurface)
SDL_FreeSurface(_mouseSurface);
@@ -211,11 +207,24 @@ SurfaceSdlGraphicsManager::~SurfaceSdlGraphicsManager() {
free(_mouseData);
}
-void SurfaceSdlGraphicsManager::initEventObserver() {
+void SurfaceSdlGraphicsManager::activateManager() {
+ GraphicsManager::activateManager();
+ initEventSource();
+
// Register the graphics manager as a event observer
g_system->getEventManager()->getEventDispatcher()->registerObserver(this, 10, false);
}
+void SurfaceSdlGraphicsManager::deactivateManager() {
+ // Unregister the event observer
+ if (g_system->getEventManager()->getEventDispatcher()) {
+ g_system->getEventManager()->getEventDispatcher()->unregisterObserver(this);
+ }
+
+ deinitEventSource();
+ GraphicsManager::deactivateManager();
+}
+
bool SurfaceSdlGraphicsManager::hasFeature(OSystem::Feature f) {
return
(f == OSystem::kFeatureFullscreenMode) ||