From 021e567ba44650b0ab63e7f571dc0d622edbcc6d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 30 Dec 2012 23:24:09 +0300 Subject: Add action to show onscreen keyboard. --- src/actionmanager.cpp | 11 +++++++++++ src/actionmanager.h | 1 + src/gui/setupactiondata.h | 5 +++++ src/keyboarddata.h | 7 +++++++ src/keydata.h | 1 + src/touchactions.cpp | 8 +------- 6 files changed, 26 insertions(+), 7 deletions(-) diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp index 92087b6db..761825f03 100644 --- a/src/actionmanager.cpp +++ b/src/actionmanager.cpp @@ -65,6 +65,10 @@ #include +#ifdef ANDROID +#include +#endif + #include "debug.h" #define impHandler(name) bool name(const InputEvent &event) @@ -1065,4 +1069,11 @@ impHandler0(stopSit) return false; } +impHandler0(showKeyboard) +{ +#ifdef ANDROID + SDL_ANDROID_ToggleScreenKeyboardTextInput(nullptr); +#endif +} + } diff --git a/src/actionmanager.h b/src/actionmanager.h index 380a156c7..3db7e4a99 100644 --- a/src/actionmanager.h +++ b/src/actionmanager.h @@ -95,6 +95,7 @@ namespace ActionManager decHandler(targetNPC); decHandler(safeVideoMode); decHandler(stopSit); + decHandler(showKeyboard); decHandler(hideWindows); decHandler(helpWindowShow); diff --git a/src/gui/setupactiondata.h b/src/gui/setupactiondata.h index 2ca6aaa3c..935cd95b6 100644 --- a/src/gui/setupactiondata.h +++ b/src/gui/setupactiondata.h @@ -1153,6 +1153,11 @@ static SetupActionData setupActionData6[] = Input::KEY_MOD, "", }, + { + N_("Show onscreen keyboard"), + Input::KEY_SHOW_KEYBOARD, + "", + }, { "", Input::KEY_NO_VALUE, diff --git a/src/keyboarddata.h b/src/keyboarddata.h index 506594d7a..0d40454fb 100644 --- a/src/keyboarddata.h +++ b/src/keyboarddata.h @@ -1929,6 +1929,13 @@ static const KeyData keyData[Input::KEY_TOTAL] = { Input::GRP_DEFAULT, &ActionManager::stopSit, Input::KEY_NO_VALUE, 50, + COND_DEFAULT}, + {"keyShowKeyboard", + INPUT_UNKNOWN, Input::KEY_NO_VALUE, + INPUT_UNKNOWN, Input::KEY_NO_VALUE, + Input::GRP_DEFAULT, + &ActionManager::showKeyboard, + Input::KEY_NO_VALUE, 50, COND_DEFAULT} }; diff --git a/src/keydata.h b/src/keydata.h index 5d3606d69..c328178a7 100644 --- a/src/keydata.h +++ b/src/keydata.h @@ -338,6 +338,7 @@ namespace Input KEY_GUI_MOD, KEY_SAFE_VIDEO, KEY_STOP_SIT, + KEY_SHOW_KEYBOARD, KEY_TOTAL }; } diff --git a/src/touchactions.cpp b/src/touchactions.cpp index 2a6fbacaa..d45e4a7c3 100644 --- a/src/touchactions.cpp +++ b/src/touchactions.cpp @@ -26,10 +26,6 @@ #include "mouseinput.h" #include "touchmanager.h" -#ifdef ANDROID -#include -#endif - #include "debug.h" InputEvent tempEvent(0, 0); @@ -41,9 +37,7 @@ int haldJoyPad = 50; impHandler0(showKeyboard) { -#ifdef ANDROID - SDL_ANDROID_ToggleScreenKeyboardTextInput(nullptr); -#endif + ActionManager::showKeyboard(tempEvent); } void setHalfJoyPad(int s) -- cgit v1.2.3-70-g09d2