[clutter/wip/wayland-for-demo: 10/15] wayland: Don't loop until we get globals



commit 7c8c1a91971c1656fabc0d2ac35ef8e0fd670415
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sat Feb 15 13:06:58 2014 -0500

    wayland: Don't loop until we get globals
    
    A single wl_display_sync should be enough for all globals to appear,
    so simply do it once and error out if we don't see the globals we
    want.

 clutter/wayland/clutter-backend-wayland.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/clutter/wayland/clutter-backend-wayland.c b/clutter/wayland/clutter-backend-wayland.c
index aa3bc7b..2645d5c 100644
--- a/clutter/wayland/clutter-backend-wayland.c
+++ b/clutter/wayland/clutter-backend-wayland.c
@@ -217,10 +217,18 @@ clutter_backend_wayland_post_parse (ClutterBackend  *backend,
                             &wayland_registry_listener,
                             backend_wayland);
 
-  /* Wait until we have been notified about the compositor and shell objects */
-  while (!(backend_wayland->wayland_compositor &&
-           backend_wayland->wayland_shell))
-    wl_display_roundtrip (backend_wayland->wayland_display);
+  /*
+   * Ensure that that we've received the messages setting up the
+   * compostor and shell object.
+   */
+  wl_display_roundtrip (backend_wayland->wayland_display);
+  if (!backend_wayland->wayland_compositor || !backend_wayland->wayland_shell)
+    {
+      g_set_error (error, CLUTTER_INIT_ERROR,
+                   CLUTTER_INIT_ERROR_BACKEND,
+                   "Unable to find wl_compositor or wl_shell");
+      return FALSE;
+    }
 
   return TRUE;
 }


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