diff --git a/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp b/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp index e5bc54767a..06b485c9ef 100644 --- a/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp +++ b/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp @@ -488,7 +488,7 @@ private: #if JUCE_WINDOWS setSize (w, h); #else - if (owner.macHostWindow != nullptr) + if (owner.macHostWindow != nullptr && ! getHostType().isWavelab()) juce::setNativeHostWindowSize (owner.macHostWindow, this, w, h, owner.isNSView); #endif @@ -496,6 +496,9 @@ private: { ViewRect newSize (0, 0, w, h); owner.plugFrame->resizeView (&owner, &newSize); + + if (getHostType().isWavelab()) + setBounds (0, 0, w, h); } } } diff --git a/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.mm b/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.mm index 72d3b518a5..73a0d88b62 100644 --- a/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.mm +++ b/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.mm @@ -196,76 +196,76 @@ namespace juce static void detachComponentFromWindowRef (Component* comp, void* nsWindow, bool isHIView) { - #if JUCE_64BIT - (void) nsWindow; (void) isHIView; - comp->removeFromDesktop(); - #else - //treat NSView like 64bit - if (! isHIView) + JUCE_AUTORELEASEPOOL { + #if ! JUCE_64BIT + if (isHIView) + { + JUCE_AUTORELEASEPOOL + { + EventHandlerRef ref = (EventHandlerRef) (void*) (pointer_sized_int) + comp->getProperties() ["boundsEventRef"].toString().getHexValue64(); + RemoveEventHandler (ref); + + removeWindowHidingHooks (comp); + + HIViewRef dummyView = (HIViewRef) (void*) (pointer_sized_int) + comp->getProperties() ["dummyViewRef"].toString().getHexValue64(); + + if (HIViewIsValid (dummyView)) + CFRelease (dummyView); + + NSWindow* hostWindow = (NSWindow*) nsWindow; + NSView* pluginView = (NSView*) comp->getWindowHandle(); + NSWindow* pluginWindow = [pluginView window]; + + [hostWindow removeChildWindow: pluginWindow]; + comp->removeFromDesktop(); + + [hostWindow release]; + } + + // The event loop needs to be run between closing the window and deleting the plugin, + // presumably to let the cocoa objects get tidied up. Leaving out this line causes crashes + // in Live and Reaper when you delete the plugin with its window open. + // (Doing it this way rather than using a single longer timout means that we can guarantee + // how many messages will be dispatched, which seems to be vital in Reaper) + for (int i = 20; --i >= 0;) + MessageManager::getInstance()->runDispatchLoopUntil (1); + + return; + } + #endif + + (void) nsWindow; (void) isHIView; comp->removeFromDesktop(); } - else - { - JUCE_AUTORELEASEPOOL - { - EventHandlerRef ref = (EventHandlerRef) (void*) (pointer_sized_int) - comp->getProperties() ["boundsEventRef"].toString().getHexValue64(); - RemoveEventHandler (ref); - - removeWindowHidingHooks (comp); - - HIViewRef dummyView = (HIViewRef) (void*) (pointer_sized_int) - comp->getProperties() ["dummyViewRef"].toString().getHexValue64(); - - if (HIViewIsValid (dummyView)) - CFRelease (dummyView); - - NSWindow* hostWindow = (NSWindow*) nsWindow; - NSView* pluginView = (NSView*) comp->getWindowHandle(); - NSWindow* pluginWindow = [pluginView window]; - - [hostWindow removeChildWindow: pluginWindow]; - comp->removeFromDesktop(); - - [hostWindow release]; - } - - // The event loop needs to be run between closing the window and deleting the plugin, - // presumably to let the cocoa objects get tidied up. Leaving out this line causes crashes - // in Live and Reaper when you delete the plugin with its window open. - // (Doing it this way rather than using a single longer timout means that we can guarantee - // how many messages will be dispatched, which seems to be vital in Reaper) - for (int i = 20; --i >= 0;) - MessageManager::getInstance()->runDispatchLoopUntil (1); - } - #endif } static void setNativeHostWindowSize (void* nsWindow, Component* component, int newWidth, int newHeight, bool isHIView) { - (void) nsWindow; (void) isHIView; - JUCE_AUTORELEASEPOOL { - #if JUCE_64BIT - component->setSize (newWidth, newHeight); - #else - if (! isHIView) - { //Treat NSView like 64bit: - component->setSize (newWidth, newHeight); - } - else if (HIViewRef dummyView = (HIViewRef) (void*) (pointer_sized_int) - component->getProperties() ["dummyViewRef"].toString().getHexValue64()) + #if ! JUCE_64BIT + if (isHIView) { - HIRect frameRect; - HIViewGetFrame (dummyView, &frameRect); - frameRect.size.width = newWidth; - frameRect.size.height = newHeight; - HIViewSetFrame (dummyView, &frameRect); + if (HIViewRef dummyView = (HIViewRef) (void*) (pointer_sized_int) + component->getProperties() ["dummyViewRef"].toString().getHexValue64()) + { + HIRect frameRect; + HIViewGetFrame (dummyView, &frameRect); + frameRect.size.width = newWidth; + frameRect.size.height = newHeight; + HIViewSetFrame (dummyView, &frameRect); + } + + return; } #endif - } + + (void) nsWindow; (void) isHIView; + component->setSize (newWidth, newHeight); + } } } // (juce namespace) diff --git a/modules/juce_gui_basics/components/juce_Component.cpp b/modules/juce_gui_basics/components/juce_Component.cpp index 303194bb4f..0b5e5929eb 100644 --- a/modules/juce_gui_basics/components/juce_Component.cpp +++ b/modules/juce_gui_basics/components/juce_Component.cpp @@ -2064,7 +2064,10 @@ void Component::paintEntireComponent (Graphics& g, const bool ignoreAlphaLevel) // If sizing a top-level-window and the OS paint message is delivered synchronously // before resized() is called, then we'll invoke the callback here, to make sure // the components inside have had a chance to sort their sizes out.. - sendMovedResizedMessagesIfPending(); + #if JUCE_DEBUG + if (! flags.isInsidePaintCall) // (avoids an assertion in plugins hosted in WaveLab) + #endif + sendMovedResizedMessagesIfPending(); #if JUCE_DEBUG flags.isInsidePaintCall = true;