diff options
Diffstat (limited to 'sway/handlers.c')
-rw-r--r-- | sway/handlers.c | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/sway/handlers.c b/sway/handlers.c index db0c5e24..d37142a9 100644 --- a/sway/handlers.c +++ b/sway/handlers.c | |||
@@ -553,22 +553,24 @@ static void handle_view_destroyed(wlc_handle handle) { | |||
553 | bool fullscreen = swayc_is_fullscreen(view); | 553 | bool fullscreen = swayc_is_fullscreen(view); |
554 | remove_view_from_scratchpad(view); | 554 | remove_view_from_scratchpad(view); |
555 | swayc_t *parent = destroy_view(view); | 555 | swayc_t *parent = destroy_view(view); |
556 | if (fullscreen) { | 556 | if (parent) { |
557 | parent->fullscreen = NULL; | 557 | if (fullscreen) { |
558 | } | 558 | parent->fullscreen = NULL; |
559 | } | ||
559 | 560 | ||
560 | ipc_event_window(parent, "close"); | 561 | ipc_event_window(parent, "close"); |
561 | 562 | ||
562 | // Destroy empty workspaces | 563 | // Destroy empty workspaces |
563 | if (parent->type == C_WORKSPACE && | 564 | if (parent->type == C_WORKSPACE && |
564 | parent->children->length == 0 && | 565 | parent->children->length == 0 && |
565 | parent->floating->length == 0 && | 566 | parent->floating->length == 0 && |
566 | swayc_active_workspace() != parent && | 567 | swayc_active_workspace() != parent && |
567 | !parent->visible) { | 568 | !parent->visible) { |
568 | parent = destroy_workspace(parent); | 569 | parent = destroy_workspace(parent); |
569 | } | 570 | } |
570 | 571 | ||
571 | arrange_windows(parent, -1, -1); | 572 | arrange_windows(parent, -1, -1); |
573 | } | ||
572 | } else { | 574 | } else { |
573 | // Is it unmanaged? | 575 | // Is it unmanaged? |
574 | int i; | 576 | int i; |
@@ -584,6 +586,15 @@ static void handle_view_destroyed(wlc_handle handle) { | |||
584 | } | 586 | } |
585 | } | 587 | } |
586 | } | 588 | } |
589 | // Is it in the scratchpad? | ||
590 | for (i = 0; i < scratchpad->length; ++i) { | ||
591 | swayc_t *item = scratchpad->items[i]; | ||
592 | if (item->handle == handle) { | ||
593 | list_del(scratchpad, i); | ||
594 | destroy_view(item); | ||
595 | break; | ||
596 | } | ||
597 | } | ||
587 | } | 598 | } |
588 | set_focused_container(get_focused_view(&root_container)); | 599 | set_focused_container(get_focused_view(&root_container)); |
589 | } | 600 | } |