コード例 #1
0
ファイル: tray.py プロジェクト: rudresh2319/Xpra
 def dock_tray(self, xid):
     root = gtk.gdk.get_default_root_window()
     window = gtk.gdk.window_foreign_new(xid)
     w, h = window.get_geometry()[2:4]
     event_mask = gtk.gdk.STRUCTURE_MASK | gtk.gdk.EXPOSURE_MASK | gtk.gdk.PROPERTY_CHANGE_MASK
     window.set_events(event_mask=event_mask)
     add_event_receiver(window, self)
     w = max(1, min(200, w))
     h = max(1, min(200, h))
     log("dock_tray(%s) window=%s, geometry=%s, visual.depth=%s", xid, window, window.get_geometry(), window.get_visual().depth)
     event_mask = gtk.gdk.STRUCTURE_MASK | gtk.gdk.EXPOSURE_MASK | gtk.gdk.PROPERTY_CHANGE_MASK
     tray_window = gtk.gdk.Window(root, width=w, height=h,
                                        window_type=gtk.gdk.WINDOW_TOPLEVEL,
                                        event_mask = event_mask,
                                        wclass=gtk.gdk.INPUT_OUTPUT,
                                        title="TrayWindow",
                                        x=-200, y=-200,
                                        override_redirect=True,
                                        visual=window.get_visual(),
                                        colormap=window.get_colormap())
     log("dock_tray(%s) setting tray properties", xid)
     set_tray_window(tray_window, window)
     tray_window.show()
     self.tray_windows[window] = tray_window
     self.window_trays[tray_window] = window
     log("dock_tray(%s) resizing and reparenting", xid)
     window.resize(w, h)
     withdraw(window)
     reparent(window, tray_window, 0, 0)
     map_raised(window)
     log("dock_tray(%s) new tray container window %s", xid, get_xwindow(tray_window))
     tray_window.invalidate_rect(gtk.gdk.Rectangle(width=w, height=h), True)
     embedder = get_xwindow(tray_window)
     send_xembed_message(window, XEMBED_EMBEDDED_NOTIFY, 0, embedder, XEMBED_VERSION)
コード例 #2
0
ファイル: tray.py プロジェクト: rudresh2319/Xpra
 def undock(window):
     log("undocking %s", window)
     withdraw(window)
     reparent(window, root, 0, 0)
     map_raised(window)