[mutter/wayland] xwayland: Fix rendering



commit c40868b239239a8f91ab9b62ccf2a75413246543
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Apr 2 11:20:30 2014 -0400

    xwayland: Fix rendering
    
    Since we get the ClientMessage after the surface is created, there's
    no good way to synchronize the two streams. In this case, what we
    need to do is delay the surface commit until after we get the
    ClientMessage. Ideally, we'd be using a better surface system overall
    where committing the surface didn't depend on what type it is, but
    oh well, this is a good short-term hack for now.

 src/wayland/meta-wayland-surface-private.h |   32 ++++++++++++++++++++++++++++
 src/wayland/meta-wayland-surface.c         |   11 ++++++++-
 src/wayland/meta-xwayland.c                |    8 +++++++
 3 files changed, 50 insertions(+), 1 deletions(-)
---
diff --git a/src/wayland/meta-wayland-surface-private.h b/src/wayland/meta-wayland-surface-private.h
new file mode 100644
index 0000000..9b882df
--- /dev/null
+++ b/src/wayland/meta-wayland-surface-private.h
@@ -0,0 +1,32 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/*
+ * Copyright (C) 2014 Red Hat
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Written by:
+ *     Jasper St. Pierre <jstpierre mecheye net>
+ */
+
+#ifndef META_WAYLAND_SURFACE_PRIVATE_H
+#define META_WAYLAND_SURFACE_PRIVATE_H
+
+#include "meta-wayland-types.h"
+
+void meta_wayland_surface_commit (MetaWaylandSurface *surface);
+
+#endif /* META_WAYLAND_SURFACE_PRIVATE_H */
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index c3987f7..a9aae35 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -48,6 +48,7 @@
 #include "meta-wayland-keyboard.h"
 #include "meta-wayland-pointer.h"
 #include "meta-wayland-data-device.h"
+#include "meta-wayland-surface-private.h"
 
 #include "meta-cursor-tracker-private.h"
 #include "display-private.h"
@@ -365,6 +366,14 @@ commit_double_buffered_state (MetaWaylandSurface             *surface,
     toplevel_surface_commit (surface, pending);
   else if (surface->subsurface.resource)
     subsurface_surface_commit (surface, pending);
+  else
+    {
+      /* Unknown surface type. In this case, it's most likely a XWayland
+       * surface that we haven't gotten the ClientMessage for yet. Make
+       * sure *not* to reset the double-buffered state or do anything too
+       * fancy. */
+      return;
+    }
 
   g_list_foreach (surface->subsurfaces,
                   parent_surface_committed,
@@ -383,7 +392,7 @@ commit_double_buffered_state (MetaWaylandSurface             *surface,
   double_buffered_state_reset (pending);
 }
 
-static void
+void
 meta_wayland_surface_commit (MetaWaylandSurface *surface)
 {
   commit_double_buffered_state (surface, &surface->pending);
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index cb1f54a..b913f49 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -26,6 +26,8 @@
 #include "meta-xwayland.h"
 #include "meta-xwayland-private.h"
 
+#include "meta-wayland-surface-private.h"
+
 #include <glib.h>
 #include <glib-unix.h>
 #include <unistd.h>
@@ -54,6 +56,12 @@ associate_window_with_surface (MetaWindow         *window,
   window->surface = surface;
 
   meta_compositor_window_surface_changed (display->compositor, window);
+
+  /* Since the association comes in the form of a ClientMessage,
+   * we have no way to know when the surface was set up. Since
+   * commit just breaks if we don't have a window associated with
+   * it, we need to do a commit *again* here. */
+  meta_wayland_surface_commit (surface);
 }
 
 static gboolean


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]