From d4e802016aac5436abbbdd82314a29e061aa193a Mon Sep 17 00:00:00 2001 From: reuk Date: Thu, 11 Mar 2021 15:19:23 +0000 Subject: [PATCH] VST3: Fix issue where Ardour would repeatedly try to resize editors Ardour seems to listen to the bounds of the plugin window, and will call `onSize` on the plugin editor when move/resize events are sent to the X window - even if the size of the window didn't really change. This can result in an infinite resize loop, where calling `onSize` on the VST3 instance sends a resize event to the plugin window, and this event causes Ardour to call `onSize` on the plugin view. To get around this, the Linux ComponentPeer will no longer request a bounds change from the window system if the requested bounds are the same as the current bounds. --- modules/juce_gui_basics/native/juce_linux_Windowing.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/juce_gui_basics/native/juce_linux_Windowing.cpp b/modules/juce_gui_basics/native/juce_linux_Windowing.cpp index 2f0e56a7e1..ff742641b8 100644 --- a/modules/juce_gui_basics/native/juce_linux_Windowing.cpp +++ b/modules/juce_gui_basics/native/juce_linux_Windowing.cpp @@ -83,8 +83,13 @@ public: //============================================================================== void setBounds (const Rectangle& newBounds, bool isNowFullScreen) override { - bounds = newBounds.withSize (jmax (1, newBounds.getWidth()), - jmax (1, newBounds.getHeight())); + const auto correctedNewBounds = newBounds.withSize (jmax (1, newBounds.getWidth()), + jmax (1, newBounds.getHeight())); + + if (bounds == correctedNewBounds && fullScreen == isNowFullScreen) + return; + + bounds = correctedNewBounds; updateScaleFactorFromNewBounds (bounds, false);