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:30:44 +0000
commitaf9057d35f331e2c9509958fb40627917c477b80 (patch)
tree2dd958db28419dbead76803df6d27afc9e629943
parent55c82476a93366a3e7d1a2537fccc3a7aab87c66 (diff)
downloadcogl-af9057d35f331e2c9509958fb40627917c477b80.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>
-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 c0d6613a..c8497978 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);