Skip to content

fix(viewer): don't fire the modifier-chord release hotkey mid-shortcut - #3

Open
Phaengris wants to merge 1 commit into
thelicato:mainfrom
Phaengris:fix-modifier-chord-release
Open

fix(viewer): don't fire the modifier-chord release hotkey mid-shortcut#3
Phaengris wants to merge 1 commit into
thelicato:mainfrom
Phaengris:fix-modifier-chord-release

Conversation

@Phaengris

Copy link
Copy Markdown

Standalone bugfix off main, independent of #1/#2 (the same commit rides along in #2; whichever lands first, I'll rebase the other).

The bug: the default release-cursor binding (Ctrl+Alt) fires the moment the chord is completed on key press — making it the prefix of every Ctrl+Alt+<key> guest shortcut. Pressing e.g. Ctrl+Alt+Arrow (tmux pane splitting) drops the grab mid-combo: the remaining key goes nowhere and keyboard input appears frozen until a click re-arms the grab. Repeated combos can also lose release events, leaving the guest with a stuck modifier that autorepeats the last chord.

The fix:

  • Modifier-only chords now arm on press and fire only when a chord key is released with no other key pressed in between (virt-viewer semantics). Ctrl+Alt+<key> shortcuts pass through to the guest; a deliberate press-and-release of the bare chord still releases the grab. Key+modifier bindings (e.g. release-cursor=ctrl+q) keep firing on press.
  • Added a modifier reconciliation net: whenever GTK's modifier state shows a modifier is up while we still track it as pressed (its release event was lost to grab churn or compositor focus flicker), the release is forwarded to the guest instead of leaving the modifier stuck.

cargo fmt --check clean, cargo test --offline passes (52 tests, 2 new).

🤖 Generated with Claude Code

The default release-cursor binding (Ctrl+Alt) fired the moment the chord
was completed on key PRESS — making it the prefix of every Ctrl+Alt+<key>
guest shortcut: the grab dropped mid-combo, the remaining key went
nowhere, and keyboard input appeared frozen until a click re-armed the
grab. Modifier-only chords now arm on press and fire only when a chord
key is RELEASED with no other key pressed in between (virt-viewer
semantics); key+modifier bindings keep firing on press.

Also add a modifier reconciliation net: when GTK's modifier state shows a
modifier is up but we still track it as pressed (its release event was
lost to grab churn or compositor focus flicker), release it in the guest
instead of leaving it stuck repeating the last chord.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant