From e0f6cb2cbdf16ed6bf8d4980863db96de464a0d9 Mon Sep 17 00:00:00 2001 From: bicarus <202771338+bicarus-dev@users.noreply.github.com> Date: Fri, 3 Apr 2026 20:22:24 -0700 Subject: [PATCH] api: dump key binding strings (#606) Print out human readable text for vKey when dumping bindings. --- src/spice2x/cfg/button.cpp | 2 ++ src/spice2x/cfg/button.h | 10 +++++++++- src/spice2x/launcher/launcher.cpp | 30 ++++++++++++++++++++---------- 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/src/spice2x/cfg/button.cpp b/src/spice2x/cfg/button.cpp index 95b5cc7..9dfd54e 100644 --- a/src/spice2x/cfg/button.cpp +++ b/src/spice2x/cfg/button.cpp @@ -278,6 +278,8 @@ std::string Button::getVKeyString() { return "Left Alt"; case 0xA5: return "Right Alt"; + case INVALID_VKEY: + return "Invalid"; default: // check win API diff --git a/src/spice2x/cfg/button.h b/src/spice2x/cfg/button.h index 1a2fc0d..4089190 100644 --- a/src/spice2x/cfg/button.h +++ b/src/spice2x/cfg/button.h @@ -83,12 +83,20 @@ public: if (this->override_enabled) { return true; } + + // has a device + if (!this->device_identifier.empty()) { + return true; + } + + // naive, and has a valid vKey if (this->vKey != INVALID_VKEY) { return true; } for (auto &alternative : this->alternatives) { - if (alternative.vKey != INVALID_VKEY) { + if (!alternative.getDeviceIdentifier().empty() || + alternative.getVKey() != INVALID_VKEY) { return true; } } diff --git a/src/spice2x/launcher/launcher.cpp b/src/spice2x/launcher/launcher.cpp index 9693bd5..89a894b 100644 --- a/src/spice2x/launcher/launcher.cpp +++ b/src/spice2x/launcher/launcher.cpp @@ -2569,9 +2569,10 @@ void dump_button_bindings(std::vector