diff options
author | Tarek Soliman | 2012-02-09 01:26:42 -0600 |
---|---|---|
committer | Tarek Soliman | 2012-02-12 13:28:13 -0600 |
commit | c2640ed33a1b9c28e58b04877b7c4bf7b5fff570 (patch) | |
tree | 86f7356cf37d6fa80984a99bb51fcc78444655f0 /backends/platform | |
parent | d90d4d10a09e1bab04154aa81162aac9c994f23c (diff) | |
download | scummvm-rg350-c2640ed33a1b9c28e58b04877b7c4bf7b5fff570.tar.gz scummvm-rg350-c2640ed33a1b9c28e58b04877b7c4bf7b5fff570.tar.bz2 scummvm-rg350-c2640ed33a1b9c28e58b04877b7c4bf7b5fff570.zip |
MAEMO: Use custom event Click Mode keymap action
Diffstat (limited to 'backends/platform')
-rw-r--r-- | backends/platform/maemo/maemo-common.h | 5 | ||||
-rw-r--r-- | backends/platform/maemo/maemo.cpp | 22 | ||||
-rw-r--r-- | backends/platform/maemo/maemo.h | 5 |
3 files changed, 27 insertions, 5 deletions
diff --git a/backends/platform/maemo/maemo-common.h b/backends/platform/maemo/maemo-common.h index 5f8645a6b7..cd4bb3b027 100644 --- a/backends/platform/maemo/maemo-common.h +++ b/backends/platform/maemo/maemo-common.h @@ -51,6 +51,11 @@ static const Model models[] = { {0, kModelTypeInvalid, 0, true} }; +enum CustomEventType { + kEventClickMode = 1, + kEventInvalid = 0 +}; + } // namespace Maemo #endif // ifndef PLATFORM_SDL_MAEMO_COMMON_H diff --git a/backends/platform/maemo/maemo.cpp b/backends/platform/maemo/maemo.cpp index eae18cc4fd..fe60bdc042 100644 --- a/backends/platform/maemo/maemo.cpp +++ b/backends/platform/maemo/maemo.cpp @@ -46,6 +46,10 @@ OSystem_SDL_Maemo::OSystem_SDL_Maemo() OSystem_POSIX() { } +OSystem_SDL_Maemo::~OSystem_SDL_Maemo() { + delete _eventObserver; +} + void OSystem_SDL_Maemo::initBackend() { // Create the events manager if (_eventSource == 0) @@ -54,12 +58,16 @@ void OSystem_SDL_Maemo::initBackend() { if (_graphicsManager == 0) _graphicsManager = new MaemoSdlGraphicsManager(_eventSource); + if (_eventObserver == 0) + _eventObserver = new MaemoSdlEventObserver((MaemoSdlEventSource *)_eventSource); + ConfMan.set("vkeybdpath", DATA_PATH); _model = Model(detectModel()); // Call parent implementation of this method OSystem_POSIX::initBackend(); + initObserver(); } void OSystem_SDL_Maemo::quit() { @@ -136,8 +144,11 @@ Common::Keymap *OSystem_SDL_Maemo::getGlobalKeymap() { Action *act; -// act = new Action(globalMap, "CLKM", _("Click Mode"), kKeyRemapActionType); -// act->addCustomEvent(CLICK_MODE); + act = new Action(globalMap, "CLKM", _("Click Mode"), kKeyRemapActionType); + Event evt = Event(); + evt.type = EVENT_CUSTOM_BACKEND; + evt.customType = Maemo::kEventClickMode; + act->addEvent(evt); act = new Action(globalMap, "LCLK", _("Left Click"), kKeyRemapActionType); act->addLeftClickEvent(); @@ -154,8 +165,11 @@ Common::Keymap *OSystem_SDL_Maemo::getGlobalKeymap() { #endif } -} //namespace Maemo - +void OSystem_SDL_Maemo::initObserver() { + assert(_eventManager); + _eventManager->getEventDispatcher()->registerObserver(_eventObserver, 10, false); +} +} //namespace Maemo #endif diff --git a/backends/platform/maemo/maemo.h b/backends/platform/maemo/maemo.h index e94c6c603b..821f3526e8 100644 --- a/backends/platform/maemo/maemo.h +++ b/backends/platform/maemo/maemo.h @@ -29,10 +29,12 @@ #include "backends/platform/maemo/maemo-common.h" namespace Maemo { +class MaemoSdlEventObserver; class OSystem_SDL_Maemo : public OSystem_POSIX { public: OSystem_SDL_Maemo(); + ~OSystem_SDL_Maemo(); virtual void initBackend(); virtual void quit(); @@ -46,10 +48,11 @@ public: private: virtual void setXWindowName(const char *caption); + void initObserver(); const Model detectModel(); Model _model; - + MaemoSdlEventObserver *_eventObserver; }; } // namespace Maemo |