[Scummvm-git-logs] scummvm master -> dd1bf34f180be48fc12008db23cf2857a081df81
sev-
sev at scummvm.org
Mon Nov 1 15:54:43 UTC 2021
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
6dbb129f40 BACKENDS: Allow activating the system virtual keyboard using the keymapper
dd1bf34f18 BACKENDS: Hide the virtual keyboard action when one isn't available
Commit: 6dbb129f4007a75e54caa478dac11e1b995c7331
https://github.com/scummvm/scummvm/commit/6dbb129f4007a75e54caa478dac11e1b995c7331
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2021-11-01T16:54:39+01:00
Commit Message:
BACKENDS: Allow activating the system virtual keyboard using the keymapper
Changed paths:
backends/events/default/default-events.cpp
backends/events/dinguxsdl/dinguxsdl-events.cpp
backends/events/gph/gph-events.cpp
backends/events/samsungtvsdl/samsungtvsdl-events.cpp
backends/keymapper/keymapper.cpp
common/events.h
diff --git a/backends/events/default/default-events.cpp b/backends/events/default/default-events.cpp
index 75ea590f6a..b1d09414f3 100644
--- a/backends/events/default/default-events.cpp
+++ b/backends/events/default/default-events.cpp
@@ -155,8 +155,9 @@ bool DefaultEventManager::pollEvent(Common::Event &event) {
else if (_shouldReturnToLauncher)
event.type = Common::EVENT_RETURN_TO_LAUNCHER;
break;
-#ifdef ENABLE_VKEYBD
+
case Common::EVENT_VIRTUAL_KEYBOARD:
+#ifdef ENABLE_VKEYBD
if (!_vk)
break;
@@ -169,8 +170,17 @@ bool DefaultEventManager::pollEvent(Common::Event &event) {
_vk->show();
forwardEvent = false;
}
- break;
+#else
+ // TODO: Support switching between virtual keyboards at runtime
+ if (g_system->hasFeature(OSystem::kFeatureVirtualKeyboard)) {
+ if (g_system->getFeatureState(OSystem::kFeatureVirtualKeyboard))
+ g_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false);
+ else
+ g_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, true);
+ }
#endif
+ break;
+
case Common::EVENT_RETURN_TO_LAUNCHER:
if (ConfMan.getBool("confirm_exit")) {
if (_confirmExitDialogActive) {
@@ -330,13 +340,11 @@ Common::Keymap *DefaultEventManager::getGlobalKeymap() {
act->setEvent(EVENT_MAINMENU);
globalKeymap->addAction(act);
-#ifdef ENABLE_VKEYBD
act = new Action("VIRT", _("Display keyboard"));
act->addDefaultInputMapping("C+F7");
act->addDefaultInputMapping("JOY_BACK");
act->setEvent(EVENT_VIRTUAL_KEYBOARD);
globalKeymap->addAction(act);
-#endif
act = new Action("MUTE", _("Toggle mute"));
act->addDefaultInputMapping("C+u");
diff --git a/backends/events/dinguxsdl/dinguxsdl-events.cpp b/backends/events/dinguxsdl/dinguxsdl-events.cpp
index fa5f1d37dd..cf5f5b5ce7 100644
--- a/backends/events/dinguxsdl/dinguxsdl-events.cpp
+++ b/backends/events/dinguxsdl/dinguxsdl-events.cpp
@@ -174,12 +174,10 @@ bool DINGUXSdlEventSource::remapKey(SDL_Event &ev, Common::Event &event) {
return true;
} else if (ev.key.keysym.sym == BUT_SELECT) { // virtual keyboard
-#ifdef ENABLE_VKEYBD
if (ev.type == SDL_KEYDOWN)
event.type = Common::EVENT_VIRTUAL_KEYBOARD;
return true;
-#endif
} else if (ev.key.keysym.sym == BUT_START) { // F5, menu in some games
ev.key.keysym.sym = SDLK_F5;
diff --git a/backends/events/gph/gph-events.cpp b/backends/events/gph/gph-events.cpp
index 674326501f..32332db2f5 100644
--- a/backends/events/gph/gph-events.cpp
+++ b/backends/events/gph/gph-events.cpp
@@ -379,12 +379,7 @@ bool GPHEventSource::handleJoyButtonDown(SDL_Event &ev, Common::Event &event) {
case BUTTON_R:
event.type = Common::EVENT_KEYDOWN;
if (_buttonStateL == true) {
-#ifdef ENABLE_VKEYBD
event.type = Common::EVENT_VIRTUAL_KEYBOARD;
-#else
- event.kbd.keycode = Common::KEYCODE_0;
- event.kbd.ascii = mapKey(SDLK_0, ev.key.keysym.mod, 0);
-#endif
} else {
event.kbd.keycode = Common::KEYCODE_RETURN;
event.kbd.ascii = mapKey(SDLK_RETURN, ev.key.keysym.mod, 0);
@@ -529,13 +524,8 @@ bool GPHEventSource::handleJoyButtonUp(SDL_Event &ev, Common::Event &event) {
case BUTTON_R:
event.type = Common::EVENT_KEYUP;
if (_buttonStateL == true) {
-#ifdef ENABLE_VKEYBD
event.kbd.keycode = Common::KEYCODE_F7;
event.kbd.ascii = mapKey(SDLK_F7, ev.key.keysym.mod, 0);
-#else
- event.kbd.keycode = Common::KEYCODE_0;
- event.kbd.ascii = mapKey(SDLK_0, ev.key.keysym.mod, 0);
-#endif
} else {
event.kbd.keycode = Common::KEYCODE_RETURN;
event.kbd.ascii = mapKey(SDLK_RETURN, ev.key.keysym.mod, 0);
diff --git a/backends/events/samsungtvsdl/samsungtvsdl-events.cpp b/backends/events/samsungtvsdl/samsungtvsdl-events.cpp
index 61499b566d..60ab4b8c88 100644
--- a/backends/events/samsungtvsdl/samsungtvsdl-events.cpp
+++ b/backends/events/samsungtvsdl/samsungtvsdl-events.cpp
@@ -38,10 +38,8 @@ bool SamsungTVSdlEventSource::remapKey(SDL_Event &ev, Common::Event &event) {
event.kbd.ascii = Common::ASCII_F5;
return true;
} else if (ev.key.keysym.sym == SDLK_F2 && ev.key.keysym.scancode == 21) {
-#ifdef ENABLE_VKEYBD
event.type = Common::EVENT_VIRTUAL_KEYBOARD;
return true;
-#endif
}
break;
}
diff --git a/backends/keymapper/keymapper.cpp b/backends/keymapper/keymapper.cpp
index ab7137d4ea..e27c620ca1 100644
--- a/backends/keymapper/keymapper.cpp
+++ b/backends/keymapper/keymapper.cpp
@@ -384,7 +384,6 @@ HardwareInput Keymapper::findHardwareInput(const Event &event) {
void Keymapper::hardcodedEventMapping(Event ev) {
// TODO: Either add support for long presses to the keymapper
// or move this elsewhere as an event observer + source
-#ifdef ENABLE_VKEYBD
// Trigger virtual keyboard on long press of more than 1 second
// of middle mouse button.
const uint32 vkeybdTime = 1000;
@@ -404,7 +403,6 @@ void Keymapper::hardcodedEventMapping(Event ev) {
_delayedEventSource->scheduleEvent(vkeybdEvent, 100);
}
}
-#endif
}
void Keymapper::resetInputState() {
diff --git a/common/events.h b/common/events.h
index d6e9c2caa6..69413e80e7 100644
--- a/common/events.h
+++ b/common/events.h
@@ -89,9 +89,7 @@ enum EventType {
EVENT_CUSTOM_ENGINE_ACTION_START = 20,
EVENT_CUSTOM_ENGINE_ACTION_END = 21,
-#ifdef ENABLE_VKEYBD
EVENT_VIRTUAL_KEYBOARD = 22,
-#endif
EVENT_DROP_FILE = 23,
Commit: dd1bf34f180be48fc12008db23cf2857a081df81
https://github.com/scummvm/scummvm/commit/dd1bf34f180be48fc12008db23cf2857a081df81
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2021-11-01T16:54:39+01:00
Commit Message:
BACKENDS: Hide the virtual keyboard action when one isn't available
Changed paths:
backends/events/default/default-events.cpp
diff --git a/backends/events/default/default-events.cpp b/backends/events/default/default-events.cpp
index b1d09414f3..4c06bde9d7 100644
--- a/backends/events/default/default-events.cpp
+++ b/backends/events/default/default-events.cpp
@@ -340,11 +340,16 @@ Common::Keymap *DefaultEventManager::getGlobalKeymap() {
act->setEvent(EVENT_MAINMENU);
globalKeymap->addAction(act);
- act = new Action("VIRT", _("Display keyboard"));
- act->addDefaultInputMapping("C+F7");
- act->addDefaultInputMapping("JOY_BACK");
- act->setEvent(EVENT_VIRTUAL_KEYBOARD);
- globalKeymap->addAction(act);
+#ifndef ENABLE_VKEYBD
+ if (g_system->hasFeature(OSystem::kFeatureVirtualKeyboard))
+#endif
+ {
+ act = new Action("VIRT", _("Display keyboard"));
+ act->addDefaultInputMapping("C+F7");
+ act->addDefaultInputMapping("JOY_BACK");
+ act->setEvent(EVENT_VIRTUAL_KEYBOARD);
+ globalKeymap->addAction(act);
+ }
act = new Action("MUTE", _("Toggle mute"));
act->addDefaultInputMapping("C+u");
More information about the Scummvm-git-logs
mailing list