control-channel: userActive is the SendAwakeBeat test, not a time window

QA finding 3. `tick` computed `userActive` as "input within the last
heartbeat interval". `SendAwakeBeat` instead sends `Awake` when
`lastRealInputEventCount != Event.RealInputEventCount` — real input since
the previous heartbeat — and re-records the counter every time it runs
(Common.cs:545-558). Keep the same two counters: `noteUserActivity()` is
`Event.RealInputEventCount++` (InputHook.cs:223, 345) and the channel
re-records on its own heartbeat boundary, which is the one global beat
Windows's 100 ms timer runs for every socket (frmScreen.cs:565-575).

Also fixes the stale citation for this rule in docs/protocol.md §3.3,
which pointed at SendHeartBeat/screen-capture code (Common.cs:499-513,
662-676) instead of SendAwakeBeat.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
lucioandClaude Opus 5 committed 2026-09-16 01:41:41 -07:00
1 parent c9ea89ac50
commit a892af6ca3
3 files changed
+33 -8

No files matched your search

+9 -3
View File
@@ -215,10 +215,16 @@ Status colours are in `doc/devdocs/modules/mousewithoutborders.md`.
### 3.3 Liveness
- Heartbeat from the 100 ms UI timer (`frmScreen.cs:285-288, 566-575`):
- Heartbeat from the 100 ms UI timer (`frmScreen.cs:285-288, 565-575`):
every 60 s when `BlockScreenSaver` is on, else every 300 s.
`Awake (21)` if the user was recently active, else `Heartbeat (20)`
(`Common.cs:499-513, 662-676`).
`Awake (21)` if real input happened since the previous heartbeat, else
`Heartbeat (20)` — `SendAwakeBeat` compares `lastRealInputEventCount !=
Event.RealInputEventCount` and re-records the counter every time it runs
(`Common.cs:542-559`), so this is a since-the-last-beat test, not a
sliding window. The counter is bumped by the input hook
(`Event.cs:51-55`, `InputHook.cs:223, 345`). `Awake` also requires
`BlockScreenSaver`, `IsMyDesktopActive()` and neither the logon nor the
screen-saver desktop (`Common.cs:547-548`).
- Key propagation chain during pairing: `Heartbeat_ex (51)` → receiver
adopts key, replies `Heartbeat_ex_l2 (52)` → `Heartbeat_ex_l3 (53)`
(`Receiver.cs:210-243`). *Port decision: not implemented in M2; the