setSize() broken for Mac VST3 in FL Studio on tip of develop

Hello JUCE Team,

We are seeing strange behavior with setSize() in FL Studio. The following gif is a default JUCE Audio Plugin Project, with a button which updates the size with setSize(). Upon resize, the plugin UI is shifted within the window and big swaths of white are left around it. This happens for VST3 on Mac in FL Studio 20. The plugin in the gif was built from the tip of develop. Thanks for your help!

ScreenFlow

Here’s the code in the demo:

PluginEditor.cpp:

/*
  ==============================================================================

    This file was auto-generated!

    It contains the basic framework code for a JUCE plugin editor.

  ==============================================================================
*/

#include "PluginProcessor.h"
#include "PluginEditor.h"

//==============================================================================
ResizingTestAudioProcessorEditor::ResizingTestAudioProcessorEditor (ResizingTestAudioProcessor& p)
    : AudioProcessorEditor (&p), processor (p)
, b("resize me!")
{
    width = 400.f;
    height = 300.f;

    setSize (width, height);

    addAndMakeVisible(b);

    std::function<void()> func = std::bind(&ResizingTestAudioProcessorEditor::resizeRandom, this);
    b.onClick = func;
}

ResizingTestAudioProcessorEditor::~ResizingTestAudioProcessorEditor()
{
}

//==============================================================================
void ResizingTestAudioProcessorEditor::paint (Graphics& g)
{
    // (Our component is opaque, so we must completely fill the background with a solid colour)
    g.fillAll (getLookAndFeel().findColour (ResizableWindow::backgroundColourId));

    g.setColour (Colours::white);
    g.setFont (15.0f);
    g.drawFittedText ("Hello World!", getLocalBounds(), Justification::centred, 1);
}

void ResizingTestAudioProcessorEditor::resized()
{
    // This is generally where you'll want to lay out the positions of any
    // subcomponents in your editor..
    b.setBounds(width / 4, height / 4, width / 2, height / 2);
}

void ResizingTestAudioProcessorEditor::resizeRandom()
{
    width = floor((float(rand()) / RAND_MAX) * 800.f) + 400.f;
    height = floor(width / 2.f);

    setSize(width, height);
}

PluginEditor.h:

/*
  ==============================================================================

    This file was auto-generated!

    It contains the basic framework code for a JUCE plugin editor.

  ==============================================================================
*/

#pragma once

#include "../JuceLibraryCode/JuceHeader.h"
#include "PluginProcessor.h"

//==============================================================================
/**
*/
class ResizingTestAudioProcessorEditor  : public AudioProcessorEditor
{
public:
    ResizingTestAudioProcessorEditor (ResizingTestAudioProcessor&);
    ~ResizingTestAudioProcessorEditor();

    //==============================================================================
    void paint (Graphics&) override;
    void resized() override;

private:
    // This reference is provided as a quick way for your editor to
    // access the processor object that created it.
    ResizingTestAudioProcessor& processor;

    TextButton b;

    float width, height;

    void resizeRandom();

    JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ResizingTestAudioProcessorEditor)
};

Thanks for the report. I’ve pushed a fix that will be on the develop branch shortly.

2 Likes

Thanks for the fix! We’ve tested it in our plugins and everything looks great.