Skip to content

Run a virtual iPhone on an Apple Silicon Mac.

Swift

Duo: re-flow landscape rotation on both sides of the glass

Jacky805b6669486f
diff --git a/Research/Guest/iphone_duo_bringup.md b/Research/Guest/iphone_duo_bringup.md
index 2da98405..8b110d58 100644
--- a/Research/Guest/iphone_duo_bringup.md
+++ b/Research/Guest/iphone_duo_bringup.md
@@ -3871,3 +3871,17 @@ the cover actuation inline (`vpScheduleViewportAdoption`), so the correct
direction lands in the same adoption turn instead of a second later. Button
path (duration 0) verified 3/3 roundtrips clean; animated paths sample clean
with an occasional single-sample (~0.2 s) self-healing blip on close.
+
+Follow-up (landscape re-flow): rotating the open panel to landscape left
+the home grid in its portrait arrangement rendered sideways with a black
+side band — the Main mode keeps portrait dimensions on this platform, so
+the rotation pipeline turned the framebuffer but nothing re-delivered the
+scene's coordinate space (no icon-family switch, no resize propagation;
+those only ran from the fold adoption chain). Two fixes: the dylib's
+orientation actuation now also submits the public
+`requestGeometryUpdateWithPreferences:` for the actuated direction, so
+UIKit swaps the scene space to 951x669 and the grid/dock/status re-flow
+(verified visually at 90 and 270); and the host window's orientation poll
+only re-applied the window turn when the panel size changed, so a rotation
+on the same panel left the window in the old aspect — it now follows the
+orientation change itself (animated turn, fold panel changes stay forced).
diff --git a/VPhoneExecutable/VPhoneVirtualization/UI/UserInterface/VPhoneVirtualMachineWindowController.swift b/VPhoneExecutable/VPhoneVirtualization/UI/UserInterface/VPhoneVirtualMachineWindowController.swift
index 30be45e5..5a2b991a 100644
--- a/VPhoneExecutable/VPhoneVirtualization/UI/UserInterface/VPhoneVirtualMachineWindowController.swift
+++ b/VPhoneExecutable/VPhoneVirtualization/UI/UserInterface/VPhoneVirtualMachineWindowController.swift
@@ -304,11 +304,18 @@ class VPhoneVirtualMachineWindowController: NSObject, NSWindowDelegate {
if bounds[0].doubleValue == 0, bounds[1].doubleValue == 0,
(active == CGSize(width: 466, height: 678) || active == CGSize(width: 669, height: 951)),
active.width <= backing.width, active.height <= backing.height {
- let changed = panelSize != active
+ let changedPanel = panelSize != active
panelSize = active
container.panelSize = active
control.interfaceOrientation = orientation
- if changed { applyOrientation(orientation, to: window, force: true) }
+ // A rotation keeps the panel and only turns the guest;
+ // the window must follow the orientation change itself,
+ // not just a fold's panel-size change.
+ if changedPanel {
+ applyOrientation(orientation, to: window, force: true)
+ } else if container.orientation != orientation {
+ applyOrientation(orientation, to: window, force: false)
+ }
return
}
}
diff --git a/VPhoneGuestComponents/FoldDisplay/libvphonefolddisplay.m b/VPhoneGuestComponents/FoldDisplay/libvphonefolddisplay.m
index 2a7a3cea..77324316 100644
--- a/VPhoneGuestComponents/FoldDisplay/libvphonefolddisplay.m
+++ b/VPhoneGuestComponents/FoldDisplay/libvphonefolddisplay.m
@@ -3022,6 +3022,13 @@ static void vpRefreshNativeOrientationActuation(void) {
((void (*)(id, SEL, NSInteger, id, CGFloat, BOOL, id))objc_msgSend)(app, selector,
direction, scene, 0, YES, @"vphone native orientation actuation refresh");
vpFoldDisplayLog([NSString stringWithFormat:@"orientation actuation: native callback direction=%ld", (long)direction]);
+ // The Main mode keeps portrait dimensions on this platform, so a
+ // rotation also needs UIKit to re-deliver the scene's coordinate
+ // space; otherwise the portrait layout renders sideways inside the
+ // rotated framebuffer. The public geometry request for the actuated
+ // direction makes the space swap (951x669) and the icon family and
+ // windows re-flow.
+ vpRequestSceneGeometry(scene, direction);
} @catch (NSException *exception) {
vpFoldDisplayLog([NSString stringWithFormat:@"orientation actuation exception: %@", exception.reason]);
}