summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRui Matos <tiagomatos@gmail.com>2015-09-25 16:18:55 +0200
committerRui Matos <tiagomatos@gmail.com>2015-09-25 19:09:48 +0200
commit69c267b1424bcba2cf0f0bb6ed4e3d02b374f05f (patch)
treedb25d3e2820e1f62713b53af41c53a57379bb78c
parent9abc0712836c9e56ed08796645874cc0d10b1826 (diff)
downloadmutter-69c267b1424bcba2cf0f0bb6ed4e3d02b374f05f.tar.gz
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
-rw-r--r--src/wayland/meta-xwayland.c17
1 files 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)
{