Exemple #1
0
    def __init__(self, wid):
        self.wid = wid
        self.gdk = gtk.gdk.window_foreign_new_for_display(state.gtk_display, 
                                                          self.wid)
        self.name = ewmh.get_wm_name(self.wid).reply()
        self.geom = self.get_geometry()
        self.desk = ewmh.get_wm_desktop(self.wid).reply()
        self.invis = gtk.Invisible()

        self.gdk.set_events(gtk.gdk.PROPERTY_CHANGE_MASK
                            | gtk.gdk.STRUCTURE_MASK)
        self.gdk.set_user_data(self.invis)
        self.invis.connect('property_notify_event', self.cb_prop_change)

        # This is interesting; look for configure events on the decor window
        if state.wmname.lower() == 'openbox':
            pid = window.get_parent_window(self.wid)
            pgdk = gtk.gdk.window_foreign_new_for_display(state.gtk_display,
                                                          pid)
            pinvis = gtk.Invisible()
            pgdk.set_events(gtk.gdk.STRUCTURE_MASK)
            pgdk.set_user_data(pinvis)
            pinvis.connect('configure_event', self.cb_configure)
        else:
            self.invis.connect('configure_event', self.cb_configure)

        self.update_state()
Exemple #2
0
    def __init__(self, wid):
        self.wid = wid

        self.name = ewmh.get_wm_name(self.wid).reply() or 'N/A'
        debug('Connecting to %s' % self)

        window.listen(self.wid, 'PropertyChange', 'FocusChange')
        event.connect('PropertyNotify', self.wid, self.cb_property_notify)
        event.connect('FocusIn', self.wid, self.cb_focus_in)
        event.connect('FocusOut', self.wid, self.cb_focus_out)

        # This connects to the parent window (decorations)
        # We get all resize AND move events... might be too much
        self.parentid = window.get_parent_window(self.wid)
        window.listen(self.parentid, 'StructureNotify')
        event.connect('ConfigureNotify', self.parentid, 
                      self.cb_configure_notify)

        # A window should only be floating if that is default
        self.floating = config.floats_default

        # Not currently in a "moving" state
        self.moving = False

        # Load some data
        self.desk = ewmh.get_wm_desktop(self.wid).reply()

        # Add it to this desktop's tilers
        tile.update_client_add(self)

        # First cut at saving client geometry
        self.save()
Exemple #3
0
    def __init__(self, wid):
        self.wid = wid
        self.gdk = gtk.gdk.window_foreign_new_for_display(
            state.gtk_display, self.wid)
        self.name = ewmh.get_wm_name(self.wid).reply()
        self.geom = self.get_geometry()
        self.desk = ewmh.get_wm_desktop(self.wid).reply()
        self.invis = gtk.Invisible()

        self.gdk.set_events(gtk.gdk.PROPERTY_CHANGE_MASK
                            | gtk.gdk.STRUCTURE_MASK)
        self.gdk.set_user_data(self.invis)
        self.invis.connect('property_notify_event', self.cb_prop_change)

        # This is interesting; look for configure events on the decor window
        if state.wmname.lower() == 'openbox':
            pid = window.get_parent_window(self.wid)
            pgdk = gtk.gdk.window_foreign_new_for_display(
                state.gtk_display, pid)
            pinvis = gtk.Invisible()
            pgdk.set_events(gtk.gdk.STRUCTURE_MASK)
            pgdk.set_user_data(pinvis)
            pinvis.connect('configure_event', self.cb_configure)
        else:
            self.invis.connect('configure_event', self.cb_configure)

        self.update_state()
Exemple #4
0
    def __init__(self, wid):
        self.wid = wid

        self.name = ewmh.get_wm_name(self.wid).reply() or "N/A"
        debug("Connecting to %s" % self)

        window.listen(self.wid, "PropertyChange", "FocusChange")
        event.connect("PropertyNotify", self.wid, self.cb_property_notify)
        event.connect("FocusIn", self.wid, self.cb_focus_in)
        event.connect("FocusOut", self.wid, self.cb_focus_out)

        # This connects to the parent window (decorations)
        # We get all resize AND move events... might be too much
        self.parentid = window.get_parent_window(self.wid)
        window.listen(self.parentid, "StructureNotify")
        event.connect("ConfigureNotify", self.parentid, self.cb_configure_notify)
        debug("Parent: %s" % str(self.parentid))
        # A window should only be floating if that is default
        self.floating = getattr(config, "floats_default", False)

        # Not currently in a "moving" state
        self.moving = False

        # Load some data
        self.desk = ewmh.get_wm_desktop(self.wid).reply()
        debug("Desk: %s" % str(self.desk))

        # Add it to this desktop's tilers
        ret = tile.update_client_add(self)
        # does this work?
        debug("Ret: %s" % str(ret))

        # First cut at saving client geometry
        self.save()
        debug("Init finished and save() called %s" % self)
Exemple #5
0
    def getWinGeometry(wid, skip=0, **kwargs):
        ''' Gets the window geometry of the window.

		Skip controls howe many extra parents we should go to to get the geometry.
		In most window managers, this should be zero (ie, decorations are the parent of wid).
		However, at least one (KWin) introduces an extra parent window, so the decorations
		are actually the grandparent of the wid. In this case, skip should be 1. '''
        for i in range(skip):
            wid = window.get_parent_window(wid)

        geo = window.get_geometry(wid).reply()  # x, y, w, h
        return QRect(*geo)