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)
This commit is contained in:
Jasper St. Pierre 2014-02-06 13:48:41 -05:00 committed by Neil Roberts
parent c1286307a3
commit 76cdaabc15

View File

@ -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);