extras: protocol §10.8, feature README, TODO §9

§10.8 records seven findings with citations: the Awake receiver honours
the sender's setting and pokes itself with a mouse jiggle; the fullscreen
rule is asked once, only by the pointer's owner; the excluded-apps list
matches two spellings of the image name; DrawMouseCursor only draws when
the real cursor is suppressed; BlockMouseAtCorners is a 100 px square
around every monitor corner; relative mode moves edge detection to the
controlled machine and gates NextMachine on IsSwitchingByMouseEnabled;
both edge paths set HasSwitchedMachineSinceLastCopy.

README: Assumptions confirmed, Handshakes updated to the shipped API with
four deviations, two open requests (input-capture's easyMouseKeyDown,
clipboard's HasSwitchedMachineSinceLastCopy) and the three provisional
lines taken in ClipboardBridge.swift, Status ticked, Work log with the
corners/relative-mode reading trace.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
lucioandClaude Opus 5 committed 2026-09-16 05:29:33 -07:00
1 parent 21c886165e
commit 39df560fcd
3 files changed
+449 -78

No files matched your search

+105
View File
@@ -1068,3 +1068,108 @@ sees them. One subsection per lane, appended, never rewritten.
**not** exempt from the replay ring, so exactly one terminator arrives; a
copy that arrives wholly after the terminator starts a reassembly that can
never finish and is dropped by the idle timeout.
### 10.8 extras (2026-09-16)
1. **The `Awake (21)` receiver has no setting of its own; it pokes the
*machine*, not the network.** `Receiver.cs:244-249` answers `Awake` with
`AddToMachinePool` plus `Common.HumanBeingDetected()`, and that method
(`Common.cs:561-572`) consults nothing but `lastInputEventCount`,
`RunOnLogonDesktop`, `RunOnScrSaverDesktop` and `IsMyDesktopActive()` — never
`BlockScreenSaver`. The setting is the *sender's*
(`SendAwakeBeat`, `Common.cs:545-559`, which needs it to send `Awake` at all
rather than `Heartbeat`), so a receiver honours a peer's wish
unconditionally. What the receiver then does is `PokeMyself()`
(`Common.cs:574-591`): ten ±9-pixel *relative mouse moves*, 50 ms apart,
abandoned early if the local user moves — a jiggle, because resetting the
Windows idle timer from user mode means faking input. Two consequences for
the port: the counter `lastInputEventCount` is shared with `SendAwakeBeat`
(`Common.cs:542-543, 557-559`), so a machine whose own user is busy never
pokes itself; and the mac port cannot copy the mechanism at all — CLAUDE.md
invariant 5 forbids posting input — so it renews an
`IOPMAssertionTypePreventUserIdleDisplaySleep` assertion with a 90 s
`kIOPMAssertionTimeoutKey` instead, which is the effect Windows is reaching
for and lapses by itself when the 60 s beats stop (§3.3).
2. **The fullscreen rule is asked in exactly one place, and only by the machine
that owns the pointer.** `Common.IsEasyMouseSwitchAllowed`
(`Common.cs:1638-1650`) has two early outs — the setting being off, and
`DesMachineID != MachineID` ("never prevent a switch if we are not moving out
of the host machine") — and its only caller is `Event.cs:79`, on the
controller's edge path, *after* `MoveToMyNeighbourIfNeeded` has already said a
switch would happen. The relative-mode path on the controlled machine
(`Receiver.cs:156-170`) never consults it, and neither does the `NextMachine`
handler (`:195-201`). So a full-screen app on a machine that is *being
controlled* blocks nothing, and a blocked switch still updates
`Common.LastX`/`LastY` (`MachineStuff.cs:207-215`) because the geometry ran
first.
3. **The excluded-apps list is matched twice, against two spellings of the
process image.** `IsAppIgnoredByEasyMouseFullscreenCheck`
(`Common.cs:1567-1600`) resolves the foreground window's process to a full
image path with `QueryFullProcessImageName` and then tests the set for both
`Path.GetFileNameWithoutExtension(name)` and `Path.GetFileName(name)` with
`StringComparer.OrdinalIgnoreCase` — so `msedge` and `msedge.exe` both work,
in any case. The mac port keeps that shape by testing the frontmost app's
bundle identifier, its localized name, and its bundle's file name with and
without the `.app` extension. The fullscreen question itself is
`SHQueryUserNotificationState` on Windows (BUSY, RUNNING_D3D_FULL_SCREEN or
PRESENTATION_MODE, `Common.cs:1618-1624`); macOS has no such call, so the port
asks whether the frontmost app has an on-screen `kCGWindowLayer == 0` window
whose bounds equal a display's — a zoomed window stops below the menu bar and
a native full-screen one does not.
4. **`DrawMouseCursor` only draws when the real cursor is already gone.**
`CustomCursor.ShowFakeMouseCursor` (`CustomCursor.cs:71-146`) checks
`Setting.Values.DrawMouse` *and* `GetCursorInfo(out ci)` with `ci.flags != 1`
— "the cursor is hidden or suppressed" — and when the real cursor is visible
it closes and disposes the form instead. The feature exists for Windows 10+
machines with no physical mouse attached, where the injected `SendInput` moves
do not light the cursor up. `int.MinValue` in either coordinate means hide,
via a three-call latch (`hiding = 3`, decremented per call, `:88-96`), and the
form is a 32×32 top-most window placed at `(x + 1, y + 1)` (`:100-103`). It is
fed from `Receiver.cs:186-188` — inject, `GetCursorPos` into
`Common.LastX/LastY`, draw — and cleared from `Common.HideMouseCursor`
(`Common.cs:1495`), the three `Helper` form routines (`Helper.cs:192, 224,
244`) and the mouse hook when the local user moves (`InputHook.cs:256-264`,
where `local` means `NewDesMachineID` is us or `ALL`). On a Mac the injected
`CGEvent` moves *do* move the visible pointer, so the port has no equivalent
of the `ci.flags` gate and the overlay is a second marker rather than a
replacement; `DrawMouseEx`, which paints pixels straight onto the desktop DC
(`frmMouseCursor.cs:32-52`), is accepted and ignored.
5. **`BlockMouseAtCorners` is a 100-pixel square, not a radius, around all four
corners of every monitor.** The test is
`Math.Abs(p.X - x) < 100 && Math.Abs(p.Y - y) < 100` over `WinAPI.
SensitivePoints` (`MachineStuff.cs:222-234`), and that list is rebuilt by
`GetScreenConfig`'s monitor enumeration as
`(Left,Top) (Right,Top) (Right,Bottom) (Left,Bottom)` per monitor
(`WinAPI.cs:104-109`) — exclusive right and bottom, like `CGDisplayBounds`.
The check sits between the debounce and the edge comparisons, so it suppresses
the switch without suppressing the `LastX`/`LastY` bookkeeping.
6. **In relative mode the controller does not look at edges at all, and the
`NextMachine` it gets back is gated on Easy Mouse.** `Event.cs:73` runs
`MoveToMyNeighbourIfNeeded` only when
`DesMachineID == MachineID || !MoveMouseRelatively`, so while a remote machine
is being driven relatively the controller's own hook never proposes a switch;
the controlled machine does it (`Receiver.cs:154-170`) and replies with
`NextMachine (121)`. The controller's acceptance test for that packet is
`Event.IsSwitchingByMouseEnabled()` (`Receiver.cs:198`), which is
`EasyMouse == Enable` **or** `InputHook.EasyMouseKeyDown`
(`Event.cs:152-155`) — the Ctrl/Shift Easy-Mouse key being held — not the
setting alone. Note also that the two 100 ms debounces are different clocks:
`MoveToMyNeighbourIfNeeded`'s is `lastJump` (`MachineStuff.cs:217`), written
only by `PrepareToSwitchToMachine` (`Event.cs:190`), which the controlled
machine never calls — so on that side the debounce that actually applies is
`SendNextMachine`'s own `lastSendNextMachine` (`Common.cs:516-524`).
7. **Both edge paths set `Clipboard.HasSwitchedMachineSinceLastCopy`.** The
controller at `Event.cs:81` and the controlled machine at `Receiver.cs:160`,
as well as `Receiver.cs:384` (`HideMouse`) and `Helper.cs:320`. The flag
suppresses the "same content as last time" short-circuit exactly once
(`Clipboard.cs:130-139` for text, `:206-215` for the byte path), so copying
the same text again after a machine switch still re-sends it. Our
`ClipboardBridge` has no equivalent, which means a second copy of identical
content after a switch may be dropped where Windows would resend it — recorded
here rather than fixed, since it is the clipboard lane's state.