e1af4d57c6
ci / rust (push) Has been cancelled
The whole client now runs on iPadOS/iOS from the same sources, first-lit live in the
iPad simulator against the real host at 1280x720@60 (60 fps on the HUD, capture state
machine active, mic permission flow shown).
- PunktfunkCore.xcframework grows iOS device + universal-simulator slices
(BUILD_IOS=1; rustup targets aarch64-apple-ios{,-sim} + x86_64-apple-ios).
- The decode pump is extracted into a shared StreamPump (identical IDR re-gate logic on
both platforms); the iOS StreamView (StreamViewIOS.swift) has the same name/signature
as the macOS one, so ContentView & co. are byte-identical across platforms — hosted
in a UIViewController for prefersPointerLocked (the iPadOS cursor capture; see README
note 9 for the UIHostingController forwarding caveat).
- Touch is always forwarded: per-finger wire ids, coordinates mapped through the
aspect-fit letterbox into LIVE host-mode pixels (surface == host mode, identity
rescale host-side; follows mid-stream requestMode switches).
- InputCapture is cross-platform: GC works the same on iPadOS, ⌘⎋ is detected from the
HID stream there; stale-⌘ tracking after focus loss fixed on both platforms
(releaseAll now drops the modifier/latch state — a ⌘ released in another app
otherwise hijacked Esc forever).
- SessionAudio: AVAudioSession on iOS (.playAndRecord + .defaultToSpeaker — without it
iPhones route host audio to the EARPIECE; deactivated with
notifyOthersOnDeactivation on stop so interrupted background audio resumes); HAL
device pinning + the Settings pickers stay macOS-only.
- New Punktfunk-iOS app target (shared synchronized sources, generated Info.plist with
mic + local-network usage descriptions — QUIC to a LAN host trips local network
privacy on real devices — scene manifest + indirect input events for Stage Manager /
external displays), shared scheme, macOS min-window frames gated off iOS.
For the iPad-on-an-external-screen idea: with multiple scenes + indirect input enabled,
Stage Manager iPads can drag the punktfunk window onto the external display and drive
the PC with keyboard/mouse/touch. Known gaps (README note 9): the pointer-lock
preference isn't consulted through UIHostingController (relative mouse works, the local
cursor just stays visible) and AVAudioSession interruptions don't auto-restart audio.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
126 lines
4.9 KiB
Swift
126 lines
4.9 KiB
Swift
// App settings (⌘,): the stream mode + the host compositor. The host creates a native
|
||
// virtual output at exactly this size/refresh — there is no scaling anywhere in the
|
||
// pipeline.
|
||
|
||
#if os(macOS)
|
||
import AppKit
|
||
#endif
|
||
import PunktfunkKit
|
||
import SwiftUI
|
||
|
||
struct SettingsView: View {
|
||
@AppStorage("punktfunk.width") private var width = 1920
|
||
@AppStorage("punktfunk.height") private var height = 1080
|
||
@AppStorage("punktfunk.hz") private var hz = 60
|
||
@AppStorage("punktfunk.compositor") private var compositor = 0
|
||
@AppStorage("punktfunk.micEnabled") private var micEnabled = true
|
||
#if os(macOS)
|
||
@AppStorage("punktfunk.speakerUID") private var speakerUID = ""
|
||
@AppStorage("punktfunk.micUID") private var micUID = ""
|
||
@State private var outputDevices: [AudioDevice] = []
|
||
@State private var inputDevices: [AudioDevice] = []
|
||
#endif
|
||
|
||
var body: some View {
|
||
Form {
|
||
Section {
|
||
HStack {
|
||
TextField("Resolution", value: $width, format: .number.grouping(.never))
|
||
Text("×")
|
||
TextField("", value: $height, format: .number.grouping(.never))
|
||
.labelsHidden()
|
||
}
|
||
TextField("Refresh rate (Hz)", value: $hz, format: .number.grouping(.never))
|
||
LabeledContent("") {
|
||
Button("Use this display's mode") { fillFromMainScreen() }
|
||
}
|
||
} header: {
|
||
Text("Stream mode")
|
||
} footer: {
|
||
Text("The host creates a virtual output at exactly this mode — "
|
||
+ "native resolution, no scaling.")
|
||
.font(.caption)
|
||
.foregroundStyle(.secondary)
|
||
}
|
||
Section {
|
||
#if os(macOS)
|
||
Picker("Speaker", selection: $speakerUID) {
|
||
Text("System default").tag("")
|
||
ForEach(outputDevices) { device in
|
||
Text(device.name).tag(device.uid)
|
||
}
|
||
if !speakerUID.isEmpty,
|
||
!outputDevices.contains(where: { $0.uid == speakerUID }) {
|
||
Text("Unavailable device").tag(speakerUID)
|
||
}
|
||
}
|
||
#endif
|
||
Toggle("Send microphone to the host", isOn: $micEnabled)
|
||
#if os(macOS)
|
||
Picker("Microphone", selection: $micUID) {
|
||
Text("System default").tag("")
|
||
ForEach(inputDevices) { device in
|
||
Text(device.name).tag(device.uid)
|
||
}
|
||
if !micUID.isEmpty,
|
||
!inputDevices.contains(where: { $0.uid == micUID }) {
|
||
Text("Unavailable device").tag(micUID)
|
||
}
|
||
}
|
||
.disabled(!micEnabled)
|
||
#endif
|
||
} header: {
|
||
Text("Audio")
|
||
} footer: {
|
||
Text("Host audio plays through the speaker; the microphone feeds the "
|
||
+ "host's virtual mic. System default follows macOS device changes. "
|
||
+ "Applies from the next session.")
|
||
.font(.caption)
|
||
.foregroundStyle(.secondary)
|
||
}
|
||
Section {
|
||
Picker("Compositor", selection: $compositor) {
|
||
Text("Automatic").tag(0)
|
||
Text("KWin (KDE Plasma)").tag(1)
|
||
Text("wlroots (Sway / Hyprland)").tag(2)
|
||
Text("Mutter (GNOME)").tag(3)
|
||
Text("gamescope").tag(4)
|
||
}
|
||
} header: {
|
||
Text("Host compositor")
|
||
} footer: {
|
||
Text("Which compositor drives the virtual output on the host. A specific "
|
||
+ "choice is honored only if that backend is available there — "
|
||
+ "otherwise the host falls back to auto-detection.")
|
||
.font(.caption)
|
||
.foregroundStyle(.secondary)
|
||
}
|
||
}
|
||
.formStyle(.grouped)
|
||
#if os(macOS)
|
||
.frame(width: 380)
|
||
.fixedSize()
|
||
.onAppear {
|
||
outputDevices = AudioDevices.outputs()
|
||
inputDevices = AudioDevices.inputs()
|
||
}
|
||
#endif
|
||
}
|
||
|
||
private func fillFromMainScreen() {
|
||
#if os(macOS)
|
||
guard let screen = NSScreen.main else { return }
|
||
let scale = screen.backingScaleFactor
|
||
width = Int(screen.frame.width * scale)
|
||
height = Int(screen.frame.height * scale)
|
||
hz = screen.maximumFramesPerSecond
|
||
#else
|
||
// nativeBounds is portrait-oriented pixels — streams are landscape.
|
||
let bounds = UIScreen.main.nativeBounds
|
||
width = Int(max(bounds.width, bounds.height))
|
||
height = Int(min(bounds.width, bounds.height))
|
||
hz = UIScreen.main.maximumFramesPerSecond
|
||
#endif
|
||
}
|
||
}
|