diff options
author | Kostas Nakos | 2007-06-03 19:29:13 +0000 |
---|---|---|
committer | Kostas Nakos | 2007-06-03 19:29:13 +0000 |
commit | 83c5c2ae4eedf789fe5b23163fcc5b1ef43c9dcb (patch) | |
tree | e3813258dcd1a652786ecc5530445ba437d59bec /backends | |
parent | 7201437206f62d9be004cca263ee92d2e671510f (diff) | |
download | scummvm-rg350-83c5c2ae4eedf789fe5b23163fcc5b1ef43c9dcb.tar.gz scummvm-rg350-83c5c2ae4eedf789fe5b23163fcc5b1ef43c9dcb.tar.bz2 scummvm-rg350-83c5c2ae4eedf789fe5b23163fcc5b1ef43c9dcb.zip |
new functionality for the predictive input dialog for smartphones
svn-id: r27071
Diffstat (limited to 'backends')
-rw-r--r-- | backends/platform/wince/CEActionsSmartphone.cpp | 9 | ||||
-rw-r--r-- | backends/platform/wince/wince-sdl.cpp | 62 | ||||
-rw-r--r-- | backends/platform/wince/wince-sdl.h | 1 |
3 files changed, 55 insertions, 17 deletions
diff --git a/backends/platform/wince/CEActionsSmartphone.cpp b/backends/platform/wince/CEActionsSmartphone.cpp index 3d85ebc68e..042fc4bd55 100644 --- a/backends/platform/wince/CEActionsSmartphone.cpp +++ b/backends/platform/wince/CEActionsSmartphone.cpp @@ -43,7 +43,7 @@ const String smartphoneActionNames[] = { "Save", "Skip", "Zone", - "FT Cheat", + "Multi Function", "Bind Keys", "Keyboard", "Rotate", @@ -152,9 +152,12 @@ void CEActionsSmartphone::initInstanceGame() { _key_action[SMARTPHONE_ACTION_SKIP].setAscii(KEY_ALL_SKIP); // Zone _action_enabled[SMARTPHONE_ACTION_ZONE] = true; - // FT Cheat + // Multi function key _action_enabled[SMARTPHONE_ACTION_FT_CHEAT] = true; - _key_action[SMARTPHONE_ACTION_FT_CHEAT].setAscii(86); // shift-V + if (is_agi) + _key_action[SMARTPHONE_ACTION_FT_CHEAT].setAscii(SDLK_PAUSE); + else + _key_action[SMARTPHONE_ACTION_FT_CHEAT].setAscii(86); // shift-V // Bind keys _action_enabled[SMARTPHONE_ACTION_BINDKEYS] = true; } diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp index 8ef7412530..a096be0a4a 100644 --- a/backends/platform/wince/wince-sdl.cpp +++ b/backends/platform/wince/wince-sdl.cpp @@ -330,7 +330,7 @@ bool OSystem_WINCE3::isOzone() { OSystem_WINCE3::OSystem_WINCE3() : OSystem_SDL(), _orientationLandscape(0), _newOrientation(0), _panelInitialized(false), - _panelVisible(true), _panelStateForced(false), _forceHideMouse(false), + _panelVisible(true), _panelStateForced(false), _forceHideMouse(false), _unfilteredkeys(false), _freeLook(false), _forcePanelInvisible(false), _toolbarHighDrawn(false), _zoomUp(false), _zoomDown(false), _scalersChanged(false), _monkeyKeyboard(false), _lastKeyPressed(0), _tapTime(0), _saveToolbarState(false), _saveActiveToolbar(NAME_MAIN_PANEL), _rbutton(false), _hasfocus(true), @@ -771,6 +771,7 @@ void OSystem_WINCE3::setFeatureState(Feature f, bool enable) { switch(f) { case kFeatureFullscreenMode: return; + case kFeatureVirtualKeyboard: if (_hasSmartphoneResolution) return; @@ -790,6 +791,12 @@ void OSystem_WINCE3::setFeatureState(Feature f, bool enable) { //_toolbarHandler.setVisible(_saveToolbarState); } return; + + case kFeatureDisableKeyFiltering: + if (_hasSmartphoneResolution) + _unfilteredkeys = enable; + return; + default: OSystem_SDL::setFeatureState(f, enable); } @@ -2067,11 +2074,23 @@ void OSystem_WINCE3::addDirtyRect(int x, int y, int w, int h, bool mouseRect) { OSystem_SDL::addDirtyRect(x, y, w, h, false); } -static int mapKeyCE(SDLKey key, SDLMod mod, Uint16 unicode) +static int mapKeyCE(SDLKey key, SDLMod mod, Uint16 unicode, bool unfilter) { if (GUI::Actions::Instance()->mappingActive()) return key; + if (unfilter) { + switch (key) { + case SDLK_ESCAPE: + return SDLK_BACKSPACE; + case SDLK_F8: + return SDLK_ASTERISK; + case SDLK_F9: + return SDLK_HASH; + } + return key; + } + if (key >= SDLK_KP0 && key <= SDLK_KP9) { return key - SDLK_KP0 + '0'; } else if (key >= SDLK_UP && key <= SDLK_PAGEDOWN) { @@ -2113,9 +2132,9 @@ bool OSystem_WINCE3::pollEvent(Common::Event &event) { while(SDL_PollEvent(&ev)) { switch(ev.type) { case SDL_KEYDOWN: - // KMOD_RESERVED is used if the key has been injected by an external buffer debug(1, "Key down %X %s", ev.key.keysym.sym, SDL_GetKeyName((SDLKey)ev.key.keysym.sym)); - if (ev.key.keysym.mod != KMOD_RESERVED) { + // KMOD_RESERVED is used if the key has been injected by an external buffer + if (ev.key.keysym.mod != KMOD_RESERVED && !_unfilteredkeys) { keyEvent = true; _lastKeyPressed = ev.key.keysym.sym; _keyRepeatTime = currentTime; @@ -2125,19 +2144,27 @@ bool OSystem_WINCE3::pollEvent(Common::Event &event) { return true; } - event.type = Common::EVENT_KEYDOWN; - event.kbd.keycode = ev.key.keysym.sym; - event.kbd.ascii = mapKeyCE(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode); - if (GUI_Actions::Instance()->mappingActive()) event.kbd.flags = 0xFF; + else if (ev.key.keysym.sym == SDLK_PAUSE) { + _lastKeyPressed = 0; + event.type = Common::EVENT_PREDICTIVE_DIALOG; + return true; + } + + event.type = Common::EVENT_KEYDOWN; + if (!_unfilteredkeys) + event.kbd.keycode = ev.key.keysym.sym; + else + event.kbd.keycode = mapKeyCE(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode, _unfilteredkeys); + event.kbd.ascii = mapKeyCE(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode, _unfilteredkeys); return true; case SDL_KEYUP: - // KMOD_RESERVED is used if the key has been injected by an external buffer debug(1, "Key up %X %s", ev.key.keysym.sym, SDL_GetKeyName((SDLKey)ev.key.keysym.sym)); - if (ev.key.keysym.mod != KMOD_RESERVED) { + // KMOD_RESERVED is used if the key has been injected by an external buffer + if (ev.key.keysym.mod != KMOD_RESERVED && !_unfilteredkeys) { keyEvent = true; _lastKeyPressed = 0; @@ -2145,12 +2172,19 @@ bool OSystem_WINCE3::pollEvent(Common::Event &event) { return true; } - event.type = Common::EVENT_KEYUP; - event.kbd.keycode = ev.key.keysym.sym; - event.kbd.ascii = mapKeyCE(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode); - if (GUI_Actions::Instance()->mappingActive()) event.kbd.flags = 0xFF; + else if (ev.key.keysym.sym == SDLK_PAUSE) { + _lastKeyPressed = 0; + return false; // chew up the show agi dialog key up event + } + + event.type = Common::EVENT_KEYUP; + if (!_unfilteredkeys) + event.kbd.keycode = ev.key.keysym.sym; + else + event.kbd.keycode = mapKeyCE(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode, _unfilteredkeys); + event.kbd.ascii = mapKeyCE(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode, _unfilteredkeys); return true; diff --git a/backends/platform/wince/wince-sdl.h b/backends/platform/wince/wince-sdl.h index 0e8e5e53ba..056996f0de 100644 --- a/backends/platform/wince/wince-sdl.h +++ b/backends/platform/wince/wince-sdl.h @@ -189,6 +189,7 @@ private: bool _panelInitialized; // only initialize the toolbar once bool _monkeyKeyboard; // forced keyboard for Monkey Island copy protection + bool _unfilteredkeys; // discard key mapping temporarily (agi pred. dialog) static bool _soundMaster; // turn off sound after all calculations // static since needed by the SDL callback int _orientationLandscape; // current orientation |