Skip to content

native2: modifier click checks held input at the hardware level and names it (#198) - #213

Merged
iamnbutler merged 2 commits into
mainfrom
fix-modclick-held
Oct 25, 2026
Merged

iamnbutler merged 2 commits into
mainfrom
fix-modclick-held

Conversation

@iamnbutler

Copy link
Copy Markdown
Contributor

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 from hidSystemState (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 HeldInputTests cover the naming; swift test passes. I didn't run a live modifier click, because it activates the app and takes the user's focus.

@iamnbutler
iamnbutler force-pushed the fix-modclick-held branch 7 times, most recently from 5cffeb1 to 32b4b24 Compare October 25, 2026 01:12
…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
iamnbutler merged commit 17d7fcb into main Oct 25, 2026
2 checks passed
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.

Modifier-click refused for held input when nothing is held

1 participant