static int createWLContext() { t_ilm_bool result = ILM_TRUE; g_wlContextStruct.wlDisplay = wl_display_connect(NULL); if (NULL == g_wlContextStruct.wlDisplay) { printf("Error: wl_display_connect() failed.\n"); } g_wlContextStruct.wlRegistry = wl_display_get_registry(g_wlContextStruct.wlDisplay); wl_registry_add_listener(g_wlContextStruct.wlRegistry, ®istry_listener, &g_wlContextStruct); wl_display_dispatch(g_wlContextStruct.wlDisplay); wl_display_roundtrip(g_wlContextStruct.wlDisplay); g_wlContextStruct.wlSurface = wl_compositor_create_surface(g_wlContextStruct.wlCompositor); if (NULL == g_wlContextStruct.wlSurface) { printf("Error: wl_compositor_create_surface failed.\n"); destroyWLContext(); } createShmBuffer(); return result; }
WaylandBuffer(wl_shm* shm, uint32_t width, uint32_t height) { mBufferListener.release = hookBufferRelease; mBuffer = createShmBuffer(shm, width, height); wl_buffer_add_listener(mBuffer, &mBufferListener, this); mReadyToDraw = true; }