Exemplo n.º 1
0
 def x11_init(self):
     X11ServerBase.x11_init(self)
     assert init_x11_filter() is True
     display = gtk.gdk.display_get_default()
     screens = display.get_n_screens()
     for n in range(screens):
         screen = display.get_screen(n)
         root = screen.get_root_window()
         add_event_receiver(root, self)
     add_catchall_receiver("xpra-motion-event", self)
     add_catchall_receiver("xpra-xkb-event", self)
     X11Keyboard.selectBellNotification(True)
Exemplo n.º 2
0
def main():
    from xpra.x11.gtk2 import gdk_display_source
    assert gdk_display_source
    from xpra.x11.gtk2.gdk_bindings import init_x11_filter, add_catchall_receiver #@UnresolvedImport
    init_x11_filter()

    root_window = gtk.gdk.get_default_root_window()
    root_window.set_events(root_window.get_events() | gtk.gdk.SUBSTRUCTURE_MASK)
    r = receiver()
    add_catchall_receiver("xpra-create-event", r)
    X11WindowBindings().substructureRedirect(root_window.xid)
    gtk.main()
Exemplo n.º 3
0
 def x11_init(self):
     X11ServerBase.x11_init(self)
     assert init_x11_filter() is True
     display = gtk.gdk.display_get_default()
     screens = display.get_n_screens()
     for n in range(screens):
         screen = display.get_screen(n)
         root = screen.get_root_window()
         add_event_receiver(root, self)
     add_catchall_receiver("xpra-motion-event", self)
     add_catchall_receiver("xpra-xkb-event", self)
     X11Keyboard.selectBellNotification(True)
Exemplo n.º 4
0
def main():
    from xpra.x11.gtk2 import gdk_display_source
    assert gdk_display_source
    from xpra.x11.gtk2.gdk_bindings import init_x11_filter, add_catchall_receiver  #@UnresolvedImport
    init_x11_filter()

    root_window = gtk.gdk.get_default_root_window()
    root_window.set_events(root_window.get_events()
                           | gtk.gdk.SUBSTRUCTURE_MASK)
    r = receiver()
    add_catchall_receiver("xpra-create-event", r)
    X11WindowBindings().substructureRedirect(root_window.xid)
    gtk.main()
Exemplo n.º 5
0
    def __init__(self, replace_other_wm, wm_name, display=None):
        gobject.GObject.__init__(self)

        if display is None:
            display = gtk.gdk.display_manager_get().get_default_display()
        self._display = display
        self._root = self._display.get_default_screen().get_root_window()
        self._wm_name = wm_name
        self._ewmh_window = None

        self._windows = {}
        # EWMH says we have to know the order of our windows oldest to
        # youngest...
        self._windows_in_order = []

        # Become the Official Window Manager of this year's display:
        self._wm_selection = ManagerSelection(self._display, "WM_S0")
        self._cm_wm_selection = ManagerSelection(self._display, "_NET_WM_CM_S0")
        self._wm_selection.connect("selection-lost", self._lost_wm_selection)
        self._cm_wm_selection.connect("selection-lost", self._lost_wm_selection)
        # May throw AlreadyOwned:
        if replace_other_wm:
            mode = self._wm_selection.FORCE
        else:
            mode = self._wm_selection.IF_UNOWNED
        self._wm_selection.acquire(mode)
        self._cm_wm_selection.acquire(mode)

        # Set up the necessary EWMH properties on the root window.
        self._setup_ewmh_window()
        # Start with just one desktop:
        self.set_desktop_list([u"Main"])
        self.set_current_desktop(0)
        # Start with the full display as workarea:
        root_w, root_h = gtk.gdk.get_default_root_window().get_size()
        self.root_set("_NET_SUPPORTED", ["atom"], NET_SUPPORTED)
        self.set_workarea(0, 0, root_w, root_h)
        self.set_desktop_geometry(root_w, root_h)
        self.root_set("_NET_DESKTOP_VIEWPORT", ["u32"], [0, 0])

        # Load up our full-screen widget
        self._world_window = WorldWindow(self._display.get_default_screen())
        self.notify("toplevel")
        self._world_window.show_all()

        # Okay, ready to select for SubstructureRedirect and then load in all
        # the existing clients.
        add_event_receiver(self._root, self)
        add_catchall_receiver("xpra-client-message-event", self)
        X11Window.substructureRedirect(self._root.xid)

        for w in get_children(self._root):
            # Checking for FOREIGN here filters out anything that we've
            # created ourselves (like, say, the world window), and checking
            # for mapped filters out any withdrawn windows.
            if (
                w.get_window_type() == gtk.gdk.WINDOW_FOREIGN
                and not X11Window.is_override_redirect(w.xid)
                and X11Window.is_mapped(w.xid)
            ):
                log("Wm managing pre-existing child")
                self._manage_client(w)

        # Also watch for focus change events on the root window
        X11Window.selectFocusChange(self._root.xid)
        X11Keyboard.selectBellNotification(True)
Exemplo n.º 6
0
    def __init__(self, replace_other_wm, wm_name, display=None):
        gobject.GObject.__init__(self)

        if display is None:
            display = gtk.gdk.display_manager_get().get_default_display()
        self._display = display
        self._root = self._display.get_default_screen().get_root_window()
        self._wm_name = wm_name
        self._ewmh_window = None

        self._windows = {}
        # EWMH says we have to know the order of our windows oldest to
        # youngest...
        self._windows_in_order = []

        # Become the Official Window Manager of this year's display:
        self._wm_selection = ManagerSelection(self._display, "WM_S0")
        self._cm_wm_selection = ManagerSelection(self._display,
                                                 "_NET_WM_CM_S0")
        self._wm_selection.connect("selection-lost", self._lost_wm_selection)
        self._cm_wm_selection.connect("selection-lost",
                                      self._lost_wm_selection)
        # May throw AlreadyOwned:
        if replace_other_wm:
            mode = self._wm_selection.FORCE
        else:
            mode = self._wm_selection.IF_UNOWNED
        self._wm_selection.acquire(mode)
        self._cm_wm_selection.acquire(mode)

        # Set up the necessary EWMH properties on the root window.
        self._setup_ewmh_window()
        # Start with just one desktop:
        self.set_desktop_list([u"Main"])
        self.set_current_desktop(0)
        # Start with the full display as workarea:
        root_w, root_h = gtk.gdk.get_default_root_window().get_size()
        self.root_set("_NET_SUPPORTED", ["atom"], NET_SUPPORTED)
        self.set_workarea(0, 0, root_w, root_h)
        self.set_desktop_geometry(root_w, root_h)
        self.root_set("_NET_DESKTOP_VIEWPORT", ["u32"], [0, 0])

        # Load up our full-screen widget
        self._world_window = WorldWindow(self._display.get_default_screen())
        self.notify("toplevel")
        self._world_window.show_all()

        # Okay, ready to select for SubstructureRedirect and then load in all
        # the existing clients.
        add_event_receiver(self._root, self)
        add_catchall_receiver("xpra-client-message-event", self)
        X11Window.substructureRedirect(self._root.xid)

        for w in get_children(self._root):
            # Checking for FOREIGN here filters out anything that we've
            # created ourselves (like, say, the world window), and checking
            # for mapped filters out any withdrawn windows.
            if (w.get_window_type() == gtk.gdk.WINDOW_FOREIGN
                    and not X11Window.is_override_redirect(w.xid)
                    and X11Window.is_mapped(w.xid)):
                log("Wm managing pre-existing child")
                self._manage_client(w)

        # Also watch for focus change events on the root window
        X11Window.selectFocusChange(self._root.xid)
        X11Keyboard.selectBellNotification(True)