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

Hi @dave96,

In addition to my answer on this post:

the following diff should stop the peer from re-creating itself when you use setAlwaysOnTop. Can you confirm that this works for you? If yes, then I’ll push it to develop:

--- a/modules/juce_gui_basics/native/juce_linux_X11_Windowing.cpp
+++ b/modules/juce_gui_basics/native/juce_linux_X11_Windowing.cpp
@@ -1818,9 +1818,18 @@ public:
		 return {};
	 }

-    bool setAlwaysOnTop (bool /* alwaysOnTop */) override
+    bool setAlwaysOnTop (bool alwaysOnTop) override
	 {
-        return false;
+        if (alwaysOnTop != isAlwaysOnTop)
+        {
+            numAlwaysOnTopPeers += (alwaysOnTop ? 1 : -1);
+            jassert (numAlwaysOnTopPeers >= 0);
+
+            ScopedXLock xlock (display);
+            setWindowType();
+        }
+
+        return true;
	 }

	 void toFront (bool makeActive) override