mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Workaround for VST3 plugin resizing in Wavelab.
This commit is contained in:
parent
fe61c37d93
commit
df9701430a
3 changed files with 66 additions and 60 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue