Add -w XID command line argument and when it's provided
try to reparent to given window. Depends on python Xlib.

Signed-off-by: Pavel Shramov <shra...@mexmat.net>
---
 src/hal/user_comps/gladevcp.py |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/src/hal/user_comps/gladevcp.py b/src/hal/user_comps/gladevcp.py
index bc9a2bf..7ced1b9 100644
--- a/src/hal/user_comps/gladevcp.py
+++ b/src/hal/user_comps/gladevcp.py
@@ -66,19 +66,22 @@ def main():
     """
 
     try:
-        opts, args = getopt.getopt(sys.argv[1:], "c:g:")
+        opts, args = getopt.getopt(sys.argv[1:], "c:g:w:")
     except getopt.GetoptError, detail:
         print detail
         usage()
         sys.exit(1)
     window_geometry = ""
     component_name = None
+    parent = None
     for o, a in opts:
         print o,a
         if o == "-c":
             component_name = a
         if o == "-g": 
             window_geometry = a
+        if o == "-w":
+            parent = int(a, 0)
     try:
         xmlname = args[0]
     except:
@@ -119,6 +122,18 @@ def main():
         builder.connect_signals(builder)
     window.show()
 
+    if parent:
+        from Xlib import display
+        from Xlib.xobject import drawable
+        d = display.Display()
+        w = drawable.Window(d.display, window.window.xid, 0)
+        # Honor XEmbed spec
+        atom = d.get_atom('_XEMBED_INFO')
+        w.change_property(atom, atom, 32, [0, 1])
+        w.reparent(parent, 0, 0)
+        w.map()
+        d.sync()
+
     # for window resize and or position options
     if "+" in window_geometry:
         try:
-- 
1.7.1

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to