133e25849d
Sources reorganized (client: Home/Session/Settings/Stores/Support/Trust; kit: Audio/Connection/Gamepad/Input/Support/Video/Views) with the big files split along the same seams. The gamepad mode is couch-complete, and now on macOS too (the living-room Mac case), not just iOS/iPadOS: - GamepadSettingsView: a console-style, fully controller-navigable settings screen (X from the launcher) — up/down moves focus, left/right steps values (clamped, boundary thud), A cycles/toggles, B closes; the focused row shows a one-line description. Backed by GamepadMenuList, the vertical sibling of GamepadCarousel, and SettingsOptions — the option lists hoisted out of SettingsView statics and shared by the touch, tvOS and gamepad settings. - GamepadAddHostView + GamepadKeyboard: register a host end to end with a pad — field rows open an on-screen controller keyboard (dpad grid, A types, X backspaces, B done); the launcher carousel ends in an Add Host tile, so the dead-end "add one with touch first" empty state is gone. - Launcher polish: contextual hint bar with the pad's real button glyphs, controller name + battery chip, one shared console chrome. - GamepadScreenBackground: an animated aurora (TimelineView-driven drifting blobs in the brand's violet family, breathing radii, slow hue shift, legibility scrim; freezes under Reduce Motion). Pure SwiftUI on purpose — a .metal library only bundles reliably in one of the two build systems (SPM vs the xcodeproj's synced folders) these sources compile under. - macOS port: settings/add-host/library present as sized sheets (a macOS sheet takes its content's IDEAL size, and the GeometryReader-driven screens collapsed to nothing), NSScreen-based mode lists, scroll indicators .never (the "always show scroll bars" setting overrides .hidden), tray scrims so scrolled rows dim under the pinned title/hints, extra title clearance, and a PUNKTFUNK_FORCE_GAMEPAD_UI=1 dev hook — launcher/settings/add-host/keyboard/ library render-verified live on a real Mac + LAN hosts. - GamepadMenuInput: X button support, and (re)start now snapshots held buttons so a controller handoff press never fires twice (the B that closed the keyboard no longer also cancels the screen underneath). - Cleanups: one "Connection failed" alert in ContentView instead of one per home screen; HostDiscovery.advertises/unsaved shared by both home screens. - host: can_encode_444 stub for the non-Linux/Windows host build (the macOS synthetic-source loopback used by the Swift tests). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
59 lines
4.1 KiB
Swift
59 lines
4.1 KiB
Swift
// One source of truth for the client's UserDefaults / @AppStorage keys. A magic-string key
|
|
// duplicated across a setting's writer (a Settings @AppStorage) and reader (e.g. a stream view
|
|
// reading UserDefaults) splits silently on a typo — the setting just stops taking effect. These
|
|
// live in PunktfunkKit because both the app and the kit's views read them.
|
|
|
|
import Foundation
|
|
|
|
/// Persisted-setting keys. The string VALUES are stable on disk — rename the symbol freely, but
|
|
/// never the string (it would orphan everyone's saved value).
|
|
public enum DefaultsKey {
|
|
public static let streamWidth = "punktfunk.width"
|
|
public static let streamHeight = "punktfunk.height"
|
|
public static let streamHz = "punktfunk.hz"
|
|
public static let compositor = "punktfunk.compositor"
|
|
public static let gamepadType = "punktfunk.gamepadType"
|
|
public static let gamepadID = "punktfunk.gamepadID"
|
|
public static let bitrateKbps = "punktfunk.bitrateKbps"
|
|
/// Requested audio channel count: 2 (stereo), 6 (5.1) or 8 (7.1). The host clamps to what it
|
|
/// can capture; the resolved count drives the in-core decode + AVAudioEngine layout.
|
|
public static let audioChannels = "punktfunk.audioChannels"
|
|
/// Preferred video codec: `"auto"` (host decides), `"hevc"`, or `"h264"`. A soft preference —
|
|
/// the host emits it when it can, else falls back. Drives the decoder via `Welcome.codec`.
|
|
public static let codec = "punktfunk.codec"
|
|
public static let micEnabled = "punktfunk.micEnabled"
|
|
public static let speakerUID = "punktfunk.speakerUID"
|
|
public static let micUID = "punktfunk.micUID"
|
|
public static let presenter = "punktfunk.presenter"
|
|
/// Request a 10-bit BT.2020 PQ (HDR10) stream. On by default; only takes effect when the host
|
|
/// has HDR content AND this display supports HDR — otherwise the stream stays 8-bit SDR.
|
|
public static let hdrEnabled = "punktfunk.hdrEnabled"
|
|
/// Request a full-chroma 4:4:4 stream when this device can HARDWARE-decode it (`Stage444Probe`).
|
|
/// On by default; only takes effect when the host also opted in to 4:4:4 (otherwise the stream
|
|
/// stays 4:2:0). Sharper text/UI at the cost of more bandwidth.
|
|
public static let enable444 = "punktfunk.enable444"
|
|
public static let hosts = "punktfunk.hosts"
|
|
/// Client-side cursor mode: "auto" (shown only in gamescope sessions), "always", "never".
|
|
public static let cursorMode = "punktfunk.cursorMode"
|
|
/// iPad: capture the mouse/trackpad pointer (pointer lock → relative movement) for games,
|
|
/// rather than forwarding an absolute cursor position. On by default. Only meaningful on iPad
|
|
/// with a hardware mouse/trackpad; the system grants the lock only to a full-screen, frontmost
|
|
/// scene and silently falls back to the absolute pointer when it can't (Stage Manager / Slide
|
|
/// Over). Read by `StreamViewController.prefersPointerLocked`.
|
|
public static let pointerCapture = "punktfunk.pointerCapture"
|
|
/// Experimental: show the host's game library (browsed over the management API). Off by default.
|
|
public static let libraryEnabled = "punktfunk.libraryEnabled"
|
|
/// macOS: take the window fullscreen while streaming and restore it on the host list. On by default.
|
|
public static let fullscreenWhileStreaming = "punktfunk.fullscreenWhileStreaming"
|
|
/// Show the streaming statistics overlay (mode/fps/throughput/latency). On by default; toggle
|
|
/// while streaming with ⌘⇧S (macOS / hardware keyboard).
|
|
public static let hudEnabled = "punktfunk.hudEnabled"
|
|
/// Which corner the statistics overlay sits in — a `HUDPlacement` raw value
|
|
/// ("topLeading"/"topTrailing"/"bottomLeading"/"bottomTrailing"). Default top-trailing.
|
|
public static let hudPlacement = "punktfunk.hudPlacement"
|
|
/// iOS/iPadOS/macOS: switch the host list, settings and game library to a controller-friendly
|
|
/// layout (the console launcher, gamepad-navigable settings, a coverflow-style library)
|
|
/// whenever a gamepad is connected. On by default; see `GamepadUIEnvironment.isActive`.
|
|
public static let gamepadUIEnabled = "punktfunk.gamepadUIEnabled"
|
|
}
|