#include #include static struct wl_compositor *wl_compositor; static struct wl_shm *wl_shm; static void global(void *data, struct wl_registry *wl_registry, uint32_t name, const char *interface, uint32_t version) { if (strcmp(interface, wl_compositor_interface.name) == 0) { wl_compositor = wl_registry_bind( wl_registry, name, &wl_compositor_interface, version); } else if (strcmp(interface, wl_shm_interface.name) == 0) { wl_shm = wl_registry_bind( wl_registry, name, &wl_shm_interface, version); } } static void global_remove(void *data, struct wl_registry *wl_registry, uint32_t name) { } static struct wl_registry_listener listener = { global, global_remove, }; int main() { struct wl_display *wl_display = wl_display_connect(NULL); struct wl_registry *wl_registry = wl_display_get_registry(wl_display); wl_registry_add_listener(wl_registry, &listener, NULL); wl_display_roundtrip(wl_display); wl_display_roundtrip(wl_display); wl_compositor_destroy(wl_compositor); wl_shm_destroy(wl_shm); wl_registry_destroy(wl_registry); wl_display_disconnect(wl_display); return 0; }