Exemplo n.º 1
0
 def on_unmap_notify(self, e):
     ev = e.xunmap
     client = Client.get_by_window(ev.window)
     log.debug('on_unmap_notify %s %s' % (ev.window, client))
     if (client is not None and 
         ev.event == client.screen.root_window and 
         ev.send_event and 
         get_window_state(client.window) == xlib.NormalState):
         client.remove()
Exemplo n.º 2
0
    def scan(self):
        wa = xlib.XWindowAttributes()

        wins = xlib.Window_p()
        wins.contains = None
        d1 = xlib.Window()
        d2 = xlib.Window()
        num = c_uint()

        root = self.root_window
        log.debug('root is %s' % root)
        if xlib.XQueryTree(samuraix.display, root, byref(d1), byref(d2), byref(wins), byref(num)):
            log.debug('found %s windows' % num)
            for i in range(num.value):
                log.debug('found window %s' % wins[i])
                if (xlib.XGetWindowAttributes(samuraix.display, wins[i], byref(wa)) and 
                        not wa.override_redirect and 
                        (wa.map_state == xlib.IsViewable or 
                         get_window_state(wins[i]) == xlib.IconicState)):
                    self.manage(wins[i], wa)
                    
        if wins:
            xlib.XFree(wins)