From 6c46512e8bb458b70b92d483c41fe1bdf82f8521 Mon Sep 17 00:00:00 2001 From: reuk Date: Fri, 2 Jul 2021 16:12:57 +0100 Subject: [PATCH] NSViewComponent: Ensure NSView follows size of top-level component This commit reverts part of f73f8ee84 which introduced an issue when resizing a subcomponent with an attached OpenGLContext. More details of the issue can be seen at https://github.com/juce-framework/JUCE/issues/914. --- .../juce_gui_extra/native/juce_mac_NSViewComponent.mm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules/juce_gui_extra/native/juce_mac_NSViewComponent.mm b/modules/juce_gui_extra/native/juce_mac_NSViewComponent.mm index f300962259..fa3f124b24 100644 --- a/modules/juce_gui_extra/native/juce_mac_NSViewComponent.mm +++ b/modules/juce_gui_extra/native/juce_mac_NSViewComponent.mm @@ -128,6 +128,17 @@ public: [view release]; } + void componentMovedOrResized (Component& comp, bool wasMoved, bool wasResized) override + { + ComponentMovementWatcher::componentMovedOrResized (comp, wasMoved, wasResized); + + // The ComponentMovementWatcher version of this method avoids calling + // us when the top-level comp is resized, but if we're listening to the + // top-level comp we still want the NSView to track its size. + if (comp.isOnDesktop() && wasResized) + componentMovedOrResized (wasMoved, wasResized); + } + void componentMovedOrResized (bool /*wasMoved*/, bool /*wasResized*/) override { if (auto* peer = owner.getTopLevelComponent()->getPeer())