Resizing display fixes in the audio wrappers

These are little modifications I made in the AU/VST wrappers to fix resizing issues.

The plugin I am developing can have diffrent sizes and in some cases the plugin was not properly displayed with the new size.

  1. With Cubase 64 MAC, the problem was weird. the plugin was shifted down from the difference of height between the two sizes. So I modified the top left postition in childBoundsChanged () (in the VST wrapper) to display it right.


[code] void childBoundsChanged (Component* child)
child->setTopLeftPosition (0, 0);

        const int cw = child->getWidth();
        const int ch = child->getHeight();

// ----RL [
// Height shift problem in Cubase Mac 64
#ifdef LP64
child->getParentComponent()->setTopLeftPosition (0, child->getParentComponent()->getHeight() - ch);
// ----RL ]

        wrapper.resizeHostWindow (cw, ch);

       #if ! JUCE_LINUX // setSize() on linux causes renoise and energyxt to fail.
        setSize (cw, ch);
        XResizeWindow (display, (Window) getWindowHandle(), cw, ch);

       #if JUCE_MAC
        wrapper.resizeHostWindow (cw, ch);  // (doing this a second time seems to be necessary in tracktion)
  1. In Reaper Mac (32/64 bit), there was also a problem with the AU resizing.
    The plugin window was not taking into account the new size of the plugin. So I updated windowRect.size in childBoundsChanged () in

[code] void childBoundsChanged (Component*)
Component* editor = getChildComponent(0);

    if (editor != nullptr)
        const int w = jmax (32, editor->getWidth());
        const int h = jmax (32, editor->getHeight());

        if (getWidth() != w || getHeight() != h)
            setSize (w, h);

        NSView* view = (NSView*) getWindowHandle();
        NSRect r = [[view superview] frame];

// ----RL [
NSRect windowRect = [[view window] frame];
windowRect.size.width += editor->getWidth() - r.size.width;
windowRect.size.height += editor->getHeight() - r.size.height;
[[view window] setFrame: windowRect display: YES ];

// ----RL ]

        r.size.width = editor->getWidth();
        r.size.height = editor->getHeight();
        [[view superview] setFrame: r];
        [view setFrame: NSMakeRect (0, 0, editor->getWidth(), editor->getHeight())];
        [view setNeedsDisplay: YES];

May be that would be worth adding these fixes to the library. What do you think about it Jules?


The first bit can be simplified to this, right?

#if JUCE_MAC && JUCE_64BIT setTopLeftPosition (0, getHeight() - ch); #endif

The logic of setting its position like that seems a bit ropey to me, but I can’t think of a better idea, so if it works, I’ll add it until we can think of something better!

But the other AU fix definitely isn’t safe. The way it’s supposed to work is that the plugin changes its NSView size, and the host resizes its window (or does whatever is appropriate) in response to that. If you try to mess with the host’s window directly, it’ll totally screw up a lot of hosts because you can’t possibly know how they want their window to be arranged. They might even have multiple plugin views in one window! If this is a reaper bug, then it should either be fixed in reaper, or if a bodge is unavoidable, it’d need to be carefully restricted to only the version of reaper that you’re testing it on…

Yes indeed!

For the second bug, i am going to add a Reaper only case to the lines I’ve added for now and talk about it on the Reaper forum.