1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

StandaloneFilterWindow: Fix window resizing bug on Linux

On some Linux distros, the audio settings dialog was opening with the
wrong size and position. The culprit seems to be the call to setSize()
which was called inside resized(). We now try to avoid calling setSize()
if we would do so inside a resized() call.
This commit is contained in:
reuk 2021-08-04 11:45:27 +01:00
parent 61e5f983d9
commit cef6974c7c

View file

@ -283,8 +283,11 @@ public:
if (auto* bus = processor->getBus (false, 0))
maxNumOutputs = jmax (0, bus->getDefaultLayout().size());
o.content.setOwned (new SettingsComponent (*this, deviceManager, maxNumInputs, maxNumOutputs));
o.content->setSize (500, 550);
auto content = std::make_unique<SettingsComponent> (*this, deviceManager, maxNumInputs, maxNumOutputs);
content->setSize (500, 550);
content->setToRecommendedSize();
o.content.setOwned (content.release());
o.dialogTitle = TRANS("Audio/MIDI Settings");
o.dialogBackgroundColour = o.content->getLookAndFeel().findColour (ResizableWindow::backgroundColourId);
@ -542,6 +545,8 @@ private:
void resized() override
{
const ScopedValueSetter<bool> scope (isResizing, true);
auto r = getLocalBounds();
if (owner.getProcessorHasPotentialFeedbackLoop())
@ -561,9 +566,12 @@ private:
void childBoundsChanged (Component* childComp) override
{
if (childComp != &deviceSelector)
return;
if (! isResizing && childComp == &deviceSelector)
setToRecommendedSize();
}
void setToRecommendedSize()
{
const auto extraHeight = [&]
{
if (! owner.getProcessorHasPotentialFeedbackLoop())
@ -583,6 +591,7 @@ private:
AudioDeviceSelectorComponent deviceSelector;
Label shouldMuteLabel;
ToggleButton shouldMuteButton;
bool isResizing = false;
//==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (SettingsComponent)