aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/maemo
diff options
context:
space:
mode:
Diffstat (limited to 'backends/platform/maemo')
-rw-r--r--backends/platform/maemo/maemo-common.h23
-rw-r--r--backends/platform/maemo/maemo-keys.h14
-rw-r--r--backends/platform/maemo/maemo.cpp37
-rw-r--r--backends/platform/maemo/maemo.h2
4 files changed, 55 insertions, 21 deletions
diff --git a/backends/platform/maemo/maemo-common.h b/backends/platform/maemo/maemo-common.h
index cd4bb3b027..453c70c45f 100644
--- a/backends/platform/maemo/maemo-common.h
+++ b/backends/platform/maemo/maemo-common.h
@@ -28,10 +28,10 @@
namespace Maemo {
enum ModelType {
- kModelType770 = 1,
- kModelTypeN800 = 2,
- kModelTypeN810 = 4,
- kModelTypeN900 = 8,
+ kModelType770 = 1 << 0,
+ kModelTypeN800 = 1 << 1,
+ kModelTypeN810 = 1 << 2,
+ kModelTypeN900 = 1 << 3,
kModelTypeInvalid = 0
};
@@ -39,16 +39,17 @@ struct Model {
const char *hwId;
ModelType modelType;
const char *hwAlias;
- bool hwKeyboard;
+ bool hasHwKeyboard;
+ bool hasMenuKey;
};
static const Model models[] = {
- {"SU-18", kModelType770, "770", false},
- {"RX-34", kModelTypeN800, "N800", false},
- {"RX-44", kModelTypeN810, "N810", true},
- {"RX-48", kModelTypeN810, "N810W", true},
- {"RX-51", kModelTypeN900, "N900", true},
- {0, kModelTypeInvalid, 0, true}
+ {"SU-18", kModelType770, "770", false, true},
+ {"RX-34", kModelTypeN800, "N800", false, true},
+ {"RX-44", kModelTypeN810, "N810", true, true},
+ {"RX-48", kModelTypeN810, "N810W", true, true},
+ {"RX-51", kModelTypeN900, "N900", true, false},
+ {0, kModelTypeInvalid, 0, true, true}
};
enum CustomEventType {
diff --git a/backends/platform/maemo/maemo-keys.h b/backends/platform/maemo/maemo-keys.h
index 6725b1164d..26ee375625 100644
--- a/backends/platform/maemo/maemo-keys.h
+++ b/backends/platform/maemo/maemo-keys.h
@@ -122,15 +122,11 @@ static const KeyTableEntry maemoKeys[] = {
{"LEFT", KEYCODE_LEFT, 0, "Left", kDirLeftKeyType, false},
// Function keys
- {"F1", KEYCODE_F1, ASCII_F1, "F1", kActionKeyType, false},
- {"F2", KEYCODE_F2, ASCII_F2, "F2", kActionKeyType, false},
- {"F3", KEYCODE_F3, ASCII_F3, "F3", kActionKeyType, false},
- {"F4", KEYCODE_F4, ASCII_F4, "Menu", kActionKeyType, false},
- {"F5", KEYCODE_F5, ASCII_F5, "Home", kActionKeyType, false},
- {"F6", KEYCODE_F6, ASCII_F6, "FullScreen", kActionKeyType, false},
- {"F7", KEYCODE_F7, ASCII_F7, "Zoom+", kActionKeyType, false},
- {"F8", KEYCODE_F8, ASCII_F8, "Zoom-", kActionKeyType, false},
- {"F9", KEYCODE_F9, ASCII_F9, "F9", kActionKeyType, false},
+ {"MENU", KEYCODE_F11, 0, "Menu", kActionKeyType, false},
+ {"HOME", KEYCODE_F12, 0, "Home", kActionKeyType, false},
+ {"FULLSCREEN", KEYCODE_F13, 0, "FullScreen", kActionKeyType, false},
+ {"ZOOMPLUS", KEYCODE_F14, 0, "Zoom+", kActionKeyType, false},
+ {"ZOOMMINUS", KEYCODE_F15, 0, "Zoom-", kActionKeyType, false},
{0, KEYCODE_INVALID, 0, 0, kGenericKeyType, false}
};
diff --git a/backends/platform/maemo/maemo.cpp b/backends/platform/maemo/maemo.cpp
index 77d630fc30..60ed4170e2 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,9 +91,14 @@ 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());
+ _model = detectModel();
+
+ registerDefaultKeyBindings(_keymapperDefaultBindings, _model);
// Call parent implementation of this method
OSystem_POSIX::initBackend();
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