view: Refactor view destruction

Consolidates all of the view destruction code for xwl + xdg into one function.

Fixes several notable bugs along the way:
  - Fixes a crash when alt tabbing when a selected view gets destroyed.
  - Fixes the OSD not updating to reflect a view has been destroyed.
This commit is contained in:
Joshua Ashton 2022-04-21 23:33:44 +00:00 committed by Consolatis
parent dee370f1b4
commit d0b9680d00
4 changed files with 64 additions and 36 deletions

View file

@ -78,21 +78,7 @@ static void
handle_destroy(struct wl_listener *listener, void *data)
{
struct view *view = wl_container_of(listener, view, destroy);
if (view->toplevel_handle) {
wlr_foreign_toplevel_handle_v1_destroy(view->toplevel_handle);
}
interactive_end(view);
if (view->server->seat.active_view == view) {
view->server->seat.active_view = NULL;
}
wl_list_remove(&view->link);
wl_list_remove(&view->destroy.link);
if (view->scene_tree) {
ssd_destroy(view);
wlr_scene_node_destroy(&view->scene_tree->node);
view->scene_tree = NULL;
}
free(view);
view_handle_destroy(view);
}
static void