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:
lucioandClaude Opus 5 committed 2026-09-16 03:35:37 -07:00
1 parent c4741fcfeb
commit fc7a54b40a
5 files changed
+464 -108

No files matched your search

+4 -4
View File
@@ -5,7 +5,7 @@
// Ported from App/Core/MachineStuff.cs `SwitchToMachine` (1008-1028) and
// `SwitchToMultipleMode` (1030-1050), App/Core/Helper.cs `HelperThread`
// (73-127), App/Class/InputHook.cs `ProcessHotKeys` (516-621) and `Switch2`
// (623-655), App/Core/InitAndCleanup.cs `ReleaseAllKeys` (214-243).
// (626-655), App/Core/InitAndCleanup.cs `ReleaseAllKeys` (214-243).
import AppKit
import Foundation
@@ -126,14 +126,14 @@ extension Engine {
}
}
/// `Switch2` (`InputHook.cs:623-655`): release everything, then hand control
/// `Switch2` (`InputHook.cs:626-655`): release everything, then hand control
/// to the machine in that matrix slot. An empty slot does nothing.
public func switchTo(slot: Int) {
let names = switcher.matrix.names
guard slot >= 0, slot < names.count else { return }
let name = names[slot].trimmingCharacters(in: .whitespaces)
guard !name.isEmpty else { return }
injector.releaseAll() // InputHook.cs:632
injector.releaseAll() // InputHook.cs:635
perform(switcher.switchToMachine(named: name, now: EventTap.now()))
}
@@ -170,7 +170,7 @@ extension Engine {
forwardLockChord(to: des)
}
/// A double press (`InputHook.cs:546-566`): broadcast the chord to everyone,
/// A double press (`InputHook.cs:544-566`): broadcast the chord to everyone,
/// come back out of ALL mode, then lock this Mac too.
public func lockAll() {
perform(switcher.switchToBroadcast(true, centerCursor: true))
+9 -5
View File
@@ -8,7 +8,8 @@
// from a disconnect callback or a signal handler.
//
// Ported from App/Core/Common.cs `ProcessByeByeMessage` (622-630),
// App/Core/MachineStuff.cs `RemoveDeadMachines` (675-694),
// App/Class/SocketStuff.cs (1561-1563) and App/Core/MachineStuff.cs
// `RemoveDeadMachines` (675-694),
// App/Core/InitAndCleanup.cs `ReleaseAllKeys` (214-243) and `Cleanup` (192-215),
// App/Form/frmScreen.cs `HelperTimer_Tick` (427-461).
@@ -28,10 +29,13 @@ extension Engine {
public func recoverLocal(reason: RecoveryReason) {
routing.routeLocal()
// `SwitchToMachine(MachineName)` is what Windows uses on every one of
// these rows (`Common.cs:626`, `MachineStuff.cs:691`), so control comes
// home the same way a hotkey would: the machine we were driving is told
// to park, and our own pointer lands in the middle of the primary screen.
// `SwitchToMachine(MachineName)` is what Windows does on a `ByeBye`
// (`Common.cs:626`), so control comes home the same way a hotkey would:
// the machine we were driving is told to park, and our own pointer lands
// in the middle of the primary screen. On a plain socket error Windows
// only marks the machine dead (`SocketStuff.cs:1561-1563`) and lets its
// 100 ms timer take control home once nothing is connected
// (`frmScreen.cs:442`); contracts C2 requires it immediately.
var actions: [SwitchAction] = []
if switcher.desMachineID != switcher.localID {
actions = switcher.switchToMachine(named: switcher.localName, now: EventTap.now())