-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Summary
When the user quickly presses and releases the opposite-side Ctrl key (e.g., taps Right Ctrl while Left Ctrl is already held), the app seems to lose track of the fact that a Ctrl key is still physically held down. This causes the hotkey check to temporarily think no Ctrl is pressed at all, which paradoxically prevents accidental activation when an extra modifier (Alt, Shift, etc.) is later added — effectively working around the previous “extra modifiers still trigger” bug (#3) in a completely broken and unreliable way.
Expected Behavior
The hotkey (e.g., Ctrl + D) should only trigger when:
- At least one Ctrl key is held, and
- The exact registered modifiers are active, and
- No extra modifiers (Shift, Alt, Win) are held.
The detection must be based on physical key state, not on press/release events of individual L/R keys. Tapping the opposite-side Ctrl key must never make the app think “Ctrl is no longer held”.
Actual Behavior (weird and flaky)
- Registered hotkey = Ctrl + D
- User does the following sequence:
- Press and hold Left Ctrl
- Quickly press and release Right Ctrl (while Left Ctrl is still down)
- Press and hold Alt (or Shift, or any unrelated modifier)
- Press D
- → Overlay does NOT activate (which looks correct at first glance!)
- However, if the user skips step 2 (never taps the opposite Ctrl), then Ctrl + Alt + D does activate the overlay — which is the original bug BUG: Hotkey triggers with extra modifiers (Ctrl+Shift+D activates when only Ctrl+D is registered) #3.
In other words, rapidly tapping the unused Ctrl key “fixes” the extra-modifier bug by accidentally making the app think Ctrl was released entirely.
Steps to Reproduce
- Set hotkey to Ctrl + D
- Hold Left Ctrl
- While still holding Left Ctrl, quickly tap and release Right Ctrl
- Now hold Alt (or Shift)
- Press D → overlay does not activate (seems correct)
- Restart the sequence but skip step 3 → Ctrl + Alt + D now activates (incorrect, same as issue BUG: Hotkey triggers with extra modifiers (Ctrl+Shift+D activates when only Ctrl+D is registered) #3)
Environment
- Windows 10/11
- Seen on all tested keyboards (104-key, laptop, ergonomic)
Root Cause (almost certainly)
The app could be tracking modifier state by counting individual L/R key presses and releases instead of reading the real-time physical state with GetAsyncKeyState(VK_CONTROL) or GetKeyState(VK_CONTROL).
Example of buggy logic:
if (key == VK_RCONTROL) { if (down) rctrl_count++; else rctrl_count--; }
if (key == VK_LCONTROL) { if (down) lctrl_count++; else lctrl_count--; }
bool ctrl_is_down = (lctrl_count + rctrl_count) > 0; // ← broken