From 1c3f129fdd35c431bae53bfe7a807b4b74280dc3 Mon Sep 17 00:00:00 2001 From: Fellippe Heitor Date: Sat, 31 Oct 2026 11:34:06 -0300 Subject: [PATCH] Report Cmd+key combos in _KEYHIT (macOS) Printable keys wait for the OS character event before being reported. macOS never sends one for Cmd+key (it is a shortcut, not text), so the pending key was discarded and only the Cmd press/release reached _KEYHIT. Treat Super like Ctrl and report the base key immediately. Co-Authored-By: Claude Opus 5.5 --- internal/c/libqb/src/keyboard.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/c/libqb/src/keyboard.cpp b/internal/c/libqb/src/keyboard.cpp index 6d6df1c5f..75b33f443 100644 --- a/internal/c/libqb/src/keyboard.cpp +++ b/internal/c/libqb/src/keyboard.cpp @@ -2425,7 +2425,10 @@ void GLUT_KEYBOARD_BUTTON_FUNC(GLUTEmu_KeyboardKey key, int scancode, GLUTEmu_Bu const bool isNumLock = bool(modifiers & GLUTEmu_KeyboardKeyModifier::NumLock); const bool isShift = bool(modifiers & GLUTEmu_KeyboardKeyModifier::Shift); - const bool isControl = bool(modifiers & GLUTEmu_KeyboardKeyModifier::Control); + // Super (Command on macOS) is treated like Ctrl here: the OS does not produce a character + // for Super+key (macOS treats Cmd+key as a shortcut, not text), so waiting for a character + // callback would silently drop the key. Use the base key value instead, just like Ctrl+key. + const bool isControl = bool(modifiers & (GLUTEmu_KeyboardKeyModifier::Control | GLUTEmu_KeyboardKeyModifier::Super)); const bool isAlt = bool(modifiers & GLUTEmu_KeyboardKeyModifier::Alt); const bool isCapsLock = bool(modifiers & GLUTEmu_KeyboardKeyModifier::CapsLock); const bool useKeypadNumber = isNumLock && !isShift;