fix(input): Keep modifier combos from sticking when keys are released out of order - #3233
Conversation
… out of order Signed-off-by: Jacob Ledbetter <jledbetter460@gmail.com>
PR Summary by QodoPrevent stuck modifier combos on out-of-order key releases
AI Description
Diagram
High-Level Assessment
Files changed (6)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can reply 'qodo' on any finding to push back, ask questions, or dig deeper |
|
| Filename | Overview |
|---|---|
| Core/GameEngine/Source/GameClient/Input/Keyboard.cpp | Tracks modifier provenance per key and synthesizes modifier releases during keyboard resets. |
| Core/GameEngine/Source/GameClient/MessageStream/HotKey.cpp | Prevents key releases associated with modifier combinations from executing plain GUI hotkeys. |
| Core/GameEngine/Include/GameClient/Keyboard.h | Adds per-key modifier provenance storage and declares generalized modifier-release handling. |
| Generals/Code/GameEngine/Include/GameClient/KeyDefs.h | Adds the modifier-on-down event-state flag for the Generals variant. |
| GeneralsMD/Code/GameEngine/Include/GameClient/KeyDefs.h | Adds the matching modifier-on-down event-state flag for the Zero Hour variant. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
Down[Key-down event] --> Capture[Capture current modifier state]
Capture --> Store[Store modifier-on-down by key]
Store --> Repeat[Apply provenance to autorepeat]
Store --> Up[Matching key-up event]
Up --> Carry[Attach stored modifier provenance]
Carry --> Hotkey{Modifier-associated release?}
Hotkey -- Yes --> Ignore[Skip plain GUI hotkey]
Hotkey -- No --> Execute[Evaluate plain GUI hotkey]
Focus[Focus loss or device reset] --> Synthetic[Synthesize held modifier key-ups]
Synthetic --> Modes[End modifier-controlled modes]
Reviews (4): Last reviewed commit: "Fix modifier state tracking for hotkey r..." | Re-trigger Greptile
HotKey.h referenced KeyDefType/KEY_COUNT without the key header, and MetaEvent.cpp called a reset helper that was never declared. Co-authored-by: Cursor <cursoragent@cursor.com>
xezon
left a comment
There was a problem hiding this comment.
I assume this was entirely generated by LLM? It looks like slop the way the new logic is laid out. It is incomprehensible and unmaintainable. It needs to be unsloppified.
Keep the GUI-hotkey and focus-loss behavior, but store the modifier-down flag on HotKeyTranslator itself and reuse the existing alt-tab key-up path for CTRL and SHIFT. Co-authored-by: Cursor <cursoragent@cursor.com>
|
How do we know the new generated revision is no slop? |
|
Fair criticism. I used LLM assistance on the first pass, and I should have reviewed and simplified the result before asking you to review it. I own that. I’ve since rewritten the fix. The hotkey translator is stateless now. Modifier press state lives in |
In collaboration with DrGoldFish - thank you for reporting the issue and testing my fixes