From 69c267b1424bcba2cf0f0bb6ed4e3d02b374f05f Mon Sep 17 00:00:00 2001 From: Rui Matos Date: Fri, 25 Sep 2015 16:18:55 +0200 Subject: [PATCH] xwayland: Fix windows disappearing on reparenting If the wayland surface isn't available yet when we process the WL_SURFACE_ID ClientMessage, we schedule a later function to try the association again after we get a chance to process wayland requests. This works fine except on cases where the MetaWindow already had a previous surface attached (i.e. when the xwindow is reparented) since we only break the existing association on the later function which means that when processing the old surface's destruction we destroy the MetaWindow and cancel the pending later function leaving us without a MetaWindow and an invisible surface. Fix this by detaching the old surface as soon as possible so that the MetaWindow survives. https://bugzilla.gnome.org/show_bug.cgi?id=743339 --- src/wayland/meta-xwayland.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c index dc7e83fdb..179b94c8b 100644 --- a/src/wayland/meta-xwayland.c +++ b/src/wayland/meta-xwayland.c @@ -55,13 +55,6 @@ associate_window_with_surface (MetaWindow *window, { MetaDisplay *display = window->display; - /* If the window has an existing surface, like if we're - * undecorating or decorating the window, then we need - * to detach the window from its old surface. - */ - if (window->surface) - window->surface->window = NULL; - if (!meta_wayland_surface_assign_role (surface, META_TYPE_WAYLAND_SURFACE_ROLE_XWAYLAND)) { @@ -88,6 +81,16 @@ associate_window_with_surface_id (MetaXWaylandManager *manager, { struct wl_resource *resource; + /* If the window has an existing surface, like if we're + * undecorating or decorating the window, then we need + * to detach the window from its old surface. + */ + if (window->surface) + { + meta_wayland_surface_set_window (window->surface, NULL); + window->surface = NULL; + } + resource = wl_client_get_object (manager->client, surface_id); if (resource) {