[cogl/wip/wayland-for-demo: 1/3] cogl-winsys-egl-wayland: Report an error if we can't find the globals we need



commit bf2d54ac8d43ce577d5149406ea8236738c8a9a2
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Feb 6 13:48:41 2014 -0500

    cogl-winsys-egl-wayland: Report an error if we can't find the globals we need
    
    Instead of spinning forever, do a roundtrip, which guarantees that the
    global messages have been sent by the time we read the sync message.
    
    If the proper globals aren't initialized yet, error out immediately. This
    does mean that users can't use CoglOnscreen with foreign custom surface
    types without xdg_shell, but when a use case comes for this, we'll
    investigate then...

 cogl/winsys/cogl-winsys-egl-wayland.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/cogl/winsys/cogl-winsys-egl-wayland.c b/cogl/winsys/cogl-winsys-egl-wayland.c
index dd1a1b1..c631080 100644
--- a/cogl/winsys/cogl-winsys-egl-wayland.c
+++ b/cogl/winsys/cogl-winsys-egl-wayland.c
@@ -273,13 +273,17 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
 
   /*
    * Ensure that that we've received the messages setting up the
-   * compostor and shell object. This is better than just
-   * wl_display_iterate since it will always ensure that something
-   * is available to be read
+   * compostor and shell object.
    */
-  while (!(wayland_renderer->wayland_compositor &&
-           wayland_renderer->wayland_shell))
-    wl_display_roundtrip (wayland_renderer->wayland_display);
+  wl_display_roundtrip (wayland_renderer->wayland_display);
+  if (!wayland_renderer->wayland_compositor || !wayland_renderer->wayland_shell)
+    {
+      _cogl_set_error (error,
+                       COGL_WINSYS_ERROR,
+                       COGL_WINSYS_ERROR_INIT,
+                       "Unable to find wl_compositor or wl_shell");
+      goto error;
+    }
 
   egl_renderer->edpy =
     eglGetDisplay ((EGLNativeDisplayType) wayland_renderer->wayland_display);


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