input-inject: record why the lock hotkey's desktop gate is N/A (QA finding 2)

Windows wraps the `HotKeyLockMachine` branch in
`if (!Common.RunOnLogonDesktop && !Common.RunOnScrSaverDesktop)`
(`InputSimulation.cs:408-409`); `KeyState.processDown` has no such
guard, and nothing said whether that was considered or missed.

Both flags are set only where the MWB service launches a second copy of
the process onto the `Winlogon` or `Screen-saver` secure desktop
(`Program.cs:150-167`, `Common.cs:176-186`). macOS has no secure-desktop
session split, no copy of us behind `loginwindow` or the screen saver,
and a user-space `CGEventTap` neither receives nor posts once the screen
is locked; the Windows service is out of scope besides (README D6). So
the condition is unconditionally true for a Mac receiver and the
always-eat-and-lock behaviour is the faithful port.

Recorded as docs/protocol.md 10.5 note 8 (appended, so the note numbers
existing citations use stay stable), as a feature README Assumptions
bullet, and as a comment at the site in `KeyState.processDown`. No
behaviour change.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
lucioandClaude Opus 5 committed 2026-09-16 03:06:27 -07:00
1 parent 3ea50a7ae3
commit 9a1ad519de
3 files changed
+46

No files matched your search

+6
View File
@@ -162,6 +162,12 @@ public struct KeyState: Sendable {
// through the switch. Both paths lock, so the duplication is harmless.
private mutating func processDown(vk: Int32, lockMachine: Hotkey) -> KeyDecision {
var decision = KeyDecision.inject
// No equivalent of Windows' `if (!Common.RunOnLogonDesktop &&
// !Common.RunOnScrSaverDesktop)` (`InputSimulation.cs:408-409`): those
// flags are set only for the copy the MWB service runs on a secure
// desktop (`Program.cs:150-167`), which macOS has no analogue of and
// which is out of scope anyway (README D6, docs/protocol.md §10.5
// note 8). The gate is unconditionally open here, deliberately.
if lockMachine.matches(vk: vk, modifiers: chord) {
resetChord(keeping: lockMachine) // ResetModifiersState, :364-370
decision = KeyDecision(eatKey: true, releaseAllKeys: true, lockMachine: true)