summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2014-02-06 13:48:41 -0500
committerNeil Roberts <neil@linux.intel.com>2014-03-12 14:41:01 +0000
commit76cdaabc153ebba44f7026d4c6a5a93679bd1497 (patch)
treedb50c9eb3a566cc26e7c794da81307dc43a39600
parentc1286307a3701249dfdcd55facf77f55c93dc257 (diff)
downloadcogl-76cdaabc153ebba44f7026d4c6a5a93679bd1497.tar.gz
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... Reviewed-by: Neil Roberts <neil@linux.intel.com> (cherry picked from commit af9057d35f331e2c9509958fb40627917c477b80)
-rw-r--r--cogl/winsys/cogl-winsys-egl-wayland.c16
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 dd1a1b18..c6310801 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);