From 1b0911dda66ded58495a3a3ac0f46df2015b5ae8 Mon Sep 17 00:00:00 2001 From: reuk Date: Mon, 8 Dec 2025 14:07:08 +0000 Subject: [PATCH] iOS: Always update peer bounds when window scene coordinate space is updated --- .../native/juce_UIViewComponentPeer_ios.mm | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/modules/juce_gui_basics/native/juce_UIViewComponentPeer_ios.mm b/modules/juce_gui_basics/native/juce_UIViewComponentPeer_ios.mm index 2b4f789f2e..a2f085e816 100644 --- a/modules/juce_gui_basics/native/juce_UIViewComponentPeer_ios.mm +++ b/modules/juce_gui_basics/native/juce_UIViewComponentPeer_ios.mm @@ -53,8 +53,8 @@ public: void setWindowScene (UIWindowScene* x) API_AVAILABLE (ios (13.0)) { - if (std::exchange (windowScene, x) != x) - listeners.call ([] (auto& l) { l.windowSceneChanged(); }); + windowScene = x; + listeners.call ([] (auto& l) { l.windowSceneChanged(); }); } UIWindowScene* getWindowScene() const API_AVAILABLE (ios (13.0)) @@ -549,6 +549,23 @@ private: if (isSharedWindow) return; + const auto sceneDidChange = std::invoke ([&] + { + if (@available (iOS 13, *)) + { + auto* currentScene = window != nil ? [window windowScene] : nil; + return windowSceneTracker->getWindowScene() != currentScene; + } + + return false; + }); + + if (! sceneDidChange) + { + updateScreenBounds(); + return; + } + auto* newWindow = std::invoke ([&]() -> JuceUIWindow* { if (@available (iOS 13, *))