コード例 #1
0
ファイル: wayland_ctx.c プロジェクト: frangarcj/RetroArch
static void gfx_ctx_wl_destroy_resources(gfx_ctx_wayland_data_t *wl)
{
   if (!wl)
      return;

   switch (wl_api)
   {
      case GFX_CTX_OPENGL_API:
      case GFX_CTX_OPENGL_ES_API:
      case GFX_CTX_OPENVG_API:
#ifdef HAVE_EGL
         egl_destroy(&wl->egl);

         if (wl->win)
            wl_egl_window_destroy(wl->win);
#endif
         break;
      case GFX_CTX_VULKAN_API:
#ifdef HAVE_VULKAN
         vulkan_context_destroy(&wl->vk, wl->surface);

         if (wl->fd >= 0)
            close(wl->fd);
#endif
         break;
      case GFX_CTX_NONE:
      default:
         break;
   }

   if (wl->shell)
      wl_shell_destroy(wl->shell);
   if (wl->compositor)
      wl_compositor_destroy(wl->compositor);
   if (wl->registry)
      wl_registry_destroy(wl->registry);
   if (wl->shell_surf)
      wl_shell_surface_destroy(wl->shell_surf);
   if (wl->surface)
      wl_surface_destroy(wl->surface);

   if (wl->dpy)
   {
      wl_display_flush(wl->dpy);
      wl_display_disconnect(wl->dpy);
   }

#ifdef HAVE_EGL
   wl->win        = NULL;
#endif
   wl->shell      = NULL;
   wl->compositor = NULL;
   wl->registry   = NULL;
   wl->dpy        = NULL;
   wl->shell_surf = NULL;
   wl->surface    = NULL;

   wl->width      = 0;
   wl->height     = 0;
}
コード例 #2
0
WaylandDisplay::~WaylandDisplay()
{
    if (m_eventSource)
        g_source_unref(m_eventSource);
    m_eventSource = nullptr;

    if (m_interfaces.compositor)
        wl_compositor_destroy(m_interfaces.compositor);
    if (m_interfaces.drm)
        wl_drm_destroy(m_interfaces.drm);
    if (m_interfaces.seat)
        wl_seat_destroy(m_interfaces.seat);
    if (m_interfaces.xdg)
        xdg_shell_destroy(m_interfaces.xdg);
    if (m_interfaces.ivi_application)
        ivi_application_destroy(m_interfaces.ivi_application);
    m_interfaces = { nullptr, nullptr, nullptr, nullptr, nullptr };

    if (m_registry)
        wl_registry_destroy(m_registry);
    m_registry = nullptr;
    if (m_display)
        wl_display_disconnect(m_display);
    m_display = nullptr;
}
コード例 #3
0
static void
_eventd_nd_wl_stop(EventdNdBackendContext *self)
{
    GSList *seat_ = self->seats;
    while ( seat_ != NULL )
    {
        EventdNdWlSeat *seat = seat_->data;
        GSList *next_ = g_slist_next(seat_);
        _eventd_nd_wl_seat_release(seat);
        seat_ = next_;
    }

    EventdNdWlGlobalName i;
    for ( i = 0 ; i < _EVENTD_ND_WL_GLOBAL_SIZE ; ++i )
    {
        if ( self->global_names[i] != 0 )
            _eventd_nd_wl_registry_handle_global_remove(self, self->registry, self->global_names[i]);
    }

    wl_registry_destroy(self->registry);
    self->registry = NULL;

    g_water_wayland_source_free(self->source);
    self->display = NULL;
    self->source = NULL;
}
コード例 #4
0
NativeStateWayland::~NativeStateWayland()
{
    if (window_) {
        if (window_->shell_surface)
            wl_shell_surface_destroy(window_->shell_surface);
        if (window_->opaque_reqion)
            wl_region_destroy(window_->opaque_reqion);
        if (window_->surface)
            wl_surface_destroy(window_->surface);
        if (window_->native)
            wl_egl_window_destroy(window_->native);
        delete window_;
    }

    if (display_) {
        if (display_->shell)
            wl_shell_destroy(display_->shell);

        for (OutputsVector::iterator it = display_->outputs.begin();
             it != display_->outputs.end(); ++it) {

            wl_output_destroy((*it)->output);
            delete *it;
        }
        if (display_->compositor)
            wl_compositor_destroy(display_->compositor);
        if (display_->registry)
            wl_registry_destroy(display_->registry);
        if (display_->display) {
            wl_display_flush(display_->display);
            wl_display_disconnect(display_->display);
        }
        delete display_;
    }
}
コード例 #5
0
ファイル: WL.c プロジェクト: AnonymousMeerkat/nightmare
bool WL_destroy() {
    wl_registry_destroy(_WL_display.registry);
    NWMan_events_destroy();
    wl_display_flush(_WL_display.display);
    wl_display_disconnect(_WL_display.display);

    return true;
}
コード例 #6
0
ファイル: display.cpp プロジェクト: 01org/wayland-fits
/*virtual*/ Display::~Display()
{
	if (xkbContext_)
	{
		xkb_context_unref(xkbContext_);
	}
	wl_registry_destroy(wl_registry_);
	wl_display_disconnect(*this);
}
コード例 #7
0
PlatformDisplayWayland::~PlatformDisplayWayland()
{
    if (m_compositor)
        wl_compositor_destroy(m_compositor);
    if (m_registry)
        wl_registry_destroy(m_registry);
    if (m_display)
        wl_display_disconnect(m_display);
}
コード例 #8
0
ファイル: queue-test.c プロジェクト: abhijitpotnis/wayland
static void
registry_handle_global(void *data, struct wl_registry *registry,
		       uint32_t id, const char *interface, uint32_t version)
{
	int *pcounter = data;
	(*pcounter)++;
	client_assert(*pcounter == 1);
	wl_registry_destroy(registry);
}
コード例 #9
0
ファイル: wldisplay.c プロジェクト: luisbg/gst-plugins-bad
static void
gst_wl_display_finalize (GObject * gobject)
{
  GstWlDisplay *self = GST_WL_DISPLAY (gobject);

  gst_poll_set_flushing (self->wl_fd_poll, TRUE);
  if (self->thread)
    g_thread_join (self->thread);

  /* to avoid buffers being unregistered from another thread
   * at the same time, take their ownership */
  g_mutex_lock (&self->buffers_mutex);
  self->shutting_down = TRUE;
  g_hash_table_foreach (self->buffers, (GHFunc) g_object_ref, NULL);
  g_mutex_unlock (&self->buffers_mutex);

  g_hash_table_foreach (self->buffers,
      (GHFunc) gst_wl_buffer_force_release_and_unref, NULL);
  g_hash_table_remove_all (self->buffers);

  g_array_unref (self->shm_formats);
  g_array_unref (self->dmabuf_formats);
  gst_poll_free (self->wl_fd_poll);
  g_hash_table_unref (self->buffers);
  g_mutex_clear (&self->buffers_mutex);

  if (self->viewporter)
    wp_viewporter_destroy (self->viewporter);

  if (self->shm)
    wl_shm_destroy (self->shm);

  if (self->dmabuf)
    zwp_linux_dmabuf_v1_destroy (self->dmabuf);

  if (self->shell)
    wl_shell_destroy (self->shell);

  if (self->compositor)
    wl_compositor_destroy (self->compositor);

  if (self->subcompositor)
    wl_subcompositor_destroy (self->subcompositor);

  if (self->registry)
    wl_registry_destroy (self->registry);

  if (self->queue)
    wl_event_queue_destroy (self->queue);

  if (self->own_display) {
    wl_display_flush (self->display);
    wl_display_disconnect (self->display);
  }

  G_OBJECT_CLASS (gst_wl_display_parent_class)->finalize (gobject);
}
コード例 #10
0
ファイル: SDL_waylandvideo.c プロジェクト: vroad/sdl
void
Wayland_VideoQuit(_THIS)
{
    SDL_VideoData *data = _this->driverdata;
    int i;

    Wayland_FiniMouse ();

    for (i = 0; i < _this->num_displays; ++i) {
        SDL_VideoDisplay *display = &_this->displays[i];
        wl_output_destroy(display->driverdata);
        display->driverdata = NULL;
    }

    Wayland_display_destroy_input(data);
    Wayland_display_destroy_pointer_constraints(data);
    Wayland_display_destroy_relative_pointer_manager(data);

    if (data->xkb_context) {
        WAYLAND_xkb_context_unref(data->xkb_context);
        data->xkb_context = NULL;
    }
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
    if (data->windowmanager)
        qt_windowmanager_destroy(data->windowmanager);

    if (data->surface_extension)
        qt_surface_extension_destroy(data->surface_extension);

    Wayland_touch_destroy(data);
#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */

    if (data->shm)
        wl_shm_destroy(data->shm);

    if (data->cursor_theme)
        WAYLAND_wl_cursor_theme_destroy(data->cursor_theme);

    if (data->shell)
        wl_shell_destroy(data->shell);

    if (data->compositor)
        wl_compositor_destroy(data->compositor);

    if (data->registry)
        wl_registry_destroy(data->registry);

    if (data->display) {
        WAYLAND_wl_display_flush(data->display);
        WAYLAND_wl_display_disconnect(data->display);
    }

    SDL_free(data->classname);
    free(data);
    _this->driverdata = NULL;
}
コード例 #11
0
ファイル: fg_init_wl.c プロジェクト: Enseed/FreeGLUT
void fgPlatformCloseDisplay ( void )
{
    wl_cursor_theme_destroy( fgDisplay.pDisplay.cursor_theme );

    wl_shm_destroy( fgDisplay.pDisplay.shm );
    wl_seat_destroy( fgDisplay.pDisplay.seat );
    wl_shell_destroy( fgDisplay.pDisplay.shell );
    wl_compositor_destroy( fgDisplay.pDisplay.compositor );
    wl_registry_destroy( fgDisplay.pDisplay.registry );

    wl_display_disconnect( fgDisplay.pDisplay.display );
}
コード例 #12
0
TestBase::~TestBase()
{
    for (std::vector<wl_surface *>::reverse_iterator it = wlSurfaces.rbegin();
         it != wlSurfaces.rend();
         ++it)
    {
        wl_surface_destroy(*it);
    }
    wlSurfaces.clear();
    wl_compositor_destroy(wlCompositor);
    wl_registry_destroy(wlRegistry);
    wl_display_disconnect(wlDisplay);
}
コード例 #13
0
extern "C" void waylandws_Terminate(_EGLDisplay *dpy)
{
	WaylandDisplay *wdpy = (WaylandDisplay *)dpy;
	int ret = 0;
	// We still have the sync callback on flight, wait for it to arrive
	while (ret == 0 && !wdpy->wlegl) {
		ret = wl_display_dispatch_queue(wdpy->wl_dpy, wdpy->queue);
	}
	assert(ret >= 0);
	android_wlegl_destroy(wdpy->wlegl);
	wl_registry_destroy(wdpy->registry);
	wl_event_queue_destroy(wdpy->queue);
	delete wdpy;
}
コード例 #14
0
ファイル: wl_init.c プロジェクト: Zeken/glfw
void _glfwPlatformTerminate(void)
{
    _glfwTerminateContextAPI();

    if (_glfw.wl.cursorTheme)
        wl_cursor_theme_destroy(_glfw.wl.cursorTheme);
    if (_glfw.wl.cursorSurface)
        wl_surface_destroy(_glfw.wl.cursorSurface);
    if (_glfw.wl.registry)
        wl_registry_destroy(_glfw.wl.registry);
    if (_glfw.wl.display)
        wl_display_flush(_glfw.wl.display);
    if (_glfw.wl.display)
        wl_display_disconnect(_glfw.wl.display);
}
コード例 #15
0
WaylandNativeWindow::~WaylandNativeWindow()
{
    std::list<WaylandNativeWindowBuffer *>::iterator it = m_bufList.begin();
    destroyBuffers();
    if (frame_callback)
        wl_callback_destroy(frame_callback);
    wl_registry_destroy(registry);
    wl_event_queue_destroy(wl_queue);
    android_wlegl_destroy(m_android_wlegl);
    if (m_window) {
	    m_window->nativewindow = NULL;
	    m_window->resize_callback = NULL;
	    m_window->free_callback = NULL;
    }
}
コード例 #16
0
ファイル: helpers.c プロジェクト: fooishbar/hello_wayland
void hello_setup_wayland(void)
{
    struct wl_registry *registry;

    display = wl_display_connect(NULL);
    if (display == NULL) {
        perror("Error opening display");
        exit(EXIT_FAILURE);
    }

    registry = wl_display_get_registry(display);
    wl_registry_add_listener(registry, &registry_listener,
        &compositor);
    wl_display_roundtrip(display);
    wl_registry_destroy(registry);
}
コード例 #17
0
WaylandDisplay::~WaylandDisplay()
{
    if (m_eventSource)
        g_source_unref(m_eventSource);
    m_eventSource = nullptr;

    if (m_interfaces.compositor)
        wl_compositor_destroy(m_interfaces.compositor);
    if (m_interfaces.data_device_manager)
        wl_data_device_manager_destroy(m_interfaces.data_device_manager);
    if (m_interfaces.drm)
        wl_drm_destroy(m_interfaces.drm);
    if (m_interfaces.seat)
        wl_seat_destroy(m_interfaces.seat);
    if (m_interfaces.xdg)
        xdg_shell_destroy(m_interfaces.xdg);
    if (m_interfaces.ivi_application)
        ivi_application_destroy(m_interfaces.ivi_application);
    m_interfaces = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr };

    if (m_registry)
        wl_registry_destroy(m_registry);
    m_registry = nullptr;
    if (m_display)
        wl_display_disconnect(m_display);
    m_display = nullptr;

    if (m_seatData.pointer.object)
        wl_pointer_destroy(m_seatData.pointer.object);
    if (m_seatData.keyboard.object)
        wl_keyboard_destroy(m_seatData.keyboard.object);
    if (m_seatData.touch.object)
        wl_touch_destroy(m_seatData.touch.object);
    if (m_seatData.xkb.context)
        xkb_context_unref(m_seatData.xkb.context);
    if (m_seatData.xkb.keymap)
        xkb_keymap_unref(m_seatData.xkb.keymap);
    if (m_seatData.xkb.state)
        xkb_state_unref(m_seatData.xkb.state);
    if (m_seatData.xkb.composeTable)
        xkb_compose_table_unref(m_seatData.xkb.composeTable);
    if (m_seatData.xkb.composeState)
        xkb_compose_state_unref(m_seatData.xkb.composeState);
    if (m_seatData.repeatData.eventSource)
        g_source_remove(m_seatData.repeatData.eventSource);
    m_seatData = SeatData{ };
}
コード例 #18
0
static void
cursor_viewer_destroy(struct cursor_viewer *viewer)
{
    if (viewer->cursor_theme)
        wl_cursor_theme_destroy(viewer->cursor_theme);
    if (viewer->shell)
        wl_shell_destroy(viewer->shell);
    if (viewer->compositor)
        wl_compositor_destroy(viewer->compositor);
    if (viewer->shm)
        wl_shm_destroy(viewer->shm);
    if (viewer->registry)
        wl_registry_destroy(viewer->registry);
    if (viewer->display)
        wl_display_disconnect(viewer->display);
    free(viewer);
}
コード例 #19
0
ファイル: simple-shm.c プロジェクト: whot/weston
static void
destroy_display(struct display *display)
{
	if (display->shm)
		wl_shm_destroy(display->shm);

	if (display->shell)
		wl_shell_destroy(display->shell);

	if (display->compositor)
		wl_compositor_destroy(display->compositor);

	wl_registry_destroy(display->registry);
	wl_display_flush(display->display);
	wl_display_disconnect(display->display);
	free(display);
}
コード例 #20
0
WaylandNativeWindow::~WaylandNativeWindow()
{
    std::list<WaylandNativeWindowBuffer *>::iterator it = m_bufList.begin();
    for (; it != m_bufList.end(); it++)
    {
        WaylandNativeWindowBuffer* buf=*it;
        if (buf->wlbuffer)
            wl_buffer_destroy(buf->wlbuffer);
        buf->wlbuffer = NULL;
        buf->common.decRef(&buf->common);
    }
    if (frame_callback)
        wl_callback_destroy(frame_callback);
    wl_registry_destroy(registry);
    wl_event_queue_destroy(wl_queue);
    android_wlegl_destroy(m_android_wlegl);
}
コード例 #21
0
static void
nested_client_destroy(struct nested_client *client)
{
  eglMakeCurrent(client->egl_display,
                 EGL_NO_SURFACE, EGL_NO_SURFACE,
                 EGL_NO_CONTEXT);

  wl_egl_window_destroy(client->native);

  wl_surface_destroy(client->surface);

  if (client->compositor)
    wl_compositor_destroy(client->compositor);

  wl_registry_destroy(client->registry);
  wl_display_flush(client->display);
  wl_display_disconnect(client->display);
}
コード例 #22
0
static void
destroy_display(struct display *display)
{
	if (display->dmabuf)
		zwp_linux_dmabuf_v1_destroy(display->dmabuf);

	if (display->shell)
		xdg_shell_destroy(display->shell);

	if (display->fshell)
		zwp_fullscreen_shell_v1_release(display->fshell);

	if (display->compositor)
		wl_compositor_destroy(display->compositor);

	wl_registry_destroy(display->registry);
	wl_display_flush(display->display);
	wl_display_disconnect(display->display);
	free(display);
}
コード例 #23
0
WaylandCore::~WaylandCore(){
  if( mSeat ) {
    wl_seat_destroy( mSeat );
    mSeat = NULL;
  }
  if( mShm ) {
    wl_shm_destroy( mShm );
    mShm = NULL;
  }
  if( mSurface.eglSurface || mEglWindow ) {
    eglMakeCurrent( mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );
    eglDestroySurface( mEglContext, mSurface.eglSurface );
    wl_egl_window_destroy( mEglWindow );
    mEglWindow = NULL;
    mSurface.eglSurface = 0;
  }
  
  if( mEglContext ) {
    eglDestroyContext( mEglDisplay, mEglContext );
    mEglContext = 0;
  }
  if( mEglDisplay ) {
    eglTerminate( mEglDisplay );
    mEglDisplay = 0;
  }
  
  if( mCompositor ) {
    wl_compositor_destroy( mCompositor );
    mCompositor = NULL;
  }
  if( mRegistry ) {
    wl_registry_destroy( mRegistry );
    mRegistry = NULL;
  }
  if( mDisplay ) {
    wl_display_flush( mDisplay );
    wl_display_disconnect( mDisplay );
    mDisplay = NULL;
  }
}
コード例 #24
0
ファイル: wlf_display.c プロジェクト: BUGgs/FreeRDP
void wlf_DestroyDisplay(wlfContext* wlfc, wlfDisplay* display)
{
	if (display == NULL)
		return;

	if (wlfc->display == display)
		wlfc->display = NULL;

	if (display->seat)
		wl_seat_destroy(display->seat);
	if (display->shm)
		wl_shm_destroy(display->shm);
	if (display->shell)
		wl_shell_destroy(display->shell);
	if (display->compositor)
		wl_compositor_destroy(display->compositor);
	if (display->registry)
		wl_registry_destroy(display->registry);
	wl_display_disconnect(display->display);

	free(display);
}
コード例 #25
0
ファイル: registry.c プロジェクト: dardevelin/sway
struct registry *registry_poll(void) {
	struct registry *registry = malloc(sizeof(struct registry));
	memset(registry, 0, sizeof(struct registry));
	registry->outputs = create_list();
	registry->input = calloc(sizeof(struct input), 1);
	registry->input->xkb.context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);

	registry->display = wl_display_connect(NULL);
	if (!registry->display) {
		sway_log(L_ERROR, "Error opening display");
		registry_teardown(registry);
		return NULL;
	}

	struct wl_registry *reg = wl_display_get_registry(registry->display);
	wl_registry_add_listener(reg, &registry_listener, registry);
	wl_display_dispatch(registry->display);
	wl_display_roundtrip(registry->display);
	wl_registry_destroy(reg);

	return registry;
}
コード例 #26
0
ファイル: wldisplay.c プロジェクト: Lachann/gst-plugins-bad
static void
gst_wl_display_finalize (GObject * gobject)
{
  GstWlDisplay *self = GST_WL_DISPLAY (gobject);

  gst_poll_set_flushing (self->wl_fd_poll, TRUE);

  if (self->thread)
    g_thread_join (self->thread);

  g_array_unref (self->formats);
  gst_poll_free (self->wl_fd_poll);

  if (self->shm)
    wl_shm_destroy (self->shm);

  if (self->shell)
    wl_shell_destroy (self->shell);

  if (self->compositor)
    wl_compositor_destroy (self->compositor);

  if (self->subcompositor)
    wl_subcompositor_destroy (self->subcompositor);

  if (self->registry)
    wl_registry_destroy (self->registry);

  if (self->queue)
    wl_event_queue_destroy (self->queue);

  if (self->own_display) {
    wl_display_flush (self->display);
    wl_display_disconnect (self->display);
  }

  G_OBJECT_CLASS (gst_wl_display_parent_class)->finalize (gobject);
}
コード例 #27
0
ファイル: wl_init.c プロジェクト: ebbnflow/glfw
void _glfwPlatformTerminate(void)
{
    _glfwTerminateEGL();
    _glfwTerminateJoysticksLinux();
    _glfwTerminateThreadLocalStoragePOSIX();

    xkb_keymap_unref(_glfw.wl.xkb.keymap);
    xkb_state_unref(_glfw.wl.xkb.state);
    xkb_context_unref(_glfw.wl.xkb.context);

    if (_glfw.wl.cursorTheme)
        wl_cursor_theme_destroy(_glfw.wl.cursorTheme);
    if (_glfw.wl.cursorSurface)
        wl_surface_destroy(_glfw.wl.cursorSurface);
    if (_glfw.wl.compositor)
        wl_compositor_destroy(_glfw.wl.compositor);
    if (_glfw.wl.shm)
        wl_shm_destroy(_glfw.wl.shm);
    if (_glfw.wl.shell)
        wl_shell_destroy(_glfw.wl.shell);
    if (_glfw.wl.pointer)
        wl_pointer_destroy(_glfw.wl.pointer);
    if (_glfw.wl.keyboard)
        wl_keyboard_destroy(_glfw.wl.keyboard);
    if (_glfw.wl.seat)
        wl_seat_destroy(_glfw.wl.seat);
    if (_glfw.wl.relativePointerManager)
        zwp_relative_pointer_manager_v1_destroy(_glfw.wl.relativePointerManager);
    if (_glfw.wl.pointerConstraints)
        zwp_pointer_constraints_v1_destroy(_glfw.wl.pointerConstraints);
    if (_glfw.wl.registry)
        wl_registry_destroy(_glfw.wl.registry);
    if (_glfw.wl.display)
    {
        wl_display_flush(_glfw.wl.display);
        wl_display_disconnect(_glfw.wl.display);
    }
}
コード例 #28
0
ファイル: simple-damage.c プロジェクト: feilen/weston-rift
static void
destroy_display(struct display *display)
{
	if (display->shm)
		wl_shm_destroy(display->shm);

	if (display->shell)
		xdg_shell_destroy(display->shell);

	if (display->fshell)
		_wl_fullscreen_shell_release(display->fshell);

	if (display->scaler)
		wl_scaler_destroy(display->scaler);

	if (display->compositor)
		wl_compositor_destroy(display->compositor);

	wl_registry_destroy(display->registry);
	wl_display_flush(display->display);
	wl_display_disconnect(display->display);
	free(display);
}
コード例 #29
0
	void shutdownWayland() {

		if(m_sharedMemory) {
			wl_shm_destroy(m_sharedMemory);
		}

		if(m_shell) {
			wl_shell_destroy(m_shell);
		}

		if(m_compositor) {
			wl_compositor_destroy(m_compositor);
		}

		if(m_registry) {
			wl_registry_destroy(m_registry);
		}

		if(display != nullptr) {
			wl_display_disconnect(display);
			display = nullptr;
		}
	}
コード例 #30
0
ファイル: wayland_ctx.c プロジェクト: matthijsberk/RetroArch
static void gfx_ctx_wl_destroy_resources(gfx_ctx_wayland_data_t *wl)
{
   if (!wl)
      return;

   egl_destroy(wl);

   if (wl->win)
      wl_egl_window_destroy(wl->win);
   if (wl->shell)
      wl_shell_destroy(wl->shell);
   if (wl->compositor)
      wl_compositor_destroy(wl->compositor);
   if (wl->registry)
      wl_registry_destroy(wl->registry);
   if (wl->shell_surf)
      wl_shell_surface_destroy(wl->shell_surf);
   if (wl->surface)
      wl_surface_destroy(wl->surface);

   if (wl->dpy)
   {
      wl_display_flush(wl->dpy);
      wl_display_disconnect(wl->dpy);
   }

   wl->win        = NULL;
   wl->shell      = NULL;
   wl->compositor = NULL;
   wl->registry   = NULL;
   wl->dpy        = NULL;
   wl->shell_surf = NULL;
   wl->surface    = NULL;

   wl->width  = 0;
   wl->height = 0;
}