Beispiel #1
0
    def reload_active(active=None, force=False):
        if not active:
            activeid = PROBE.get_active_window_id()
        else:
            activeid = active.id

        # Check to make sure we need to probe for anything...
        if not force and activeid and State._DESKTOP and State._DESKTOP._VIEWPORT and State._DESKTOP._VIEWPORT._SCREEN:
            current = State._DESKTOP._VIEWPORT._SCREEN.get_active()
            if current and current.id == activeid:
                return

        State._DESKTOP = State.get_desktops()[PROBE.get_desktop()]

        if not activeid:
            if not State._DESKTOP._VIEWPORT:
                State._DESKTOP._VIEWPORT = State._DESKTOP.viewports[0]

            if not State._DESKTOP._VIEWPORT._SCREEN:
                State._DESKTOP._VIEWPORT._SCREEN = State._DESKTOP._VIEWPORT.screens[
                    0]
        else:
            for viewport in State._DESKTOP.viewports.values():
                for screen in viewport.screens.values():
                    if activeid in screen.windows:
                        State._DESKTOP._VIEWPORT = viewport
                        State._DESKTOP._VIEWPORT._SCREEN = screen
                        State._DESKTOP._VIEWPORT._SCREEN.set_active(
                            screen.windows[activeid])
                        break
Beispiel #2
0
 def reload_active(active = None, force = False):
     if not active: 
         activeid = PROBE.get_active_window_id()
     else:
         activeid = active.id
         
     # Check to make sure we need to probe for anything...
     if not force and activeid and State._DESKTOP and State._DESKTOP._VIEWPORT and State._DESKTOP._VIEWPORT._SCREEN:
         current = State._DESKTOP._VIEWPORT._SCREEN.get_active()
         if current and current.id == activeid:
             return
         
     State._DESKTOP = State.get_desktops()[PROBE.get_desktop()]        
             
     if not activeid:
         if not State._DESKTOP._VIEWPORT:
             State._DESKTOP._VIEWPORT = State._DESKTOP.viewports[0]
             
         if not State._DESKTOP._VIEWPORT._SCREEN:
             State._DESKTOP._VIEWPORT._SCREEN = State._DESKTOP._VIEWPORT.screens[0]
     else:
         for viewport in State._DESKTOP.viewports.values():
             for screen in viewport.screens.values():
                 if activeid in screen.windows:
                     State._DESKTOP._VIEWPORT = viewport
                     State._DESKTOP._VIEWPORT._SCREEN = screen
                     State._DESKTOP._VIEWPORT._SCREEN.set_active(screen.windows[activeid])
                     break
Beispiel #3
0
    def load_window(window_id):
        attrs = PROBE.get_window_by_id(window_id)
        if not attrs['popup'] and attrs['desktop'] in State.get_desktops():
            for viewport in State.get_desktops()[attrs['desktop']].viewports.values():
                if viewport.is_on_viewport(attrs['x'], attrs['y']):
                    for screen in viewport.screens.values():
                        if screen.is_on_screen(attrs['x'], attrs['y']):
                            win = Window(screen, attrs)
                            if not win.filtered():
                                screen.add_window(win)
                                screen.needs_tiling()

                                if win.id == PROBE.get_active_window_id():
                                    win.activate()
Beispiel #4
0
    def load_window(window_id):
        attrs = PROBE.get_window_by_id(window_id)
        if not attrs['popup'] and attrs['desktop'] in State.get_desktops():
            for viewport in State.get_desktops()[
                    attrs['desktop']].viewports.values():
                if viewport.is_on_viewport(attrs['x'], attrs['y']):
                    for screen in viewport.screens.values():
                        if screen.is_on_screen(attrs['x'], attrs['y']):
                            win = Window(screen, attrs)
                            if not win.filtered():
                                screen.add_window(win)
                                screen.needs_tiling()

                                if win.id == PROBE.get_active_window_id():
                                    win.activate()
Beispiel #5
0
    def refresh(self):
        oldscreen = self.screen
        oldviewport = oldscreen.viewport
        olddesk = oldviewport.desktop
        oldstate = self.hidden
        update = PROBE.get_window(self.xobj)

        # So this is a little bit weird- we're updating the window, but while
        # we care about it's new x,y (screen change?), we don't care about it's
        # new width and height. We're tiling, so we're in complete control of
        # width and height. (The key here is that x/y *completely* determines
        # which screen the window is on.) Therefore, we don't update them- but
        # why? It would seem harmless, except that some windows (like terminals,
        # text editors, etc) set width_inc/height_inc hints which standards
        # compliant window managers honor- like OpenBox. Therefore, the WM could
        # be resizing the width/height of a given window slightly differently than
        # what PyTyle thinks it's at. This causes the width/height to change slightly
        # on each window update, and has a cascading effect that mangles the
        # window's size. YUCK. (And these width_inc/height_inc hints seemingly
        # cannot be reset.)
        update['width'] = self.width
        update['height'] = self.height
        self.update_attributes(update)

        if olddesk.id != self.desktop or not oldviewport.is_on_viewport(
                update['x'], update['y']) or not oldscreen.is_on_screen(
                    update['x'], update['y']):
            for viewport in State.get_desktops()[
                    self.desktop].viewports.values():
                if viewport.is_on_viewport(update['x'], update['y']):
                    for screen in viewport.screens.values():
                        if screen.is_on_screen(update['x'], update['y']):
                            oldscreen.delete_window(self)
                            screen.add_window(self)
                            screen.needs_tiling()
                            oldscreen.needs_tiling()
                            self.screen = screen
        elif oldstate != self.hidden:
            self.screen.needs_tiling()

        # If it's the active window, then make sure PyTyle knows that. We don't
        # want to set input focus (well, it should already have it if X tells us
        # it's the active window) because it will generate another window change
        # event, and we end up in a positive feedback loop. Yuck.
        if self.id == PROBE.get_active_window_id():
            State.reload_active()
Beispiel #6
0
    def refresh(self):
        oldscreen = self.screen
        oldviewport = oldscreen.viewport
        olddesk = oldviewport.desktop
        oldstate = self.hidden
        update = PROBE.get_window(self.xobj)

        # So this is a little bit weird- we're updating the window, but while
        # we care about it's new x,y (screen change?), we don't care about it's
        # new width and height. We're tiling, so we're in complete control of
        # width and height. (The key here is that x/y *completely* determines
        # which screen the window is on.) Therefore, we don't update them- but
        # why? It would seem harmless, except that some windows (like terminals,
        # text editors, etc) set width_inc/height_inc hints which standards
        # compliant window managers honor- like OpenBox. Therefore, the WM could
        # be resizing the width/height of a given window slightly differently than
        # what PyTyle thinks it's at. This causes the width/height to change slightly
        # on each window update, and has a cascading effect that mangles the
        # window's size. YUCK. (And these width_inc/height_inc hints seemingly
        # cannot be reset.)
        update['width'] = self.width
        update['height'] = self.height
        self.update_attributes(update)

        if olddesk.id != self.desktop or not oldviewport.is_on_viewport(update['x'], update['y']) or not oldscreen.is_on_screen(update['x'], update['y']):
            for viewport in State.get_desktops()[self.desktop].viewports.values():
                if viewport.is_on_viewport(update['x'], update['y']):
                    for screen in viewport.screens.values():
                        if screen.is_on_screen(update['x'], update['y']):
                            oldscreen.delete_window(self)
                            screen.add_window(self)
                            screen.needs_tiling()
                            oldscreen.needs_tiling()
                            self.screen = screen
        elif oldstate != self.hidden:
            self.screen.needs_tiling()

        # If it's the active window, then make sure PyTyle knows that. We don't
        # want to set input focus (well, it should already have it if X tells us
        # it's the active window) because it will generate another window change
        # event, and we end up in a positive feedback loop. Yuck.
        if self.id == PROBE.get_active_window_id():
            State.reload_active()