void wlc_view_release(struct wlc_view *view) { if (!view) return; wlc_view_unmap(view); wlc_view_set_parent_ptr(view, NULL); wlc_resource_release(view->shell_surface); wlc_resource_release(view->xdg_surface); wlc_resource_release(view->xdg_popup); chck_string_release(&view->data.title); chck_string_release(&view->data._class); chck_string_release(&view->data.app_id); wlc_surface_attach_to_view(convert_from_wlc_resource(view->surface, "surface"), NULL); chck_iter_pool_release(&view->wl_state); }
void wlc_buffer_dispose(struct wlc_buffer *buffer) { if (!buffer) return; if (buffer->references && --buffer->references > 0) return; wlc_resource_release(convert_to_wlc_resource(buffer)); }
void wlc_view_close_ptr(struct wlc_view *view) { if (!view) return; struct wl_resource *r; if (view->xdg_surface && (r = wl_resource_from_wlc_resource(view->xdg_surface, "xdg-surface"))) { xdg_surface_send_close(r); } else if (is_x11_view(view)) { wlc_x11_window_close(&view->x11); } else if (view->xdg_popup && (r = wl_resource_from_wlc_resource(view->xdg_popup, "xdg-popup"))) { xdg_popup_send_popup_done(r); } else if (view->shell_surface && (r = wl_resource_from_wlc_resource(view->shell_surface, "shell-surface"))) { if (view->type & WLC_BIT_POPUP) { wl_shell_surface_send_popup_done(r); } else { struct wl_client *client = wl_resource_get_client(r); wlc_resource_release(view->shell_surface); wl_client_destroy(client); } } }