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); }
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; }
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_; } }
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); }
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); }
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); }
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; }
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); }
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); }
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); }
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); }
void _glfwPlatformDestroyWindow(_GLFWwindow* window) { if (window->wl.native) wl_egl_window_destroy(window->wl.native); _glfwDestroyContext(window); if (window->wl.shell_surface) wl_shell_surface_destroy(window->wl.shell_surface); if (window->wl.surface) wl_surface_destroy(window->wl.surface); }
/* * 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 ); }
/** * Destroys a Wayland shell surface. */ static void Close(vout_window_t *wnd) { vout_window_sys_t *sys = wnd->sys; vlc_cancel(sys->thread); vlc_join(sys->thread, NULL); wl_shell_surface_destroy(sys->shell_surface); wl_surface_destroy(wnd->handle.wl); wl_shell_destroy(sys->shell); if (sys->output != NULL) wl_output_destroy(sys->output); wl_compositor_destroy(sys->compositor); wl_display_disconnect(wnd->display.wl); vlc_mutex_destroy(&sys->lock); free(sys); }
static void destroy_surface(struct window *window) { /* Required, otherwise segfault in egl_dri2.c: dri2_make_current() * on eglReleaseThread(). */ eglMakeCurrent(window->display->egl.dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); eglDestroySurface(window->display->egl.dpy, window->egl_surface); 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 destroy_surfaces (GstGLWindowWaylandEGL * window_egl) { if (window_egl->window.subsurface) { wl_subsurface_destroy (window_egl->window.subsurface); window_egl->window.subsurface = NULL; } if (window_egl->window.shell_surface) { wl_shell_surface_destroy (window_egl->window.shell_surface); window_egl->window.shell_surface = NULL; } if (window_egl->window.surface) { wl_surface_destroy (window_egl->window.surface); window_egl->window.surface = NULL; } if (window_egl->window.native) { wl_egl_window_destroy (window_egl->window.native); window_egl->window.native = NULL; } }
void wlf_DestroyWindow(wlfContext* wlfc, wlfWindow* window) { if (window == NULL) return; if (wlfc->window == window) wlfc->window = NULL; if (window->buffers[0].buffer) wl_buffer_destroy(window->buffers[0].buffer); if (window->buffers[1].buffer) wl_buffer_destroy(window->buffers[1].buffer); if (window->shell_surface) wl_shell_surface_destroy(window->shell_surface); if (window->surface) wl_surface_destroy(window->surface); free(window->data); free(window); }
static void gst_vaapi_window_wayland_destroy(GstVaapiWindow * window) { GstVaapiWindowWaylandPrivate * const priv = GST_VAAPI_WINDOW_WAYLAND(window)->priv; 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->buffer) { wl_buffer_destroy(priv->buffer); priv->buffer = NULL; } }
static void _cogl_winsys_egl_onscreen_deinit (CoglOnscreen *onscreen) { CoglOnscreenEGL *egl_onscreen = onscreen->winsys; CoglOnscreenWayland *wayland_onscreen = egl_onscreen->platform; FrameCallbackData *frame_callback_data, *tmp; _cogl_list_for_each_safe (frame_callback_data, tmp, &wayland_onscreen->frame_callbacks, link) free_frame_callback_data (frame_callback_data); if (wayland_onscreen->wayland_egl_native_window) { wl_egl_window_destroy (wayland_onscreen->wayland_egl_native_window); wayland_onscreen->wayland_egl_native_window = NULL; } if (!onscreen->foreign_surface) { /* NB: The wayland protocol docs explicitly state that * "wl_shell_surface_destroy() must be called before destroying * the wl_surface object." ... */ if (wayland_onscreen->wayland_shell_surface) { wl_shell_surface_destroy (wayland_onscreen->wayland_shell_surface); wayland_onscreen->wayland_shell_surface = NULL; } if (wayland_onscreen->wayland_surface) { wl_surface_destroy (wayland_onscreen->wayland_surface); wayland_onscreen->wayland_surface = NULL; } } g_slice_free (CoglOnscreenWayland, wayland_onscreen); }
static void destroy_surface (GstGLWindowWaylandEGL * window_egl) { if (window_egl->window.native) wl_egl_window_destroy (window_egl->window.native); if (window_egl->window.shell_surface) wl_shell_surface_destroy (window_egl->window.shell_surface); if (window_egl->window.surface) wl_surface_destroy (window_egl->window.surface); if (window_egl->window.callback) wl_callback_destroy (window_egl->window.callback); g_source_destroy (window_egl->wl_source); g_source_unref (window_egl->wl_source); window_egl->wl_source = NULL; g_main_loop_unref (window_egl->loop); window_egl->loop = NULL, g_main_context_unref (window_egl->main_context); window_egl->main_context = NULL; }
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) 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; }
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; }
QWaylandShellSurface::~QWaylandShellSurface() { wl_shell_surface_destroy(object()); }
int wlfreerdp_run(freerdp* instance) { int i; int fds; int max_fds; int rcount; int wcount; void* rfds[32]; void* wfds[32]; fd_set rfds_set; fd_set wfds_set; ZeroMemory(rfds, sizeof(rfds)); ZeroMemory(wfds, sizeof(wfds)); freerdp_connect(instance); while (1) { rcount = 0; wcount = 0; if (freerdp_get_fds(instance, rfds, &rcount, wfds, &wcount) != TRUE) { printf("Failed to get FreeRDP file descriptor"); break; } if (freerdp_channels_get_fds(instance->context->channels, instance, rfds, &rcount, wfds, &wcount) != TRUE) { printf("Failed to get FreeRDP file descriptor"); break; } max_fds = 0; FD_ZERO(&rfds_set); FD_ZERO(&wfds_set); for (i = 0; i < rcount; i++) { fds = (int)(long)(rfds[i]); if (fds > max_fds) max_fds = fds; FD_SET(fds, &rfds_set); } if (max_fds == 0) break; if (select(max_fds + 1, &rfds_set, &wfds_set, NULL, NULL) == -1) { if (!((errno == EAGAIN) || (errno == EWOULDBLOCK) || (errno == EINPROGRESS) || (errno == EINTR))) { printf("wlfreerdp_run: select failed\n"); break; } } if (freerdp_check_fds(instance) != TRUE) { printf("Failed to check FreeRDP file descriptor\n"); break; } if (freerdp_channels_check_fds(instance->context->channels, instance) != TRUE) { printf("Failed to check channel manager file descriptor\n"); break; } } struct display* display; struct window* window; struct wl_context* context; context = (struct wl_context*) instance->context; display = context->display; window = context->window; free(window->buffers[0].shm_data); free(window->buffers[1].shm_data); free(window->data); wl_buffer_destroy(window->buffers[0].buffer); wl_buffer_destroy(window->buffers[1].buffer); wl_shell_surface_destroy(window->shell_surface); wl_surface_destroy(window->surface); wl_shm_destroy(display->shm); wl_shell_destroy(display->shell); wl_compositor_destroy(display->compositor); wl_registry_destroy(display->registry); wl_display_disconnect(display->display); freerdp_channels_close(instance->context->channels, instance); freerdp_channels_free(instance->context->channels); freerdp_free(instance); return 0; }
/** * Creates a Wayland shell surface. */ static int Open(vout_window_t *wnd, const vout_window_cfg_t *cfg) { if (cfg->type != VOUT_WINDOW_TYPE_INVALID && cfg->type != VOUT_WINDOW_TYPE_WAYLAND) return VLC_EGENERIC; vout_window_sys_t *sys = malloc(sizeof (*sys)); if (unlikely(sys == NULL)) return VLC_ENOMEM; sys->compositor = NULL; sys->output = NULL; sys->shell = NULL; sys->shell_surface = NULL; sys->top_width = cfg->width; sys->top_height = cfg->height; sys->fs_width = cfg->width; sys->fs_height = cfg->height; sys->fullscreen = false; vlc_mutex_init(&sys->lock); wnd->sys = sys; /* Connect to the display server */ char *dpy_name = var_InheritString(wnd, "wl-display"); struct wl_display *display = wl_display_connect(dpy_name); free(dpy_name); if (display == NULL) { vlc_mutex_destroy(&sys->lock); free(sys); return VLC_EGENERIC; } /* Find the interesting singleton(s) */ struct wl_registry *registry = wl_display_get_registry(display); if (registry == NULL) goto error; wl_registry_add_listener(registry, ®istry_cbs, wnd); wl_display_roundtrip(display); wl_registry_destroy(registry); if (sys->compositor == NULL || sys->shell == NULL) goto error; if (sys->output != NULL) wl_output_add_listener(sys->output, &output_cbs, wnd); /* Create a surface */ struct wl_surface *surface = wl_compositor_create_surface(sys->compositor); if (surface == NULL) goto error; struct wl_shell_surface *shell_surface = wl_shell_get_shell_surface(sys->shell, surface); if (shell_surface == NULL) goto error; sys->shell_surface = shell_surface; wl_shell_surface_add_listener(shell_surface, &shell_surface_cbs, wnd); wl_shell_surface_set_class(shell_surface, PACKAGE_NAME); wl_shell_surface_set_toplevel(shell_surface); char *title = var_InheritString(wnd, "video-title"); wl_shell_surface_set_title(shell_surface, title ? title : _("VLC media player")); free(title); //if (var_InheritBool (wnd, "keyboard-events")) // do_something(); wl_display_flush(display); wnd->type = VOUT_WINDOW_TYPE_WAYLAND; wnd->handle.wl = surface; wnd->display.wl = display; wnd->control = Control; if (vlc_clone (&sys->thread, Thread, wnd, VLC_THREAD_PRIORITY_LOW)) goto error; vout_window_ReportSize(wnd, cfg->width, cfg->height); return VLC_SUCCESS; error: if (sys->shell_surface != NULL) wl_shell_surface_destroy(sys->shell_surface); if (sys->shell != NULL) wl_shell_destroy(sys->shell); if (sys->output != NULL) wl_output_destroy(sys->output); if (sys->compositor != NULL) wl_compositor_destroy(sys->compositor); wl_display_disconnect(display); vlc_mutex_destroy(&sys->lock); free(sys); return VLC_EGENERIC; }
QWaylandWlShellSurface::~QWaylandWlShellSurface() { wl_shell_surface_destroy(object()); delete m_extendedWindow; }
static void gst_mfx_window_wayland_destroy (GstMfxWindow * window) { GstMfxWindowWaylandPrivate *const priv = GST_MFX_WINDOW_WAYLAND_GET_PRIVATE (window); struct wl_display *const display = GST_MFX_DISPLAY_HANDLE (GST_MFX_WINDOW_DISPLAY (window)); /* Make sure that the last wl_buffer's callback could be called */ GST_MFX_DISPLAY_LOCK (GST_MFX_WINDOW_DISPLAY (window)); if (priv->surface) { wl_surface_attach (priv->surface, NULL, 0, 0); wl_surface_commit (priv->surface); wl_display_flush (display); } GST_MFX_DISPLAY_UNLOCK (GST_MFX_WINDOW_DISPLAY (window)); gst_poll_set_flushing (priv->poll, TRUE); if (priv->event_queue) { wl_display_roundtrip_queue (display, priv->event_queue); } if (priv->thread) { g_thread_join (priv->thread); priv->thread = NULL; } #ifdef USE_WESTON_4_0 if (priv->wp_viewport) { wp_viewport_destroy (priv->wp_viewport); priv->wp_viewport = NULL; } #else if (priv->viewport) { wl_viewport_destroy (priv->viewport); priv->viewport = NULL; } #endif 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; } #ifdef USE_EGL if (priv->egl_window) { wl_egl_window_destroy (priv->egl_window); priv->egl_window = NULL; } #endif gst_poll_free (priv->poll); }
ShellSurface::~ShellSurface() { wl_shell_surface_destroy(*this); }