diff --git a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm index 0e88cb6b70..1ed8e31ade 100644 --- a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm +++ b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm @@ -2353,19 +2353,21 @@ private: #endif } - static NSRect windowWillUseStandardFrame (id self, SEL, NSWindow*, NSRect) + static NSRect windowWillUseStandardFrame (id self, SEL, NSWindow*, NSRect r) { if (auto* owner = getOwner (self)) { if (auto* constrainer = owner->getConstrainer()) { - return flippedScreenRect (makeNSRect (owner->getFrameSize().addedTo (owner->getComponent().getScreenBounds() - .withWidth (constrainer->getMaximumWidth()) - .withHeight (constrainer->getMaximumHeight())))); + const auto originalBounds = owner->getFrameSize().addedTo (owner->getComponent().getScreenBounds()).toFloat(); + const auto expanded = originalBounds.withWidth ((float) constrainer->getMaximumWidth()) + .withHeight ((float) constrainer->getMaximumHeight()); + const auto constrained = expanded.constrainedWithin (convertToRectFloat (flippedScreenRect (r))); + return flippedScreenRect (makeNSRect (constrained)); } } - return makeNSRect (Rectangle (10000, 10000)); + return r; } static BOOL windowShouldZoomToFrame (id self, SEL, NSWindow* window, NSRect frame)