app-engine: protocol §10.6, the lane README and TODO §6
§10.6 records six things the Windows source says that §1-§9 did not: that a switch moves the pointer only when the target is the local machine (Helper.cs:75-127), that a Mouse packet addressed to us takes control back by assignment rather than by switching (Receiver.cs:122-125), that relative mode puts the edge detection on the controlled machine (Receiver.cs:147-172), that the reconnect countdown is 30 s and gated on "no socket established" (frmScreen.cs:425-449), the exact JSON shapes of the settings file, and why Heartbeat has to be a 64-byte packet. The README's Handshakes section now documents the API as shipped, six deliberate deviations, the answers to all eleven open requests from lanes 3-5, and four new requests: PacketSequencer is used from two queues and is not thread-safe (session-matrix), PermissionState has no public initialiser and Cursor publishes no pointer position (input-capture), and there is no way to send a Heartbeat on demand (control-channel). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
1 parent
c4741fcfeb
commit
fc7a54b40a
5 files changed
+464
-108
No files matched your search
@@ -870,3 +870,71 @@ sees them. One subsection per lane, appended, never rewritten.
|
||||
desktops is out of scope in the first place (README D6). Note that the
|
||||
hardcoded Win+L branch (`:450-460`) carries no such gate on Windows either, so
|
||||
only the configurable hotkey was ever gated.
|
||||
|
||||
### 10.6 app-engine (2026-09-16)
|
||||
|
||||
1. **A switch moves the pointer only when the target is the local machine.**
|
||||
`Event.PrepareToSwitchToMachine` records `MachineStuff.SwitchLocation` and sets
|
||||
`EvSwitch` (`Event.cs:180-184`); the cursor work is all done afterwards by
|
||||
`Helper.HelperThread` (`Helper.cs:75-127`), which branches on
|
||||
`NewDesMachineID`: a *remote* target gets `HideMouseCursor(false)` and the
|
||||
parked dot, and only `NewDesMachineID == MachineID` reads `SwitchLocation` and
|
||||
calls `MoveMouse`/`MoveMouseEx` (`Helper.cs:96-113`). So `SwitchAction.moveCursor` is a landing for
|
||||
*this* machine; consuming it unconditionally would throw the user's pointer at
|
||||
the far machine's landing coordinates every time control left. The same thread
|
||||
calls `ReleaseAllKeys()` whenever `NewDesMachineID == MachineID` (`Helper.cs:120-123`),
|
||||
which is the third place Windows releases keys on a switch home.
|
||||
2. **A `Mouse` packet addressed to us takes control back by assignment, not by
|
||||
switching.** `Receiver.cs:122-125` sets `NewDesMachineID = DesMachineID =
|
||||
MachineID` inline: no `HideMouse` to the machine we were driving, no cursor
|
||||
move, no `MachineSwitched`. It is a defensive line for the crossed state where
|
||||
two machines each think they are the controller. A port that reaches for
|
||||
`SwitchToMachine(MachineName)` here must drop that call's cursor move, or the
|
||||
jump to the primary screen's centre will fight the mouse packet that is about
|
||||
to be injected.
|
||||
3. **In relative mode the *controlled* machine does the edge detection.**
|
||||
`Receiver.cs:147-172`: after `MoveMouseRelative`, the receiver reads
|
||||
`GetCursorPos` and runs `MoveToMyNeighbourIfNeeded(..., Common.MachineID)`
|
||||
itself, then `SendNextMachine(package.Src, newDesMachineIdEx, p)` back to the
|
||||
controller, which treats it like an edge crossing of its own
|
||||
(`Receiver.cs:195-201` → `PrepareToSwitchToMachine`). That is the only reason
|
||||
`NextMachine (121)` exists, and it is why the receiving side needs a
|
||||
"where is the pointer right now" read that nothing else on the receive path
|
||||
needs. The acceptance test on the controller is
|
||||
`Event.IsSwitchingByMouseEnabled()` — `EasyMouse == Enable` **or** the Ctrl /
|
||||
Shift Easy-Mouse key being held (`InputHook.EasyMouseKeyDown`,
|
||||
`InputHook.cs:92, 404, 467-473`), not the setting alone.
|
||||
4. **The reconnect countdown is 30 s and is gated on "no socket established".**
|
||||
`frmScreen.HelperTimer_Tick` runs every 100 ms (`:285-288`). The reopen block
|
||||
is inside `if ((count % 2) == 0)` and fires on `count % 300 == 0`
|
||||
(`frmScreen.cs:425-427`) — 30 s — and only when `!Common.AtLeastOneSocketEstablished()`;
|
||||
when a socket *is* established it clears `PleaseReopenSocket` instead
|
||||
(`frmScreen.cs:446-449`). `PleaseReopenSocket` is a counter with two sentinel values, not a
|
||||
flag: `REOPEN_WHEN_HOTKEY = -10055` and `REOPEN_WHEN_WSAECONNRESET = -10054`
|
||||
(`InitAndCleanup.cs:28-29`), handled separately at `frmScreen.cs:452-462`. 30 s is also the
|
||||
connect budget the control channel gives up after (§10.3 notes 1–2), so the two
|
||||
line up: the countdown fires exactly as the budget expires.
|
||||
5. **The settings file's JSON shapes, exactly.** The envelope is
|
||||
`{"name":"MouseWithoutBorders","version":"1.1","properties":{…}}`
|
||||
(`MouseWithoutBordersSettings.cs:27-34`) and the property names are the C#
|
||||
property names verbatim — no naming policy is set on the serializer
|
||||
(`MouseWithoutBordersSettings.cs:20-25`). Inside `properties`:
|
||||
- every `bool` goes through `BoolPropertyJsonConverter` and every `IntProperty`
|
||||
/ `StringProperty` / `GenericProperty` is a record with one `value` field, so
|
||||
they are all written as `{"value": …}` — `"WrapMouse": {"value": true}`,
|
||||
`"TCPPort": {"value": 15100}`;
|
||||
- `MachineMatrixString` is the exception: a bare `List<string>`, so a plain
|
||||
JSON array (`MouseWithoutBordersProperties.cs:85-86`). The MWB app joins and
|
||||
splits it on `,` (`Setting.cs:216-236`), which is where the
|
||||
`"a,b,c,d"` form in `MachineMatrixString` comes from;
|
||||
- the four shortcuts are `HotkeySettings`, whose fields carry explicit
|
||||
lower-case names: `{"win":…,"ctrl":…,"alt":…,"shift":…,"code":…,"key":""}`
|
||||
(`HotkeySettings.cs:121-136`). `win` is ⌘ and `alt` is ⌥ on a Mac (README D4);
|
||||
- `MachineID` is seeded from `Encryption.Ran.Next()` (`Setting.cs:1058`), i.e.
|
||||
`System.Random.Next()`, so it is always a **non-negative** `Int32` — never 0
|
||||
after generation, because 0 is the "not set yet" sentinel the getter tests.
|
||||
6. **`Heartbeat` and `Awake` are 64-byte packets.** Not new, but worth stating
|
||||
where the receiver is described: `MachineStuff.AddToMachinePool` reads
|
||||
`package.MachineName` (`:712-777`), which only exists on a big packet, so a
|
||||
32-byte heartbeat would teach the peer nothing. `PackageType.isBig` already
|
||||
lists them (§1.2).
|
||||
Reference in new issue
Block a user