[Scummvm-git-logs] scummvm master -> 8ffd7fdf586afd2da3e623461125b8a5a2546a39
bluegr
noreply at scummvm.org
Sun Jul 13 23:14:57 UTC 2025
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
8ffd7fdf58 KEYMAPPER: Add keymap option for allowing patial matching.
Commit: 8ffd7fdf586afd2da3e623461125b8a5a2546a39
https://github.com/scummvm/scummvm/commit/8ffd7fdf586afd2da3e623461125b8a5a2546a39
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2025-07-14T02:14:52+03:00
Commit Message:
KEYMAPPER: Add keymap option for allowing patial matching.
In previous code partial match would always be allowed, but this hides intended inputs for engines that neither define their own keymaps nor disable them on text input. The fallback engine-default keymap will no longer match partial inputs.
Changed paths:
backends/keymapper/keymap.cpp
backends/keymapper/keymap.h
engines/metaengine.cpp
diff --git a/backends/keymapper/keymap.cpp b/backends/keymapper/keymap.cpp
index 289c1d513ec..082bbbcc5ec 100644
--- a/backends/keymapper/keymap.cpp
+++ b/backends/keymapper/keymap.cpp
@@ -36,6 +36,7 @@ Keymap::Keymap(KeymapType type, const String &id, const U32String &description)
_type(type),
_id(id),
_description(description),
+ _partialMatchAllowed(true),
_enabled(true),
_configDomain(nullptr),
_hardwareInputSet(nullptr),
@@ -47,6 +48,7 @@ Keymap::Keymap(KeymapType type, const String &id, const String &description) :
_type(type),
_id(id),
_description(U32String(description)),
+ _partialMatchAllowed(true),
_enabled(true),
_configDomain(nullptr),
_hardwareInputSet(nullptr),
@@ -145,7 +147,7 @@ Keymap::KeymapMatch Keymap::getMappedActions(const Event &event, ActionArray &ac
return kKeymapMatchExact;
}
- if (normalizedKeystate.flags & KBD_NON_STICKY) {
+ if (_partialMatchAllowed && normalizedKeystate.flags & KBD_NON_STICKY) {
// If no matching actions and non-sticky keyboard modifiers are down,
// check again for matches without the exact keyboard modifiers
for (const auto &itInput : _hwActionMap) {
diff --git a/backends/keymapper/keymap.h b/backends/keymapper/keymap.h
index a400242c404..24f85b7e1ec 100644
--- a/backends/keymapper/keymap.h
+++ b/backends/keymapper/keymap.h
@@ -158,6 +158,9 @@ public:
const U32String &getDescription() const { return _description; }
KeymapType getType() const { return _type; }
+ bool isPartialMatchAllowed() const { return _partialMatchAllowed; }
+ void setPartialMatchAllowed(bool partialMatchAllowed) { _partialMatchAllowed = partialMatchAllowed; }
+
/**
* Defines if the keymap is considered when mapping events
*/
@@ -181,7 +184,7 @@ private:
KeymapType _type;
String _id;
U32String _description;
-
+ bool _partialMatchAllowed;
bool _enabled;
ActionArray _actions;
diff --git a/engines/metaengine.cpp b/engines/metaengine.cpp
index 2be50081a56..c8319ba5323 100644
--- a/engines/metaengine.cpp
+++ b/engines/metaengine.cpp
@@ -74,6 +74,9 @@ Common::KeymapArray MetaEngine::initKeymaps(const char *target) const {
Keymap *engineKeyMap = new Keymap(Keymap::kKeymapTypeGame, "engine-default", _("Default game keymap"));
+ // Default keymap for engines should not match partial as it may hide intended input handling.
+ engineKeyMap->setPartialMatchAllowed(false);
+
Action *act;
act = new Action(kStandardActionLeftClick, _("Left click"));
More information about the Scummvm-git-logs
mailing list