static void
gst_wl_window_finalize (GObject * gobject)
{
  GstWlWindow *self = GST_WL_WINDOW (gobject);

  if (self->shell_surface)
    wl_shell_surface_destroy (self->shell_surface);

  if (self->video_viewport)
    wp_viewport_destroy (self->video_viewport);

  wl_proxy_wrapper_destroy (self->video_surface_wrapper);
  wl_subsurface_destroy (self->video_subsurface);
  wl_surface_destroy (self->video_surface);

  if (self->area_subsurface)
    wl_subsurface_destroy (self->area_subsurface);

  if (self->area_viewport)
    wp_viewport_destroy (self->area_viewport);

  wl_proxy_wrapper_destroy (self->area_surface_wrapper);
  wl_surface_destroy (self->area_surface);

  g_clear_object (&self->display);

  G_OBJECT_CLASS (gst_wl_window_parent_class)->finalize (gobject);
}
Exemple #2
0
/*
 * Closes a window, destroying the frame and OpenGL context
 */
void fgPlatformCloseWindow( SFG_Window* window )
{
    fghPlatformCloseWindowEGL(window);

    if ( window->Window.pContext.egl_window )
      wl_egl_window_destroy( window->Window.pContext.egl_window );
    if ( window->Window.pContext.shsurface )
      wl_shell_surface_destroy( window->Window.pContext.shsurface );
    if ( window->Window.pContext.surface )
      wl_surface_destroy( window->Window.pContext.surface );
    if ( window->Window.pContext.cursor_surface )
      wl_surface_destroy( window->Window.pContext.cursor_surface );
}
Exemple #3
0
static EventdNdSurface *
_eventd_nd_wl_surface_new(EventdNdBackendContext *context, EventdNdNotification *notification, gint width, gint height)
{
    EventdNdSurface *self;

    self = g_new0(EventdNdSurface, 1);
    self->context = context;
    self->notification = notification;
    self->width = width;
    self->height = height;

    self->surface = wl_compositor_create_surface(context->compositor);
    wl_surface_set_user_data(self->surface, self);

    if ( ! _eventd_nd_wl_create_buffer(self) )
    {
        wl_surface_destroy(self->surface);
        g_free(self);
        return NULL;
    }

    self->ww_notification = zww_notification_area_v1_create_notification(context->notification_area, self->surface);

    return self;
}
void
_ecore_wl_window_semi_free(Ecore_Wl2_Window *window)
{
   if (window->zxdg_popup) zxdg_popup_v6_destroy(window->zxdg_popup);
   window->zxdg_popup = NULL;

   if (window->zxdg_toplevel) zxdg_toplevel_v6_destroy(window->zxdg_toplevel);
   window->zxdg_toplevel = NULL;

   if (window->zxdg_surface) zxdg_surface_v6_destroy(window->zxdg_surface);
   window->zxdg_surface = NULL;

   if (window->xdg_surface) xdg_surface_destroy(window->xdg_surface);
   window->xdg_surface = NULL;

   if (window->xdg_popup) xdg_popup_destroy(window->xdg_popup);
   window->xdg_popup = NULL;

   if (window->www_surface)
     www_surface_destroy(window->www_surface);
   window->www_surface = NULL;

   if (window->surface) wl_surface_destroy(window->surface);
   window->surface = NULL;
   window->surface_id = -1;
}
static void
_cogl_winsys_egl_cleanup_context (CoglDisplay *display)
{
  CoglRenderer *renderer = display->renderer;
  CoglRendererEGL *egl_renderer = renderer->winsys;
  CoglDisplayEGL *egl_display = display->winsys;
  CoglDisplayWayland *wayland_display = egl_display->platform;

  if (egl_display->dummy_surface != EGL_NO_SURFACE)
    {
      eglDestroySurface (egl_renderer->edpy, egl_display->dummy_surface);
      egl_display->dummy_surface = EGL_NO_SURFACE;
    }

  if (wayland_display->dummy_wayland_egl_native_window)
    {
      wl_egl_window_destroy (wayland_display->dummy_wayland_egl_native_window);
      wayland_display->dummy_wayland_egl_native_window = NULL;
    }

  if (wayland_display->dummy_wayland_surface)
    {
      wl_surface_destroy (wayland_display->dummy_wayland_surface);
      wayland_display->dummy_wayland_surface = NULL;
    }
}
Exemple #6
0
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;
}
Exemple #7
0
struct wl_shell_surface *hello_create_surface(void)
{
    struct wl_surface *surface;
    struct wl_shell_surface *shell_surface;

    surface = wl_compositor_create_surface(compositor);

    if (surface == NULL)
        return NULL;

    shell_surface = wl_shell_get_shell_surface(shell, surface);

    if (shell_surface == NULL) {
        wl_surface_destroy(surface);
        return NULL;
    }

    wl_shell_surface_add_listener(shell_surface,
        &shell_surface_listener, 0);
    wl_shell_surface_set_toplevel(shell_surface);
    wl_shell_surface_set_user_data(shell_surface, surface);
    wl_surface_set_user_data(surface, NULL);

    return shell_surface;
}
Exemple #8
0
void hello_set_cursor_from_pool(struct wl_shm_pool *pool,
    unsigned width, unsigned height,
    int32_t hot_spot_x, int32_t hot_spot_y)
{
    struct pointer_data *data;

    data = malloc(sizeof(struct pointer_data));

    if (data == NULL)
        goto error;

    data->hot_spot_x = hot_spot_x;
    data->hot_spot_y = hot_spot_y;
    data->surface = wl_compositor_create_surface(compositor);

    if (data->surface == NULL)
        goto cleanup_alloc;

    data->buffer = hello_create_buffer(pool, width, height);

    if (data->buffer == NULL)
        goto cleanup_surface;

    wl_pointer_set_user_data(pointer, data);

    return;

cleanup_surface:
    wl_surface_destroy(data->surface);
cleanup_alloc:
    free(data);
error:
    perror("Unable to allocate cursor");
}
Exemple #9
0
void cWaylandInterface::DestroyWindow(void)
{
	wl_egl_window_destroy(GLWin.wl_egl_native);

	wl_shell_surface_destroy(GLWin.wl_shell_surface);
	wl_surface_destroy(GLWin.wl_surface);
}
QWaylandCursor::~QWaylandCursor()
{
    if (mSurface)
        wl_surface_destroy(mSurface);

    delete mBuffer;
}
Exemple #11
0
static void delete_window (struct window *window) {
	eglDestroySurface (egl_display, window->egl_surface);
	wl_egl_window_destroy (window->egl_window);
	wl_shell_surface_destroy (window->shell_surface);
	wl_surface_destroy (window->surface);
	eglDestroyContext (egl_display, window->egl_context);
}
Exemple #12
0
UwacReturnCode UwacDestroyWindow(UwacWindow** pwindow)
{
	UwacWindow* w;
	assert(pwindow);
	w = *pwindow;
	UwacWindowDestroyBuffers(w);

	if (w->frame_callback)
		wl_callback_destroy(w->frame_callback);

	if (w->xdg_surface)
		xdg_surface_destroy(w->xdg_surface);

#if BUILD_IVI

	if (w->ivi_surface)
		ivi_surface_destroy(w->ivi_surface);

#endif

	if (w->opaque_region)
		wl_region_destroy(w->opaque_region);

	if (w->input_region)
		wl_region_destroy(w->opaque_region);

	wl_surface_destroy(w->surface);
	wl_list_remove(&w->link);
	free(w);
	*pwindow = NULL;
	return UWAC_SUCCESS;
}
static void
gst_gl_window_wayland_egl_close (GstGLWindow * window)
{
  GstGLWindowWaylandEGL *window_egl;

  window_egl = GST_GL_WINDOW_WAYLAND_EGL (window);

  destroy_surface (window_egl);

  if (window_egl->display.cursor_surface)
    wl_surface_destroy (window_egl->display.cursor_surface);

  if (window_egl->display.cursor_theme)
    wl_cursor_theme_destroy (window_egl->display.cursor_theme);

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

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

  if (window_egl->display.display) {
    wl_display_flush (window_egl->display.display);
    wl_display_disconnect (window_egl->display.display);
  }
}
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_;
    }
}
static void
gst_vaapi_window_wayland_destroy (GstVaapiWindow * window)
{
    GstVaapiWindowWaylandPrivate *const priv =
        GST_VAAPI_WINDOW_WAYLAND_GET_PRIVATE (window);

    /* Wait for the last frame to complete redraw */
    gst_vaapi_window_wayland_sync (window);

    if (priv->last_frame) {
        frame_state_free (priv->last_frame);
        priv->last_frame = NULL;
    }

    if (priv->shell_surface) {
        wl_shell_surface_destroy (priv->shell_surface);
        priv->shell_surface = NULL;
    }

    if (priv->surface) {
        wl_surface_destroy (priv->surface);
        priv->surface = NULL;
    }

    if (priv->event_queue) {
        wl_event_queue_destroy (priv->event_queue);
        priv->event_queue = NULL;
    }

    gst_vaapi_filter_replace (&priv->filter, NULL);
    gst_vaapi_video_pool_replace (&priv->surface_pool, NULL);

    gst_poll_free (priv->poll);
}
Exemple #16
0
void Wayland_DestroyWindow(_THIS, SDL_Window *window)
{
    SDL_VideoData *data = _this->driverdata;
    SDL_WindowData *wind = window->driverdata;

    if (data) {
        SDL_EGL_DestroySurface(_this, wind->egl_surface);
        WAYLAND_wl_egl_window_destroy(wind->egl_window);

        if (wind->shell_surface)
            wl_shell_surface_destroy(wind->shell_surface);

#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
        if (wind->extended_surface) {
            QtExtendedSurface_Unsubscribe(wind->extended_surface, SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION);
            QtExtendedSurface_Unsubscribe(wind->extended_surface, SDL_HINT_QTWAYLAND_WINDOW_FLAGS);
            qt_extended_surface_destroy(wind->extended_surface);
        }
#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
        wl_surface_destroy(wind->surface);

        SDL_free(wind);
        WAYLAND_wl_display_flush(data->display);
    }
    window->driverdata = NULL;
}
WLSurface::~WLSurface()
{
    if (m_ilmSurfaceId > 0)
        ilm_surfaceRemove(m_ilmSurfaceId);

    if (m_wlSurface)
        wl_surface_destroy(m_wlSurface);
}
Exemple #18
0
void hello_free_surface(struct wl_shell_surface *shell_surface)
{
    struct wl_surface *surface;

    surface = wl_shell_surface_get_user_data(shell_surface);
    wl_shell_surface_destroy(shell_surface);
    wl_surface_destroy(surface);
}
Exemple #19
0
QWaylandWindow::~QWaylandWindow()
{
    if (mSurface)
        wl_surface_destroy(mSurface);

    QList<QWaylandInputDevice *> inputDevices = mDisplay->inputDevices();
    for (int i = 0; i < inputDevices.size(); ++i)
        inputDevices.at(i)->handleWindowDestroyed(this);
}
Exemple #20
0
WaylandSurface::~WaylandSurface()
{
    // The surface couldn't have been created in the first place if WaylandDisplay wasn't properly initialized.
    ASSERT(WaylandDisplay::instance());
    eglMakeCurrent(WaylandDisplay::instance()->eglDisplay(), EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);

    wl_egl_window_destroy(m_nativeWindow);
    wl_surface_destroy(m_wlSurface);
}
static void
destroy_window (struct window *window)
{
  if (window->shell_surface)
    wl_shell_surface_destroy (window->shell_surface);
  if (window->surface)
    wl_surface_destroy (window->surface);
  free (window);
}
Exemple #22
0
static void
_eventd_nd_wl_registry_handle_global_remove(void *data, struct wl_registry *registry, uint32_t name)
{
    EventdNdBackendContext *self = data;

    EventdNdWlGlobalName i;
    for ( i = 0 ; i < _EVENTD_ND_WL_GLOBAL_SIZE ; ++i )
    {
        if ( self->global_names[i] != name )
            continue;
        self->global_names[i] = 0;

        switch ( i )
        {
        case EVENTD_ND_WL_GLOBAL_COMPOSITOR:
            wl_compositor_destroy(self->compositor);
            self->compositor = NULL;
        break;
        case EVENTD_ND_WL_GLOBAL_NOTIFICATION_DAEMON:
            zww_notification_area_v1_destroy(self->notification_area);
            self->notification_area = NULL;
        break;
        case EVENTD_ND_WL_GLOBAL_SHM:
            wl_shm_destroy(self->shm);
            self->shm = NULL;
        break;
        case _EVENTD_ND_WL_GLOBAL_SIZE:
            g_return_if_reached();
        }
        return;
    }
    if ( ( self->cursor.theme != NULL ) && ( ( self->compositor == NULL ) || ( self->shm == NULL ) ) )
    {
        if ( self->cursor.frame_cb != NULL )
            wl_callback_destroy(self->cursor.frame_cb);
        self->cursor.frame_cb = NULL;

        wl_surface_destroy(self->cursor.surface);
        wl_cursor_theme_destroy(self->cursor.theme);
        self->cursor.surface = NULL;
        self->cursor.image = NULL;
        self->cursor.cursor = NULL;
        self->cursor.theme = NULL;
    }

    GSList *seat_;
    for ( seat_ = self->seats ; seat_ != NULL ; seat_ = g_slist_next(seat_) )
    {
        EventdNdWlSeat *seat = seat_->data;
        if ( seat->global_name != name )
            continue;

        _eventd_nd_wl_seat_release(seat);
        return;
    }
}
Exemple #23
0
void hello_free_cursor(void)
{
    struct pointer_data *data;

    data = wl_pointer_get_user_data(pointer);
    wl_buffer_destroy(data->buffer);
    wl_surface_destroy(data->surface);
    free(data);
    wl_pointer_set_user_data(pointer, NULL);
}
Exemple #24
0
static void destroyWLContext()
{
    if (g_wlContextStruct.wlSurface)
    {
        wl_surface_destroy(g_wlContextStruct.wlSurface);
    }
    if (g_wlContextStruct.wlCompositor)
    {
        wl_compositor_destroy(g_wlContextStruct.wlCompositor);
    }
}
Exemple #25
0
static void
destroy_window(struct window *window)
{
	if (window->callback)
		wl_callback_destroy(window->callback);

	wl_buffer_destroy(window->buffer);
	wl_shell_surface_destroy(window->shell_surface);
	wl_surface_destroy(window->surface);
	free(window);
}
Exemple #26
0
static void
destroy_surface(struct window *window)
{
	wl_egl_window_destroy(window->native);

	wl_shell_surface_destroy(window->shell_surface);
	wl_surface_destroy(window->surface);

	if (window->callback)
		wl_callback_destroy(window->callback);
}
static void
cursor_surface_destroy(struct cursor_surface *cursor)
{
    if (cursor->shsurf)
        wl_shell_surface_destroy(cursor->shsurf);
    if (cursor->surface)
        wl_surface_destroy(cursor->surface);
    if (cursor->frame)
        wl_callback_destroy(cursor->frame);
    free(cursor);
}
Exemple #28
0
static void 
_ecore_wl_input_seat_handle_capabilities(void *data, struct wl_seat *seat, enum wl_seat_capability caps)
{
   Ecore_Wl_Input *input;

   if (!(input = data)) return;

   LOGFN(__FILE__, __LINE__, __FUNCTION__);

   if ((caps & WL_SEAT_CAPABILITY_POINTER) && (!input->pointer))
     {
        input->pointer = wl_seat_get_pointer(seat);
        wl_pointer_set_user_data(input->pointer, input);
        wl_pointer_add_listener(input->pointer, &pointer_listener, input);

        if (!input->cursor_surface)
          {
             input->cursor_surface = 
               wl_compositor_create_surface(_ecore_wl_disp->wl.compositor);
          }
     }
   else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && (input->pointer))
     {
        if (input->cursor_surface) wl_surface_destroy(input->cursor_surface);
        input->cursor_surface = NULL;
        wl_pointer_destroy(input->pointer);
        input->pointer = NULL;
     }

   if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && (!input->keyboard))
     {
        input->keyboard = wl_seat_get_keyboard(seat);
        wl_keyboard_set_user_data(input->keyboard, input);
        wl_keyboard_add_listener(input->keyboard, &keyboard_listener, input);
     }
   else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && (input->keyboard))
     {
        wl_keyboard_destroy(input->keyboard);
        input->keyboard = NULL;
     }

   if ((caps & WL_SEAT_CAPABILITY_TOUCH) && (!input->touch))
     {
        input->touch = wl_seat_get_touch(seat);
        wl_touch_set_user_data(input->touch, input);
        wl_touch_add_listener(input->touch, &touch_listener, input);
     }
   else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && (input->touch))
     {
        wl_touch_destroy(input->touch);
        input->touch = NULL;
     }
}
Exemple #29
0
void QWaylandWindow::setVisible(bool visible)
{
    if (!mSurface && visible) {
        mSurface = mDisplay->createSurface(this);
        newSurfaceCreated();
    }

    if (!visible) {
        wl_surface_destroy(mSurface);
        mSurface = NULL;
    }
}
QWaylandWindow::~QWaylandWindow()
{
    if (mSurface) {
        delete mShellSurface;
        delete mExtendedWindow;
        wl_surface_destroy(mSurface);
    }

    QList<QWaylandInputDevice *> inputDevices = mDisplay->inputDevices();
    for (int i = 0; i < inputDevices.size(); ++i)
        inputDevices.at(i)->handleWindowDestroyed(this);
}