def do_unmanaged(self, wm_exiting): log("unmanaging window: %s (%s - %s)", self, self.corral_window, self.client_window) self._internal_set_property("owner", None) if self.corral_window: remove_event_receiver(self.corral_window, self) geom = None #use a new context so we will XSync right here #and detect if the window is already gone: with XSwallowContext(): geom = X11Window.getGeometry(self.xid) if geom is not None: if self.client_reparented: self.client_window.reparent(get_default_root_window(), 0, 0) self.client_window.set_events(self.client_window_saved_events) self.client_reparented = False #it is now safe to destroy the corral window: self.corral_window.destroy() self.corral_window = None # It is important to remove from our save set, even after # reparenting, because according to the X spec, windows that are # in our save set are always Mapped when we exit, *even if those # windows are no longer inferior to any of our windows!* (see # section 10. Connection Close). This causes "ghost windows", see # bug #27: if self.in_save_set: with xswallow: X11Window.XRemoveFromSaveSet(self.xid) self.in_save_set = False with xswallow: X11Window.sendConfigureNotify(self.xid) if wm_exiting: self.client_window.show_unraised() BaseWindowModel.do_unmanaged(self, wm_exiting)
def do_unmanaged(self, wm_exiting): log("unmanaging window: %s (%s - %s)", self, self.corral_window, self.client_window) self._internal_set_property("owner", None) if self.corral_window: remove_event_receiver(self.corral_window, self) with xswallow: for prop in WindowModel.SCRUB_PROPERTIES: X11Window.XDeleteProperty(self.xid, prop) if self.client_reparented: self.client_window.reparent(gtk.gdk.get_default_root_window(), 0, 0) self.client_reparented = False self.client_window.set_events(self.client_window_saved_events) #it is now safe to destroy the corral window: self.corral_window.destroy() self.corral_window = None # It is important to remove from our save set, even after # reparenting, because according to the X spec, windows that are # in our save set are always Mapped when we exit, *even if those # windows are no longer inferior to any of our windows!* (see # section 10. Connection Close). This causes "ghost windows", see # bug #27: if self.in_save_set: with xswallow: X11Window.XRemoveFromSaveSet(self.xid) self.in_save_set = False with xswallow: X11Window.sendConfigureNotify(self.xid) if wm_exiting: self.client_window.show_unraised() BaseWindowModel.do_unmanaged(self, wm_exiting)
def process_client_message_event(self, event): if event.message_type == "_NET_MOVERESIZE_WINDOW": #TODO: honour gravity, show source indication geom = self.corral_window.get_geometry() x, y, w, h, _ = geom if event.data[0] & 0x100: x = event.data[1] if event.data[0] & 0x200: y = event.data[2] if event.data[0] & 0x400: w = event.data[3] if event.data[0] & 0x800: h = event.data[4] self._internal_set_property("set-initial-position", (event.data[0] & 0x100) or (event.data[0] & 0x200)) #honour hints: hints = self.get_property("size-hints") w, h = calc_constrained_size(w, h, hints) geomlog( "_NET_MOVERESIZE_WINDOW on %s (data=%s, current geometry=%s, new geometry=%s)", self, event.data, geom, (x, y, w, h)) with xswallow: X11Window.configureAndNotify(self.xid, x, y, w, h) return True return BaseWindowModel.process_client_message_event(self, event)
def process_client_message_event(self, event): if event.message_type=="_NET_MOVERESIZE_WINDOW": #TODO: honour gravity, show source indication geom = self.corral_window.get_geometry() x, y, w, h, _ = geom if event.data[0] & 0x100: x = event.data[1] if event.data[0] & 0x200: y = event.data[2] if event.data[0] & 0x400: w = event.data[3] if event.data[0] & 0x800: h = event.data[4] #honour hints: hints = self.get_property("size-hints") w, h = calc_constrained_size(w, h, hints) geomlog("_NET_MOVERESIZE_WINDOW on %s (data=%s, current geometry=%s, new geometry=%s)", self, event.data, geom, (x,y,w,h)) with xswallow: X11Window.configureAndNotify(self.xid, x, y, w, h) return True return BaseWindowModel.process_client_message_event(self, event)
def do_xpra_property_notify_event(self, event): if event.delivered_to is self.corral_window: return BaseWindowModel.do_xpra_property_notify_event(self, event)