def activate(self): # we don't know where we are... if not self.screen: return PROBE.window_activate(self.xobj) State.reload_active(self)
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()
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()
def delete(self): self.screen.delete_window(self) self.screen.needs_tiling() State.reload_active()