aboutsummaryrefslogtreecommitdiff
path: root/backends/platform
diff options
context:
space:
mode:
authorKlaus Reimer2011-04-09 18:03:19 +0200
committerMax Horn2011-04-12 11:11:17 +0200
commit6c94353eff3aeee9c985d22b311959d1c5751b0e (patch)
tree806db5aa98e7ac0854842a815c3272aad0d94543 /backends/platform
parente5dab6672c673d8827d5e471d98074220ff6b75c (diff)
downloadscummvm-rg350-6c94353eff3aeee9c985d22b311959d1c5751b0e.tar.gz
scummvm-rg350-6c94353eff3aeee9c985d22b311959d1c5751b0e.tar.bz2
scummvm-rg350-6c94353eff3aeee9c985d22b311959d1c5751b0e.zip
WEBOS: Complete rewrite of key/mouse events handling
Touchscreen is now always used like a touch pad.
Diffstat (limited to 'backends/platform')
-rw-r--r--backends/platform/webos/hardwarekeys.cpp164
-rw-r--r--backends/platform/webos/keyboard.h37
-rw-r--r--backends/platform/webos/module.mk3
-rw-r--r--backends/platform/webos/webos.cpp28
4 files changed, 29 insertions, 203 deletions
diff --git a/backends/platform/webos/hardwarekeys.cpp b/backends/platform/webos/hardwarekeys.cpp
deleted file mode 100644
index d8869a43a3..0000000000
--- a/backends/platform/webos/hardwarekeys.cpp
+++ /dev/null
@@ -1,164 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include "backends/platform/webos/webos.h"
-#include "backends/platform/webos/keyboard.h"
-#include "backends/keymapper/keymapper.h"
-#include "common/keyboard.h"
-
-#ifdef ENABLE_KEYMAPPER
-
-using namespace Common;
-
-struct Key {
- const char *hwId;
- KeyCode keycode;
- uint16 ascii;
- const char *desc;
- KeyType preferredAction;
- bool shiftable;
-};
-
-static const Key keys[] = {
- {"BACKSPACE", KEYCODE_BACKSPACE, ASCII_BACKSPACE, "Backspace", kActionKeyType, false},
- {"RETURN", KEYCODE_RETURN, ASCII_RETURN, "Return", kActionKeyType, false},
- {"ESCAPE", KEYCODE_ESCAPE, ASCII_ESCAPE, "Esc", kStartKeyType, false},
- {"SPACE", KEYCODE_SPACE, ASCII_SPACE, "Space", kActionKeyType, false},
- {"EXCLAIM", KEYCODE_EXCLAIM, '!', "!", kActionKeyType, false},
- {"QUOTEDBL", KEYCODE_QUOTEDBL, '"', "\"", kActionKeyType, false},
- {"HASH", KEYCODE_HASH, '#', "#", kActionKeyType, false},
- {"DOLLAR", KEYCODE_DOLLAR, '$', "$", kActionKeyType, false},
- {"AMPERSAND", KEYCODE_AMPERSAND, '&', "&", kActionKeyType, false},
- {"QUOTE", KEYCODE_QUOTE, '\'', "'", kActionKeyType, false},
- {"LEFTPAREN", KEYCODE_LEFTPAREN, '(', "(", kActionKeyType, false},
- {"RIGHTPAREN", KEYCODE_RIGHTPAREN, ')', ")", kActionKeyType, false},
- {"ASTERISK", KEYCODE_ASTERISK, '*', "*", kActionKeyType, false},
- {"PLUS", KEYCODE_PLUS, '+', "+", kActionKeyType, false},
- {"COMMA", KEYCODE_COMMA, ',', ",", kActionKeyType, false},
- {"MINUS", KEYCODE_MINUS, '-', "-", kActionKeyType, false},
- {"PERIOD", KEYCODE_PERIOD, '.', ".", kActionKeyType, false},
- {"SLASH", KEYCODE_SLASH, '/', "/", kActionKeyType, false},
- {"0", KEYCODE_0, '0', "0", kActionKeyType, false},
- {"1", KEYCODE_1, '1', "1", kActionKeyType, false},
- {"2", KEYCODE_2, '2', "2", kActionKeyType, false},
- {"3", KEYCODE_3, '3', "3", kActionKeyType, false},
- {"4", KEYCODE_4, '4', "4", kActionKeyType, false},
- {"5", KEYCODE_5, '5', "5", kActionKeyType, false},
- {"6", KEYCODE_6, '6', "6", kActionKeyType, false},
- {"7", KEYCODE_7, '7', "7", kActionKeyType, false},
- {"8", KEYCODE_8, '8', "8", kActionKeyType, false},
- {"9", KEYCODE_9, '9', "9", kActionKeyType, false},
- {"COLON", KEYCODE_COLON, ':', ":", kActionKeyType, false},
- {"SEMICOLON", KEYCODE_SEMICOLON, ';', ";", kActionKeyType, false},
- {"EQUALS", KEYCODE_EQUALS, '=', "=", kActionKeyType, false},
- {"QUESTION", KEYCODE_QUESTION, '?', "?", kActionKeyType, false},
- {"AT", KEYCODE_AT, '@', "@", kActionKeyType, false},
-
- {"UNDERSCORE", KEYCODE_UNDERSCORE, '_', "_", kActionKeyType, false},
- {"a", KEYCODE_a, 'a', "a", kActionKeyType, true},
- {"b", KEYCODE_b, 'b', "b", kActionKeyType, true},
- {"c", KEYCODE_c, 'c', "c", kActionKeyType, true},
- {"d", KEYCODE_d, 'd', "d", kActionKeyType, true},
- {"e", KEYCODE_e, 'e', "e", kActionKeyType, true},
- {"f", KEYCODE_f, 'f', "f", kActionKeyType, true},
- {"g", KEYCODE_g, 'g', "g", kActionKeyType, true},
- {"h", KEYCODE_h, 'h', "h", kActionKeyType, true},
- {"i", KEYCODE_i, 'i', "i", kActionKeyType, true},
- {"j", KEYCODE_j, 'j', "j", kActionKeyType, true},
- {"k", KEYCODE_k, 'k', "k", kActionKeyType, true},
- {"l", KEYCODE_l, 'l', "l", kActionKeyType, true},
- {"m", KEYCODE_m, 'm', "m", kActionKeyType, true},
- {"n", KEYCODE_n, 'n', "n", kActionKeyType, true},
- {"o", KEYCODE_o, 'o', "o", kActionKeyType, true},
- {"p", KEYCODE_p, 'p', "p", kActionKeyType, true},
- {"q", KEYCODE_q, 'q', "q", kActionKeyType, true},
- {"r", KEYCODE_r, 'r', "r", kActionKeyType, true},
- {"s", KEYCODE_s, 's', "s", kActionKeyType, true},
- {"t", KEYCODE_t, 't', "t", kActionKeyType, true},
- {"u", KEYCODE_u, 'u', "u", kActionKeyType, true},
- {"v", KEYCODE_v, 'v', "v", kActionKeyType, true},
- {"w", KEYCODE_w, 'w', "w", kActionKeyType, true},
- {"x", KEYCODE_x, 'x', "x", kActionKeyType, true},
- {"y", KEYCODE_y, 'y', "y", kActionKeyType, true},
- {"z", KEYCODE_z, 'z', "z", kActionKeyType, true},
-
- // Miscellaneous function keys
- { "FORWARD", (KeyCode) KEYCODE_FORWARD, ASCII_FORWARD, "Forward", kActionKeyType, false },
-
- {0, KEYCODE_INVALID, 0, 0, kGenericKeyType, false}
-};
-
-struct Mod {
- byte flag;
- const char *id;
- const char *desc;
- bool shiftable;
-};
-
-static const Mod modifiers[] = {
- { 0, "", "", false },
- { KBD_CTRL, "C+", "Ctrl+", false },
- { KBD_SHIFT, "", "", true },
- { KBD_SHIFT | KBD_CTRL, "S+C+", "Shift+Ctrl+", true },
- { 0, 0, 0, false }
-};
-#endif
-
-Common::HardwareKeySet *OSystem_SDL_WebOS::getHardwareKeySet() {
-#ifdef ENABLE_KEYMAPPER
-
- HardwareKeySet *keySet = new HardwareKeySet();
- const Key *key;
- const Mod *mod;
- char fullKeyId[50];
- char fullKeyDesc[100];
- uint16 ascii;
-
- for (mod = modifiers; mod->id; mod++) {
- for (key = keys; key->hwId; key++) {
- ascii = key->ascii;
-
- if (mod->shiftable && key->shiftable) {
- snprintf(fullKeyId, 50, "%s%c", mod->id, toupper(key->hwId[0]));
- snprintf(fullKeyDesc, 100, "%s%c", mod->desc, toupper(key->desc[0]));
- ascii = toupper(key->ascii);
- } else if (mod->shiftable) {
- snprintf(fullKeyId, 50, "S+%s%s", mod->id, key->hwId);
- snprintf(fullKeyDesc, 100, "Shift+%s%s", mod->desc, key->desc);
- } else {
- snprintf(fullKeyId, 50, "%s%s", mod->id, key->hwId);
- snprintf(fullKeyDesc, 100, "%s%s", mod->desc, key->desc);
- }
-
- keySet->addHardwareKey(new HardwareKey(fullKeyId, KeyState(key->keycode, ascii, mod->flag), fullKeyDesc, key->preferredAction ));
- }
- }
-
- return keySet;
-
-#else
- return 0;
-#endif
-}
diff --git a/backends/platform/webos/keyboard.h b/backends/platform/webos/keyboard.h
deleted file mode 100644
index 816996a943..0000000000
--- a/backends/platform/webos/keyboard.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#ifndef WEBOS_KEYBOARD_H
-#define WEBOS_KEYBOARD_H
-
-enum {
- KEYCODE_FORWARD = 229
-};
-
-enum {
- ASCII_FORWARD = 229
-};
-
-#endif
diff --git a/backends/platform/webos/module.mk b/backends/platform/webos/module.mk
index 6f68b98152..fe4ec1e079 100644
--- a/backends/platform/webos/module.mk
+++ b/backends/platform/webos/module.mk
@@ -2,8 +2,7 @@ MODULE := backends/platform/webos
MODULE_OBJS := \
main.o \
- webos.o \
- hardwarekeys.o
+ webos.o
# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))
diff --git a/backends/platform/webos/webos.cpp b/backends/platform/webos/webos.cpp
index 34d6f68261..2f3cd3d9d2 100644
--- a/backends/platform/webos/webos.cpp
+++ b/backends/platform/webos/webos.cpp
@@ -25,14 +25,20 @@
#include "backends/platform/webos/webos.h"
#include "backends/events/webossdl/webossdl-events.h"
+#include "backends/keymapper/keymapper.h"
#if defined(WEBOS)
+using namespace Common;
+
OSystem_SDL_WebOS::OSystem_SDL_WebOS()
:
OSystem_POSIX("/media/cryptofs/apps/usr/palm/applications/org.scummvm.scummvm/scummvmrc") {
}
+/**
+ * Initializes the backend.
+ */
void OSystem_SDL_WebOS::initBackend() {
// Create the events manager
if (_eventSource == 0)
@@ -42,4 +48,26 @@ void OSystem_SDL_WebOS::initBackend() {
OSystem_SDL::initBackend();
}
+/**
+ * Gets the original SDL hardware key set, adds WebOS specific keys and
+ * returns the new key set.
+ *
+ * @return The hardware key set with added webOS specific keys.
+ */
+HardwareKeySet *OSystem_SDL_WebOS::getHardwareKeySet() {
+#ifdef ENABLE_KEYMAPPER
+ // Get the original SDL hardware key set
+ HardwareKeySet *keySet = OSystem_SDL::getHardwareKeySet();
+
+ // Add WebOS specific keys
+ keySet->addHardwareKey(new HardwareKey("FORWARD",
+ KeyState((KeyCode) 229, 229, 0), "Forward", kActionKeyType));
+
+ // Return the modified hardware key set
+ return keySet;
+#else
+ return 0;
+#endif
+}
+
#endif