Skip to content

Run a virtual iPhone on an Apple Silicon Mac.

Swift

Duo: crop the window onto the cover as soon as the fold lands

Jacky83baf30522cb
diff --git a/Research/Guest/iphone_duo_bringup.md b/Research/Guest/iphone_duo_bringup.md
index 720e093a..8311930d 100644
--- a/Research/Guest/iphone_duo_bringup.md
+++ b/Research/Guest/iphone_duo_bringup.md
@@ -3914,3 +3914,17 @@ the boot ladder resolves the desired interface per target viewport
target degrees. Verified: folded boot and every unfold land 90° with a
correct landscape re-flow; every close lands a lit portrait cover;
explicit rotations 0/90/270 still settle; 3× cycles green.
+
+Follow-up (cover presentation band): the folded black band under the cover
+content traced to the host window, not the guest. The guest anchors the
+466x678 cover mode at the framebuffer's top-left and the window's layout
+crops exactly that region (1398x2034) full-bleed at the panel's scale —
+verified by pixel-brightness profiles of the raw framebuffer (content in
+rows 0–~2050, pure black only below the mode). The visible thick band was
+the inner-aspect window still showing the whole framebuffer for up to the
+orientation poll's one-second period after the fold: the cover content in
+the top 71 percent, black below. The fold action now runs the poll as soon
+as the posture RPC returns, so the window takes the cover crop immediately.
+(A guest-side experiment that centered the scene frames moved nothing —
+scene windows ignore the settings-frame origin — and was reverted; the
+top-left anchor is the load-bearing contract between the two sides.)
diff --git a/VPhoneExecutable/VPhoneVirtualization/UI/UserInterface/VPhoneVirtualMachineWindowController.swift b/VPhoneExecutable/VPhoneVirtualization/UI/UserInterface/VPhoneVirtualMachineWindowController.swift
index 5a2b991a..d86bb1b6 100644
--- a/VPhoneExecutable/VPhoneVirtualization/UI/UserInterface/VPhoneVirtualMachineWindowController.swift
+++ b/VPhoneExecutable/VPhoneVirtualization/UI/UserInterface/VPhoneVirtualMachineWindowController.swift
@@ -653,6 +653,11 @@ class VPhoneVirtualMachineWindowController: NSObject, NSWindowDelegate {
} catch {
VPhoneAlert.present(title: VPhoneLocalization.text("Duo Fold Posture"), message: error.localizedDescription, style: .warning)
}
+ // The window must take the new panel immediately: waiting for
+ // the orientation poll leaves the inner-aspect window showing
+ // the whole framebuffer for up to a second, with the folded
+ // state reading as a black band under the cover content.
+ self.pollOrientation()
self.updateFoldButton(position: control.foldPosition, connected: control.isConnected)
}
}
diff --git a/VPhoneGuestComponents/FoldDisplay/libvphonefolddisplay.m b/VPhoneGuestComponents/FoldDisplay/libvphonefolddisplay.m
index 77324316..cac1a5b9 100644
--- a/VPhoneGuestComponents/FoldDisplay/libvphonefolddisplay.m
+++ b/VPhoneGuestComponents/FoldDisplay/libvphonefolddisplay.m
@@ -301,6 +301,10 @@ static void vpApplyRootGeometry(void) {
// whose block receives the mutable settings. The native geometry
// callback then propagates: icon family switch and window resizes.
CGRect frame = CGRectMake(0, 0, [bounds[2] doubleValue], [bounds[3] doubleValue]);
+ // The cover mode is smaller than the physical surface and the scene
+ // renders it at the surface's top-left; the host window crops that
+ // region and presents it full-bleed, so the origin stays at zero —
+ // centering here would desynchronize the two sides.
for (id scene in vpRootServerScenes(app)) {
id identifier = vpReadObject(scene, "identifier");
if (![identifier isEqual:@"SB-main"] &&