[PATCH 1/2] simple-touch: Make sure shm formats have been enumerated.
Paul Liétar
paul at lietar.net
Wed May 14 08:40:13 PDT 2014
The first roundtrip only ensures the globals have been enumerated by the
registry.
After binding wl_shm, we need a new roundtrip to make sure the formats
have been enumerated, otherwise we might check for has_argb too early.
This is similar to the simple-shm example.
Signed-off-by: Paul Liétar <paul at lietar.net>
---
clients/simple-touch.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/clients/simple-touch.c b/clients/simple-touch.c
index d8439ac..d29912f 100644
--- a/clients/simple-touch.c
+++ b/clients/simple-touch.c
@@ -311,7 +311,12 @@ touch_create(int width, int height)
touch->has_argb = 0;
touch->registry = wl_display_get_registry(touch->display);
wl_registry_add_listener(touch->registry, ®istry_listener, touch);
- wl_display_dispatch(touch->display);
+ wl_display_roundtrip(touch->display);
+ if (touch->shm == NULL) {
+ fprintf(stderr, "No wl_shm global\n");
+ exit(1);
+ }
+
wl_display_roundtrip(touch->display);
if (!touch->has_argb) {
--
1.9.3
More information about the wayland-devel
mailing list