Supporting nativeWindowToAttachTo in linux


#1
--- a/juce/src/native/linux/juce_linux_Windowing.cpp	2011-02-27 22:09:16.000000000 +0100
+++ b/juce/src/native/linux/juce_linux_Windowing.cpp	2011-03-02 23:09:41.000000000 +0100
@@ -747,10 +747,11 @@
 {
 public:
     //==============================================================================
-    LinuxComponentPeer (Component* const component, const int windowStyleFlags)
+    LinuxComponentPeer (Component* const component, const int windowStyleFlags, Window parentToAddTo_)
         : ComponentPeer (component, windowStyleFlags),
           windowH (0),
           parentWindow (0),
+          parentToAddTo (parentToAddTo_),
           wx (0),
           wy (0),
           ww (0),
@@ -1877,7 +1878,7 @@
     ScopedPointer <LinuxRepaintManager> repainter;
 
     friend class LinuxRepaintManager;
-    Window windowH, parentWindow;
+    Window windowH, parentWindow, parentToAddTo;
     int wx, wy, ww, wh;
     Image taskbarImage;
     bool fullScreen, mapped;
@@ -2160,7 +2161,7 @@
         swa.colormap = colormap;
         swa.event_mask = getAllEventsMask();
 
-        windowH = XCreateWindow (display, root,
+        windowH = XCreateWindow (display, (parentToAddTo != 0) ? parentToAddTo : root,
                                  0, 0, 1, 1,
                                  0, depth, InputOutput, visual,
                                  CWBorderPixel | CWColormap | CWBackPixmap | CWEventMask,
@@ -2661,9 +2662,9 @@
 }
 
 //==============================================================================
-ComponentPeer* Component::createNewPeer (int styleFlags, void* /*nativeWindowToAttachTo*/)
+ComponentPeer* Component::createNewPeer (int styleFlags, void* nativeWindowToAttachTo)
 {
-    return new LinuxComponentPeer (this, styleFlags);
+    return new LinuxComponentPeer (this, styleFlags, (Window)nativeWindowToAttachTo);
 }

This can be useful to update the VST wrapper code and not use XReparentWindow at all. Cheers !


#2

Did I never add that to the linux code?? Could have sworn I’d already done that… Oh well, thanks for the heads-up, I’ll sort that out!