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; }
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); } }
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; }
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 client_finalize(struct registry *reg) { wl_shm_destroy(reg->shm); wl_compositor_destroy(reg->compositor); wl_display_disconnect(reg->display); free(reg); //the last memory management is users job }
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); }
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); }
void hello_cleanup_wayland(void) { wl_pointer_destroy(pointer); wl_seat_destroy(seat); wl_shell_destroy(shell); wl_shm_destroy(shm); wl_compositor_destroy(compositor); wl_display_disconnect(display); }
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; } }
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; }
static void destroyWLContext() { if (g_wlContextStruct.wlSurface) { wl_surface_destroy(g_wlContextStruct.wlSurface); } if (g_wlContextStruct.wlCompositor) { wl_compositor_destroy(g_wlContextStruct.wlCompositor); } }
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 ); }
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); }
int main(int argc, char **argv) { struct sigaction sigint; struct display display = { 0 }; struct window window = { 0 }; window.display = &display; window.geometry.width = 250; window.geometry.height = 250; display.display = wl_display_connect(NULL); assert(display.display); wl_display_add_global_listener(display.display, display_handle_global, &display); wl_display_get_fd(display.display, event_mask_update, &display); wl_display_iterate(display.display, WL_DISPLAY_READABLE); init_egl(&display); create_surface(&window); init_gl(&window); sigint.sa_handler = signal_int; sigemptyset(&sigint.sa_mask); sigint.sa_flags = SA_RESETHAND; sigaction(SIGINT, &sigint, NULL); redraw(&window, NULL, 0); while (running) wl_display_iterate(display.display, display.mask); fprintf(stderr, "simple-egl exiting\n"); destroy_surface(&window); fini_egl(&display); if (display.shell) wl_shell_destroy(display.shell); if (display.compositor) wl_compositor_destroy(display.compositor); wl_display_flush(display.display); wl_display_disconnect(display.display); return 0; }
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_display_flush (display->display); wl_display_disconnect (display->display); free (display); }
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{ }; }
/** * 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 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); }
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); }
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); }
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; } }
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); }
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); }
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); } }
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; } }
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); }
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; }
void registry_teardown(struct registry *registry) { if (registry->pointer) { wl_pointer_destroy(registry->pointer); } if (registry->seat) { wl_seat_destroy(registry->seat); } if (registry->shell) { wl_shell_destroy(registry->shell); } if (registry->shm) { wl_shm_destroy(registry->shm); } if (registry->compositor) { wl_compositor_destroy(registry->compositor); } if (registry->display) { wl_display_disconnect(registry->display); } if (registry->outputs) { free_flat_list(registry->outputs); } free(registry); }
void WLContext::DestroyWLContext() { if (m_wlCompositor) wl_compositor_destroy(m_wlCompositor); }
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; }