diff --git a/TODO.md b/TODO.md index 3f70a9a..70936aa 100644 --- a/TODO.md +++ b/TODO.md @@ -185,7 +185,7 @@ concurrency, shared constants, checkpoints) is fixed in `docs/contracts.md`. 100 MB limit, folders refused, `TransferFile` flag; reveal in Finder. - [x] `Pasteboard`: `changeCount` poll 500 ms, 1 s suppression, write on receive (text/RTF/HTML/PNG/file URL), `ShareClipboard` flag. -- [ ] **Checkpoint CP2** (C5): clipboard both ways, in-band and bulk. +- [x] **Checkpoint CP2** (C5): handed to the user 2026-09-16 together with CP1 — clipboard both ways, in-band and bulk. ## 9. extras (mac + core) — `Sources/MWBMac/Awake.swift`, `Sources/MWBMac/Fullscreen.swift`, `Sources/MWBMac/FakeCursor.swift` @@ -208,6 +208,12 @@ concurrency, shared constants, checkpoints) is fixed in `docs/contracts.md`. - [ ] Each finding from the user becomes a line here with the file that owns the fix. +- [ ] Clipboard follow-ups (QA, lane 8): serialise bulk *receives* to + one at a time like `ClipboardReceiveGate` (`BulkChannel.swift`); + delete dead `ReceivedFile.stagingURL`; fix the 20 MB text-gate + comment (`Pasteboard.swift`); drop unused `import AppKit` in + `ClipboardBridge.swift`; distinct "File too big" on the + send-time re-check (`BulkConnection.swift`). - [ ] `Engine`↔`UIBridge` strong cycle (`AppLifecycle.swift`, `UIBridge.swift`): make one side weak before any second pair can exist (QA, app-ui). diff --git a/docs/features/clipboard/README.md b/docs/features/clipboard/README.md index 479077e..67bb8da 100644 --- a/docs/features/clipboard/README.md +++ b/docs/features/clipboard/README.md @@ -626,3 +626,17 @@ further findings. Verdict: PASS ## Review + +- 2026-09-16 (lead): inspected per `docs/loop.md` §5. Gates green run + by me; diff limited to the brief's files, the authorised Engine hooks + (the four one-line calls beyond the brief are accepted — they are the + minimal interface), TODO §8, protocol §10.7. Read + `BulkConnection.acceptHandshake`/`authorised`: raw 64-byte `DATA`, + bytes 1..3 checked zero, name+id sent to the Engine for the + `resolveID == src && connected` gate before any header or payload — + invariant 2 holds. The Dev's three self-found bugs (duplicate in-band + delivery, outbox overflow, Windows' short padding) are real and each + is cited. QA PASS with five follow-ups, moved to TODO §10. Verdict: + **merge**. **CP2 is now due** alongside CP1. Carry into extras: the + clipboard's open request to app-ui (transfer notifications) is + extras' to do. diff --git a/docs/features/extras/README.md b/docs/features/extras/README.md new file mode 100644 index 0000000..0657308 --- /dev/null +++ b/docs/features/extras/README.md @@ -0,0 +1,113 @@ +# extras + +## Goal + +The remaining PowerToys behaviours that are neither input routing nor +clipboard: keeping the *other* machines' screens awake while the user +is active here (`BlockScreenSaverOnOtherMachines`), not switching away +by edge while a fullscreen app has the foreground +(`DisableEasyMouseWhenForegroundWindowIsFullscreen` + excluded apps), +drawing a cursor on a controlled Mac so the user can see where the +remote pointer is (`DrawMouseCursor`/`DrawMouseEx`), plus finishing two +paths that exist but were never verified end-to-end +(`BlockMouseAtScreenCorners`, `MoveMouseRelatively` with `NextMachine`) +and the clipboard-transfer notifications app-ui still owes. This lane +ends at **CP3**, after which the app is feature-complete against the +PowerToys module minus README D6. + +## Assumptions + +- **Awake** (`Receiver.cs:245-248` → `Common.HumanBeingDetected`, + `Common.cs` — read it: on Windows it nudges the system idle timer / + `SetThreadExecutionState`). On a Mac that is being controlled, each + `Awake (21)` packet renews an `IOPMAssertionCreateWithName( + kIOPMAssertionTypePreventUserIdleDisplaySleep, …)` with a 90 s + timeout (`IOPMAssertionTimeoutKey`) so the display stays on while the + remote user is active and the assertion lapses on its own when the + `Awake`s stop (60 s cadence, §3.3). A plain `Heartbeat` does not renew. + `IOKit` is imported only in `MWBMac/Awake.swift`. Nothing is asserted + when `BlockScreenSaverOnOtherMachines` is off on the *receiving* + side? — No: Windows applies the *sender's* setting (it decides whether + to send `Awake`); the receiver always honours it. Port that. +- **Fullscreen rule** (`Common.cs` `IsForegroundWindowFullscreen` — find + it and the excluded-apps check, cite): before an *edge* switch (not a + hotkey switch) the Engine asks `Fullscreen.frontmostIsFullscreen()`, + which takes `NSWorkspace.shared.frontmostApplication`, skips it if + its bundle identifier or localized name is in + `EasyMouseFullscreenSwitchBlockExcludedApps` (case-insensitive, as + `StringComparer.OrdinalIgnoreCase`), and otherwise checks whether + that app has an on-screen window whose bounds equal a display's + bounds, via `CGWindowListCopyWindowInfo(.optionOnScreenOnly)` filtered + by `kCGWindowOwnerPID` — bounds are available without Screen + Recording permission; window names are not read. Cached for 250 ms + so an edge storm does not query per event. When true, the edge + candidate is ignored (`Switcher.crossing` is not called). +- **Drawn cursor** (`Class/CustomCursor.cs`, `Common.cs` `DrawMouse…`, + `Form/frmScreen.cs` — read which machine draws and when; cite): on the + Mac being controlled, when `DrawMouseCursor` is on, a borderless, + transparent, click-through `NSWindow` (`level = .screenSaver`, + `ignoresMouseEvents`, `collectionBehavior = [.canJoinAllSpaces, + .stationary]`) shows a standard arrow image at the last injected + position and hides when control leaves. `DrawMouseEx` on Windows + selects the richer drawing path; here it is accepted and ignored + (say so). The overlay is driven from `Injector`'s posted moves via a + callback the Engine wires; never from the tap. +- **`Settings.drawMouseCursor`** accessor added to `MWBCore/Settings.swift` + (authorised; app-ui's open request) and the toggle added to + `BehaviourPane.swift` (authorised) in the position PowerToys shows it. +- **Corners and relative mode**: read `Engine.considerCrossing`, + `Engine.reportEdgeToController`, the `.nextMachine` dispatch case, + `Edge`, `Coordinates` and the tap's relative-move encoding, and + confirm against `MachineStuff.cs:203-283`, `Receiver.cs:145-172`, + `Common.cs:516-539`, `InputHook.cs:311-312` that both settings work + end-to-end; fix gaps with cited, minimal edits (authorised in + `Engine.swift`/`EngineActions.swift` for those paths only) and record + what was verified by reading in the Work log. +- **Transfer notifications** (clipboard's open request): when + `ShowClipboardAndNetworkStatusMessages` is on, `UIBridge` posts + `Notifier` messages for clipboard received/sent/failed using the text + `ClipboardAction.note` already carries (authorised edit of + `UIBridge.swift`, that path only). +- **Permissions**: none of this needs a new TCC grant. IOKit + assertions, `CGWindowList` bounds and overlay windows need nothing. + +## Handshakes + +### Consumed + +- `app-engine`: `Engine` dispatch for `.awake`, the edge path, the + injector callback; `Settings` accessors. +- `input-inject`: a `Injector.onPointerMoved` hook if one exists — if + not, the Engine already knows every injected position and forwards it + to the overlay (prefer that; no Injector edit). +- `app-ui`: `Notifier`, `BehaviourPane`. + +### Promised (to polish) + +```swift +public final class DisplayAwake { func renew(seconds: TimeInterval); func release() } // MWBMac/Awake.swift +public enum Fullscreen { static func frontmostIsFullscreen(excluding: Set) -> Bool } +@MainActor public final class CursorOverlay { func show(at: CGPoint); func move(to: CGPoint); func hide() } +``` + +## Status / TODO + +- [ ] `Sources/MWBMac/Awake.swift` + Engine `.awake` hook + (`Receiver.cs:245-248`, `Common.cs` HumanBeingDetected). +- [ ] `Sources/MWBMac/Fullscreen.swift` + edge-path hook + excluded apps + (`Common.cs` IsForegroundWindowFullscreen and callers). +- [ ] `Sources/MWBCore/Settings.swift` `drawMouseCursor` accessor; + `Sources/MWBMac/SettingsWindow/BehaviourPane.swift` toggle. +- [ ] `Sources/MWBMac/FakeCursor.swift` + Engine wiring + (`CustomCursor.cs`, `frmScreen.cs` drawing path). +- [ ] Corners + relative mode verified end-to-end by reading; gaps fixed + (`Sources/mwb/Engine.swift`, `EngineActions.swift`, authorised). +- [ ] `Sources/mwb/UIBridge.swift`: clipboard transfer notifications. +- [ ] `docs/protocol.md`: append §10.8 with anything learned, cited. +- [ ] **Checkpoint CP3** is the lead's after merge. + +## Work log + +## QA log + +## Review diff --git a/docs/loop.md b/docs/loop.md index 38d0c5e..5a4c488 100644 --- a/docs/loop.md +++ b/docs/loop.md @@ -159,8 +159,8 @@ Strictly one at a time, in this order (mirrors `TODO.md`): | 5 | input-inject | merged 2026-09-16 (one rework) | | 6 | app-engine | merged 2026-09-16 (one rework) | | 7 | app-ui | merged 2026-09-16 — **CP1 handed to the user** | -| 8 | clipboard | in progress — **CP2** | -| 9 | extras | **CP3** | +| 8 | clipboard | merged 2026-09-16 — **CP2 handed to the user** | +| 9 | extras | in progress — **CP3** | | 10 | polish | driven by the checkpoints' findings | ## 7. Escalations — things only the user can do @@ -175,6 +175,12 @@ Strictly one at a time, in this order (mirrors `TODO.md`): ## 8. Lane log +- **2026-09-16, lane 8 (clipboard)** — Dev (Opus) found and fixed three + of its own bugs on a re-read (duplicate in-band delivery across a + peer pair's two connections, 22 000 chunks into a 512 outbox, Windows' + own short padding), QA (Sonnet) PASS with five follow-ups, lead merge. + The brief's two open questions (bulk `DATA` unframed; Foundation + `.zlib` is raw DEFLATE) were answered with evidence in §10.7. - **2026-09-16, lane 7 (app-ui)** — Dev (Opus), QA (Sonnet) PASS with one low finding (a process-lifetime retain cycle), lead merge. First lane with no rework. CP1 handed to the user the same day; the lead