def on_map_request(self, e): ev = e.xmaprequest wa = xlib.XWindowAttributes() log.debug('on_map_request %s' % ev.window) if not xlib.XGetWindowAttributes(e.xany.display, ev.window, byref(wa)): log.debug('couldnt get XGetWindowAttributes') return if wa.override_redirect: return # check we dont already have a client instance for this window client = Client.get_by_window(ev.window) if client is None: # it could be a frame window we've created... client = Client.get_by_frame(ev.window) if client is None: for screen in self.screens: if (addressof(wa.screen.contents) == addressof(xlib.XScreenOfDisplay(e.xany.display, screen.num).contents)): screen.manage(ev.window, wa) return assert(screen is not None, "looking for screen %s(%s) failed" %(wa.screen, type(wa.screen)))