[Scummvm-git-logs] scummvm master -> 0155bb06af8f5a590da1ff1eb9ebe4464973966f
bgK
bastien.bouclet at gmail.com
Tue Sep 15 20:43:00 UTC 2020
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:
a977dfb2d1 KEYMAPPER: Enable the GUI keymaps while the virtual keyboard is visible
0155bb06af KEYMAPPER: Fix comparing mappings for equality
Commit: a977dfb2d17555b46d7992f1f0167c25a33a42a0
https://github.com/scummvm/scummvm/commit/a977dfb2d17555b46d7992f1f0167c25a33a42a0
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2020-09-15T22:42:34+02:00
Commit Message:
KEYMAPPER: Enable the GUI keymaps while the virtual keyboard is visible
Changed paths:
backends/keymapper/keymapper.h
backends/vkeybd/virtual-keyboard.cpp
diff --git a/backends/keymapper/keymapper.h b/backends/keymapper/keymapper.h
index 60ca0912a2..6cb115d941 100644
--- a/backends/keymapper/keymapper.h
+++ b/backends/keymapper/keymapper.h
@@ -106,6 +106,7 @@ public:
* Keymaps with the global type are always enabled
*/
void setEnabledKeymapType(Keymap::KeymapType type);
+ Keymap::KeymapType enabledKeymapType() const { return _enabledKeymapType; }
/**
* Enable/disable the keymapper
@@ -159,6 +160,27 @@ private:
void resetInputState();
};
+/**
+ * RAII helper to temporarily enable a keymap type
+ */
+class KeymapTypeEnabler {
+public:
+ KeymapTypeEnabler(Keymapper *keymapper, Keymap::KeymapType keymapType) :
+ _keymapper(keymapper) {
+ assert(keymapper);
+ _previousKeymapType = keymapper->enabledKeymapType();
+ keymapper->setEnabledKeymapType(keymapType);
+ }
+
+ ~KeymapTypeEnabler() {
+ _keymapper->setEnabledKeymapType(_previousKeymapType);
+ }
+
+private:
+ Keymapper *_keymapper;
+ Keymap::KeymapType _previousKeymapType;
+};
+
class DelayedEventSource : public EventSource {
public:
// EventSource API
diff --git a/backends/vkeybd/virtual-keyboard.cpp b/backends/vkeybd/virtual-keyboard.cpp
index 267448c859..74cf1f2631 100644
--- a/backends/vkeybd/virtual-keyboard.cpp
+++ b/backends/vkeybd/virtual-keyboard.cpp
@@ -26,6 +26,8 @@
#include "backends/vkeybd/virtual-keyboard.h"
+#include "backends/keymapper/keymapper.h"
+#include "backends/keymapper/keymap.h"
#include "backends/vkeybd/virtual-keyboard-gui.h"
#include "backends/vkeybd/virtual-keyboard-parser.h"
#include "backends/vkeybd/keycode-descriptions.h"
@@ -230,7 +232,11 @@ void VirtualKeyboard::show() {
}
switchMode(_initialMode);
- _kbdGUI->run();
+
+ {
+ KeymapTypeEnabler guiKeymap(_system->getEventManager()->getKeymapper(), Keymap::kKeymapTypeGui);
+ _kbdGUI->run();
+ }
if (_submitKeys) {
EventManager *eventMan = _system->getEventManager();
Commit: 0155bb06af8f5a590da1ff1eb9ebe4464973966f
https://github.com/scummvm/scummvm/commit/0155bb06af8f5a590da1ff1eb9ebe4464973966f
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2020-09-15T22:42:34+02:00
Commit Message:
KEYMAPPER: Fix comparing mappings for equality
Fixes clearing default action mappings.
Changed paths:
backends/keymapper/keymap.cpp
diff --git a/backends/keymapper/keymap.cpp b/backends/keymapper/keymap.cpp
index 2d41247336..665d5aafde 100644
--- a/backends/keymapper/keymap.cpp
+++ b/backends/keymapper/keymap.cpp
@@ -359,10 +359,12 @@ bool Keymap::areMappingsIdentical(const Array<HardwareInput> &mappingsA, const S
// Assumes array values are not duplicated, but registerMapping and addDefaultInputMapping ensure that
uint foundCount = 0;
+ uint validDefaultMappings = 0;
for (uint i = 0; i < mappingsB.size(); i++) {
// We resolve the hardware input to make sure it is not a default for some hardware we don't have currently
HardwareInput mappingB = _hardwareInputSet->findHardwareInput(mappingsB[i]);
if (mappingB.type == kHardwareInputTypeInvalid) continue;
+ validDefaultMappings++;
for (uint j = 0; j < mappingsA.size(); j++) {
if (mappingsA[j].id == mappingB.id) {
@@ -372,7 +374,7 @@ bool Keymap::areMappingsIdentical(const Array<HardwareInput> &mappingsA, const S
}
}
- return foundCount == mappingsA.size();
+ return foundCount == mappingsA.size() && foundCount == validDefaultMappings;
}
} // End of namespace Common
More information about the Scummvm-git-logs
mailing list