Remove destroyed views from scratchpad

Fixes #1363
This commit is contained in:
Drew DeVault 2017-10-08 10:57:41 -04:00
parent 46e5aeac50
commit 5ecedc7199
2 changed files with 28 additions and 17 deletions

View File

@ -516,11 +516,11 @@ swayc_t *destroy_view(swayc_t *view) {
return NULL;
}
sway_log(L_DEBUG, "Destroying view '%p'", view);
swayc_t *parent = view->parent;
free_swayc(view);
// Destroy empty containers
if (parent->type == C_CONTAINER) {
swayc_t *parent = view->parent;
if (parent && parent->type == C_CONTAINER) {
return destroy_container(parent);
}
return parent;

View File

@ -553,6 +553,7 @@ static void handle_view_destroyed(wlc_handle handle) {
bool fullscreen = swayc_is_fullscreen(view);
remove_view_from_scratchpad(view);
swayc_t *parent = destroy_view(view);
if (parent) {
if (fullscreen) {
parent->fullscreen = NULL;
}
@ -569,6 +570,7 @@ static void handle_view_destroyed(wlc_handle handle) {
}
arrange_windows(parent, -1, -1);
}
} else {
// Is it unmanaged?
int i;
@ -584,6 +586,15 @@ static void handle_view_destroyed(wlc_handle handle) {
}
}
}
// Is it in the scratchpad?
for (i = 0; i < scratchpad->length; ++i) {
swayc_t *item = scratchpad->items[i];
if (item->handle == handle) {
list_del(scratchpad, i);
destroy_view(item);
break;
}
}
}
set_focused_container(get_focused_view(&root_container));
}