extras: awake assertion, fullscreen rule, drawn cursor, transfer notices
- MWBMac/Awake.swift: DisplayAwake renews an IOPMAssertion (PreventUserIdleDisplaySleep, 90 s timeout) on every Awake (21), the macOS answer to Common.HumanBeingDetected/PokeMyself (Receiver.cs:244-249, Common.cs:561-591) without posting input. - MWBMac/Fullscreen.swift: the frontmost app's excluded-apps test and a covers-a-whole-display window check, cached 250 ms; gated in the Engine by IsEasyMouseSwitchAllowed's two early outs (Common.cs:1638-1650), so it is asked only on the edge path. - MWBMac/FakeCursor.swift: CursorOverlay draws NSCursor.arrow at the last injected position (Receiver.cs:186-188) and hides on park, local input and shutdown (Common.cs:1495, InputHook.cs:256-264); FakeCursor coalesces the main-thread hops. - Settings.drawMouseCursor accessor + the Behaviour-pane toggle, answering app-ui's open request. - UIBridge.TransferNotices wires ClipboardAction.note to the Notifier, answering clipboard's open request (Clipboard.cs:610-618, 869-881, 916). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
1 parent
b73e878ae4
commit
21c886165e
9 files changed
+508
-9
No files matched your search
@@ -16,6 +16,35 @@ import MWBCore
|
||||
import MWBMac
|
||||
import MWBNet
|
||||
|
||||
/// Clipboard and file transfers, shown to the user.
|
||||
///
|
||||
/// Windows pops one tray balloon per transfer — "Receiving X from Y…"
|
||||
/// (`Clipboard.cs:610-618`), "X from Y is in Clipboard." (`:869-881`) and the
|
||||
/// failure message (`:916`) — each passing `Setting.Values.ShowClipNetStatus` to
|
||||
/// `ShowToolTip`, so the setting is the gate. `Notifier` already holds that gate
|
||||
/// (`enabledChanged(_:)` follows
|
||||
/// `ShowClipboardAndNetworkStatusMessages`), so all that was missing was the
|
||||
/// wire: the clipboard lane's `ClipboardAction.note` carries the text and the
|
||||
/// Engine only logged it.
|
||||
///
|
||||
/// A static rendezvous rather than a property on the Engine because the Engine
|
||||
/// is an actor, the `Notifier` is `@MainActor`, and there is exactly one of each
|
||||
/// for the life of the process.
|
||||
@MainActor enum TransferNotices {
|
||||
private static weak var notifier: Notifier?
|
||||
|
||||
/// UIBridge hands its notifier over when the menu bar appears, and takes it
|
||||
/// back on the way out.
|
||||
static func install(_ notifier: Notifier?) {
|
||||
TransferNotices.notifier = notifier
|
||||
}
|
||||
|
||||
/// Shows one transfer message, if the user asked for them.
|
||||
static func post(_ text: String) {
|
||||
notifier?.post(title: "Mouse Without Borders", body: text)
|
||||
}
|
||||
}
|
||||
|
||||
/// Owns the menu bar, the settings window and the notifier, and keeps all three
|
||||
/// in step with the Engine.
|
||||
@MainActor final class UIBridge {
|
||||
@@ -43,11 +72,13 @@ import MWBNet
|
||||
/// the first snapshot has something to draw into.
|
||||
func start() {
|
||||
statusItem = StatusItemController(actions: makeActions())
|
||||
TransferNotices.install(notifier)
|
||||
render(EngineSnapshot())
|
||||
}
|
||||
|
||||
/// Takes the item away again, on the way out.
|
||||
func stop() {
|
||||
TransferNotices.install(nil)
|
||||
statusItem?.remove()
|
||||
statusItem = nil
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user