diff options
Diffstat (limited to 'backends/platform/maemo')
-rw-r--r-- | backends/platform/maemo/maemo.cpp | 35 | ||||
-rw-r--r-- | backends/platform/maemo/maemo.h | 2 |
2 files changed, 37 insertions, 0 deletions
diff --git a/backends/platform/maemo/maemo.cpp b/backends/platform/maemo/maemo.cpp index 77d630fc30..49fa9298d4 100644 --- a/backends/platform/maemo/maemo.cpp +++ b/backends/platform/maemo/maemo.cpp @@ -32,6 +32,7 @@ #include "backends/events/maemosdl/maemosdl-events.h" #include "backends/graphics/maemosdl/maemosdl-graphics.h" #include "backends/keymapper/keymapper.h" +#include "backends/keymapper/keymapper-defaults.h" #include "common/textconsole.h" #include "common/translation.h" @@ -48,6 +49,35 @@ OSystem_SDL_Maemo::OSystem_SDL_Maemo() OSystem_SDL_Maemo::~OSystem_SDL_Maemo() { delete _eventObserver; + delete _keymapperDefaultBindings; +} + +static void registerDefaultKeyBindings(Common::KeymapperDefaultBindings *_keymapperDefaultBindings, Model _model) { + _keymapperDefaultBindings->setDefaultBinding("gui", "REM", "HOME"); + _keymapperDefaultBindings->setDefaultBinding("global", "REM", "HOME"); + + if (_model.hasMenuKey && _model.hasHwKeyboard) { + _keymapperDefaultBindings->setDefaultBinding("gui", "FUL", "FULLSCREEN"); + _keymapperDefaultBindings->setDefaultBinding("global", "FUL", "FULLSCREEN"); + } + + if (_model.hasHwKeyboard) { + _keymapperDefaultBindings->setDefaultBinding("gui", "VIR", "C+ZOOMMINUS"); + _keymapperDefaultBindings->setDefaultBinding("global", "VIR", "C+ZOOMMINUS"); + } else { + _keymapperDefaultBindings->setDefaultBinding("gui", "VIR", "FULLSCREEN"); + _keymapperDefaultBindings->setDefaultBinding("global", "VIR", "FULLSCREEN"); + } + + if (_model.hasMenuKey ) + _keymapperDefaultBindings->setDefaultBinding("global", "MEN", "MENU"); + else + _keymapperDefaultBindings->setDefaultBinding("global", "MEN", "S+C+M"); + + _keymapperDefaultBindings->setDefaultBinding("gui", "CLO", "ESCAPE"); + + _keymapperDefaultBindings->setDefaultBinding("maemo", "RCL", "ZOOMPLUS"); + _keymapperDefaultBindings->setDefaultBinding("maemo", "CLK", "ZOOMMINUS"); } void OSystem_SDL_Maemo::initBackend() { @@ -61,10 +91,15 @@ void OSystem_SDL_Maemo::initBackend() { if (_eventObserver == 0) _eventObserver = new MaemoSdlEventObserver((MaemoSdlEventSource *)_eventSource); + if (_keymapperDefaultBindings == 0) + _keymapperDefaultBindings = new Common::KeymapperDefaultBindings(); + ConfMan.set("vkeybdpath", DATA_PATH); _model = Model(detectModel()); + registerDefaultKeyBindings(_keymapperDefaultBindings, _model); + // Call parent implementation of this method OSystem_POSIX::initBackend(); initObserver(); diff --git a/backends/platform/maemo/maemo.h b/backends/platform/maemo/maemo.h index 382770219b..1f3c8b8d47 100644 --- a/backends/platform/maemo/maemo.h +++ b/backends/platform/maemo/maemo.h @@ -44,6 +44,7 @@ public: #ifdef ENABLE_KEYMAPPER virtual Common::HardwareKeySet *getHardwareKeySet(); virtual Common::Keymap *getGlobalKeymap(); + virtual Common::KeymapperDefaultBindings *getKeymapperDefaultBindings() { return _keymapperDefaultBindings; } #endif Model getModel() { return _model; } @@ -55,6 +56,7 @@ private: const Model detectModel(); Model _model; MaemoSdlEventObserver *_eventObserver; + Common::KeymapperDefaultBindings *_keymapperDefaultBindings; }; } // namespace Maemo |