Repository navigation
native2: modifier click checks held input at the hardware level and names it (#198) - #213
Merged
Merged
Conversation
iamnbutler
force-pushed
the
fix-modclick-held
branch
7 times, most recently
from
October 25, 2026 01:12
5cffeb1 to
32b4b24
Compare
…ames it (#198) The held-input check read the combined session state, which also keeps keys and buttons posted down to the session and never released, or whose release a secure field swallowed, until they are pressed again; every modifier click was then refused while nothing was held. Read held keys and buttons from the HID state, and name what is held in the refusal. Fixes #198 Why: native2/Sources/DesktopMac/ForegroundPointer.swift#current | held keys and buttons come from hidSystemState; combinedSessionState keeps stale session-posted downs, which refused every modifier click (#198)
iamnbutler
force-pushed
the
fix-modclick-held
branch
from
October 25, 2026 01:25
32b4b24 to
ad9d32f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #198
Root cause (likely). The held-input check read
combinedSessionState, which also keeps keys and buttons that some process posted down to the session and never released, or whose release was swallowed (e.g. by a secure field), until they are pressed again. Such a stale "down" refuses every modifier click while nothing is held. I couldn't reproduce a stuck key on this Mac (posting to a pid, through SkyLight, or our own shift down/up all leave the state clean), so the refusal now also names what it found, so a recurrence says which key.Fix (
DesktopMac/ForegroundPointer.swift): held keys and buttons are read fromhidSystemState(physically held); the activity counters still come from the combined state. The refusal reads e.g. "…but the keyboard and mouse report Shift (key 56) held.", and the hint says to press and release it once if nothing is held.Checked. Unit tests in
HeldInputTestscover the naming;swift testpasses. I didn't run a live modifier click, because it activates the app and takes the user's focus.