Use wl_display_bind() for binding to globals
diff --git a/clients/simple-shm.c b/clients/simple-shm.c
index 7b45005..f064fcd 100644
--- a/clients/simple-shm.c
+++ b/clients/simple-shm.c
@@ -152,7 +152,8 @@
switch (token) {
case WL_COMPOSITOR_VISUAL_XRGB32:
- d->xrgb_visual = wl_visual_create(d->display, id, 1);
+ d->xrgb_visual = wl_display_bind(d->display,
+ id, &wl_visual_interface);
break;
}
}
@@ -168,13 +169,14 @@
struct display *d = data;
if (strcmp(interface, "wl_compositor") == 0) {
- d->compositor = wl_compositor_create(display, id, 1);
+ d->compositor =
+ wl_display_bind(display, id, &wl_compositor_interface);
wl_compositor_add_listener(d->compositor,
&compositor_listener, d);
} else if (strcmp(interface, "wl_shell") == 0) {
- d->shell = wl_shell_create(display, id, 1);
+ d->shell = wl_display_bind(display, id, &wl_shell_interface);
} else if (strcmp(interface, "wl_shm") == 0) {
- d->shm = wl_shm_create(display, id, 1);
+ d->shm = wl_display_bind(display, id, &wl_shm_interface);
}
}
@@ -192,6 +194,7 @@
create_display(void)
{
struct display *display;
+ int i;
display = malloc(sizeof *display);
display->display = wl_display_connect(NULL);
@@ -203,7 +206,7 @@
wl_display_get_fd(display->display, event_mask_update, display);
- while (!display->xrgb_visual)
+ while (display->xrgb_visual)
wl_display_roundtrip(display->display);
return display;