diff --git a/extras/AudioPluginHost/Source/UI/PluginWindow.h b/extras/AudioPluginHost/Source/UI/PluginWindow.h index 40160cd4c0..212d28ba89 100644 --- a/extras/AudioPluginHost/Source/UI/PluginWindow.h +++ b/extras/AudioPluginHost/Source/UI/PluginWindow.h @@ -175,6 +175,8 @@ public: setResizable (ui->isResizable(), false); } + setConstrainer (&constrainer); + #if JUCE_IOS || JUCE_ANDROID const auto screenBounds = Desktop::getInstance().getDisplays().getTotalBounds (true).toFloat(); const auto scaleFactor = jmin ((screenBounds.getWidth() - 50.0f) / (float) getWidth(), @@ -233,6 +235,38 @@ public: } private: + class DecoratorConstrainer : public BorderedComponentBoundsConstrainer + { + public: + explicit DecoratorConstrainer (DocumentWindow& windowIn) + : window (windowIn) {} + + ComponentBoundsConstrainer* getWrappedConstrainer() const override + { + auto* editor = dynamic_cast (window.getContentComponent()); + return editor != nullptr ? editor->getConstrainer() : nullptr; + } + + BorderSize getAdditionalBorder() const override + { + const auto nativeFrame = [&]() -> BorderSize + { + if (auto* peer = window.getPeer()) + if (const auto frameSize = peer->getFrameSizeIfPresent()) + return *frameSize; + + return {}; + }(); + + return nativeFrame.addedTo (window.getContentComponentBorder()); + } + + private: + DocumentWindow& window; + }; + + DecoratorConstrainer constrainer { *this }; + float getDesktopScaleFactor() const override { return 1.0f; } static AudioProcessorEditor* createProcessorEditor (AudioProcessor& processor, @@ -257,10 +291,21 @@ private: return {}; } - if (type == PluginWindow::Type::generic) return new GenericAudioProcessorEditor (processor); - if (type == PluginWindow::Type::programs) return new ProgramAudioProcessorEditor (processor); - if (type == PluginWindow::Type::audioIO) return new IOConfigurationWindow (processor); - if (type == PluginWindow::Type::debug) return new PluginDebugWindow (processor); + if (type == PluginWindow::Type::generic) + { + auto* result = new GenericAudioProcessorEditor (processor); + result->setResizeLimits (200, 300, 1'000, 10'000); + return result; + } + + if (type == PluginWindow::Type::programs) + return new ProgramAudioProcessorEditor (processor); + + if (type == PluginWindow::Type::audioIO) + return new IOConfigurationWindow (processor); + + if (type == PluginWindow::Type::debug) + return new PluginDebugWindow (processor); jassertfalse; return {};