diff --git a/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h b/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h index 85ffae7d46..32ea7a2f06 100644 --- a/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h +++ b/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h @@ -940,11 +940,17 @@ private: BorderSize computeBorder() const { - const auto outer = owner.getContentComponentBorder(); - return { outer.getTop() + (shouldShowNotification ? NotificationArea::height : 0), - outer.getLeft(), - outer.getBottom(), - outer.getRight() }; + const auto nativeFrame = [&]() -> BorderSize + { + if (auto* peer = owner.getPeer()) + if (const auto frameSize = peer->getFrameSizeIfPresent()) + return *frameSize; + + return {}; + }(); + + return nativeFrame.addedTo (owner.getContentComponentBorder()) + .addedTo (BorderSize { shouldShowNotification ? NotificationArea::height : 0, 0, 0, 0 }); } private: diff --git a/modules/juce_graphics/geometry/juce_BorderSize.h b/modules/juce_graphics/geometry/juce_BorderSize.h index ea94102766..7510cb35cd 100644 --- a/modules/juce_graphics/geometry/juce_BorderSize.h +++ b/modules/juce_graphics/geometry/juce_BorderSize.h @@ -40,6 +40,8 @@ namespace juce template class BorderSize { + auto tie() const { return std::tie (top, left, bottom, right); } + public: //============================================================================== /** Creates a null border. @@ -98,10 +100,10 @@ public: /** Returns a rectangle with these borders removed from it. */ Rectangle subtractedFrom (const Rectangle& original) const noexcept { - return Rectangle (original.getX() + left, - original.getY() + top, - original.getWidth() - (left + right), - original.getHeight() - (top + bottom)); + return { original.getX() + left, + original.getY() + top, + original.getWidth() - (left + right), + original.getHeight() - (top + bottom) }; } /** Removes this border from a given rectangle. */ @@ -113,30 +115,40 @@ public: /** Returns a rectangle with these borders added around it. */ Rectangle addedTo (const Rectangle& original) const noexcept { - return Rectangle (original.getX() - left, - original.getY() - top, - original.getWidth() + (left + right), - original.getHeight() + (top + bottom)); + return { original.getX() - left, + original.getY() - top, + original.getWidth() + (left + right), + original.getHeight() + (top + bottom) }; } - /** Adds this border around a given rectangle. */ void addTo (Rectangle& rectangle) const noexcept { rectangle = addedTo (rectangle); } - //============================================================================== - bool operator== (const BorderSize& other) const noexcept + /** Removes this border from another border. */ + BorderSize subtractedFrom (const BorderSize& other) const noexcept { - return top == other.top && left == other.left && bottom == other.bottom && right == other.right; + return { other.top - top, + other.left - left, + other.bottom - bottom, + other.right - right }; } - bool operator!= (const BorderSize& other) const noexcept + /** Adds this border to another border. */ + BorderSize addedTo (const BorderSize& other) const noexcept { - return ! operator== (other); + return { other.top + top, + other.left + left, + other.bottom + bottom, + other.right + right }; } + //============================================================================== + bool operator== (const BorderSize& other) const noexcept { return tie() == other.tie(); } + bool operator!= (const BorderSize& other) const noexcept { return tie() != other.tie(); } + private: //============================================================================== ValueType top{}, left{}, bottom{}, right{};