Пример #1
0
 def cleanup(self):
     log("Tray.cleanup()")
     root = gtk.gdk.get_default_root_window()
     owner = myGetSelectionOwner(root, SELECTION)
     if owner==get_xwindow(self.tray_window):
         mySetSelectionOwner(root, const["XNone"], SELECTION)
     else:
         log.warn("Tray.cleanup() we were no longer the selection owner")
     remove_event_receiver(self.tray_window, self)
     def undock(window):
         log("undocking %s", window)
         withdraw(window)
         reparent(window, root, 0, 0)
         map_raised(window)
     for window, tray_window in self.tray_windows.items():
         trap.swallow_synced(undock, window)
         tray_window.destroy()
     self.tray_window.destroy()
     self.tray_window = None
     log("Tray.cleanup() done")
Пример #2
0
 def setup_tray_window(self):
     display = gtk.gdk.display_get_default()
     root = gtk.gdk.get_default_root_window()
     screen = root.get_screen()
     if TRANSPARENCY:
         colormap, visual = screen.get_rgba_colormap(
         ), screen.get_rgba_visual()
     if colormap is None or visual is None:
         log.warn("setup tray: using rgb visual fallback")
         colormap, visual = screen.get_rgb_colormap(
         ), screen.get_rgb_visual()
     assert colormap is not None and visual is not None, "failed to obtain visual or colormap"
     owner = myGetSelectionOwner(root, SELECTION)
     log("setup tray: current selection owner=%s", owner)
     if owner != const["XNone"]:
         raise Exception("%s already owned by %s" % (SELECTION, owner))
     self.tray_window = gtk.gdk.Window(root,
                                       width=1,
                                       height=1,
                                       window_type=gtk.gdk.WINDOW_TOPLEVEL,
                                       event_mask=0,
                                       wclass=gtk.gdk.INPUT_OUTPUT,
                                       title="Xpra-SystemTray",
                                       visual=visual,
                                       colormap=colormap)
     set_tray_visual(self.tray_window, visual)
     set_tray_orientation(self.tray_window, TRAY_ORIENTATION_HORZ)
     log("setup tray: tray window %s", get_xwindow(self.tray_window))
     display.request_selection_notification(SELECTION)
     setsel = mySetSelectionOwner(root, self.tray_window, SELECTION)
     log("setup tray: set selection owner returned %s", setsel)
     event_mask = const["StructureNotifyMask"]
     sendClientMessage(root, root, False, event_mask, "MANAGER",
                       const["CurrentTime"], SELECTION,
                       get_xwindow(self.tray_window), 0, 0)
     owner = myGetSelectionOwner(root, SELECTION)
     #FIXME: cleanup if we fail!
     assert owner == get_xwindow(
         self.tray_window
     ), "we failed to get ownership of the tray selection"
     add_event_receiver(self.tray_window, self)
     log("setup tray: done")
Пример #3
0
 def setup_tray_window(self):
     display = gtk.gdk.display_get_default()
     root = gtk.gdk.get_default_root_window()
     screen = root.get_screen()
     if TRANSPARENCY:
         colormap, visual = screen.get_rgba_colormap(), screen.get_rgba_visual()
     if colormap is None or visual is None:
         log.warn("setup tray: using rgb visual fallback")
         colormap, visual = screen.get_rgb_colormap(), screen.get_rgb_visual()
     assert colormap is not None and visual is not None, "failed to obtain visual or colormap"
     owner = myGetSelectionOwner(root, SELECTION)
     log("setup tray: current selection owner=%s", owner)
     if owner!=const["XNone"]:
         raise Exception("%s already owned by %s" % (SELECTION, owner))
     self.tray_window = gtk.gdk.Window(root, width=1, height=1,
                                        window_type=gtk.gdk.WINDOW_TOPLEVEL,
                                        event_mask = 0,
                                        wclass=gtk.gdk.INPUT_OUTPUT,
                                        title="Xpra-SystemTray",
                                        visual=visual,
                                        colormap=colormap)
     set_tray_visual(self.tray_window, visual)
     set_tray_orientation(self.tray_window, TRAY_ORIENTATION_HORZ)
     log("setup tray: tray window %s", get_xwindow(self.tray_window))
     display.request_selection_notification(SELECTION)
     setsel = mySetSelectionOwner(root, self.tray_window, SELECTION)
     log("setup tray: set selection owner returned %s", setsel)
     event_mask = const["StructureNotifyMask"]
     sendClientMessage(root, root, False, event_mask, "MANAGER",
                       const["CurrentTime"], SELECTION,
                       get_xwindow(self.tray_window), 0, 0)
     owner = myGetSelectionOwner(root, SELECTION)
     #FIXME: cleanup if we fail!
     assert owner==get_xwindow(self.tray_window), "we failed to get ownership of the tray selection"
     add_event_receiver(self.tray_window, self)
     log("setup tray: done")