Setting "alwaysOnTop (true)" for Linux Plugin Windows


I have a problem setting plugin windows to be always on top after construction. At first I thought this was a problem with the way we handle plugin windows but now I’ve been able to replicate it in the JUCE plugin host demo.

If you add the following code to the end of the PluginWindow constructor you’ll see after 5 seconds the plugin UI get incorrectly positioned and ence covers the title bar and any buttons that may be living there etc.

Component::SafePointer<Component> sp (this);
Timer::callAfterDelay (5000, [sp] () mutable { if (sp != nullptr) sp->setAlwaysOnTop (true); });

I think we need an additional call to componentMovedOrResized in VSTPluginWindow::componentPeerChanged. I.e.

void componentPeerChanged() override

    componentMovedOrResized (true, true);

Additionally, it seems that if you call setVisible (false) on a Linux window that is set to be always on top the window will disappear but the area that it covered will still block all mouse events. It’s as though there is an invisible window covering the UI. Any ideas if this is an easy fix?

Setting a Linux Window Always on Top Without Re-creating the Peer

Hi @dave96, sorry for the late reply on this. I think Jules already fixed the first issue with commit 1044015.

I’m struggling to reproduce the second issue though. I used your code and replaced the setAlwaysOnTop (true) to setVisible (false). The window does disappear after 5 seconds but I can click beneath the window with no problems.

Any better way to reproduce this?


The window needs to be setAlwaysOnTop first, and then hidden. Replace the code above with this:

Component::SafePointer<Component> sp (this);
Timer::callAfterDelay (3000, [sp] () mutable
                                 if (sp != nullptr)
                                     sp->setAlwaysOnTop (true); 

                                 Timer::callAfterDelay (3000, [sp] () mutable
                                     if (sp != nullptr)
                                         sp->setVisible (false); 

The open a plugin window and position it so that it partially covers the Plugin Host’s menu bar (as in my original screenshot). After 6 seconds, the window will close itself and you won’t get rollover UI indications or be able to click on the menu bar items that were covered by the window.


Hi @dave96, I think this simple commit on develop (cb8f9b3) may actually fix your issue. Can you confirm that this works for you?


Yes, you legend, I think this does solve the invisible window problem! Thanks so much for looking in to this!