aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2015-08-25 16:13:06 -0400
committerDrew DeVault <sir@cmpwn.com>2015-08-25 16:13:06 -0400
commit0bf380a0b1a83f49e2e33066ab6504d308dcec89 (patch)
treed029363b0c873a95946d2ec61ae8fbb73fedf630
parentfa6292ff24082f90886353844b45e99ec965daa5 (diff)
parent227d5dbe08e5be9e0fa116925581a086c8bf60d1 (diff)
Merge pull request #131 from nicklaswj/master
Focus floating window, if any, when the last tiling window has been closed
-rw-r--r--sway/handlers.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sway/handlers.c b/sway/handlers.c
index af68b765..4d1dc56c 100644
--- a/sway/handlers.c
+++ b/sway/handlers.c
@@ -230,7 +230,15 @@ static void handle_view_destroyed(wlc_handle handle) {
locked_container_focus = false;
break;
}
- set_focused_container(get_focused_view(&root_container));
+
+ swayc_t *focused_view = get_focused_view(&root_container);
+ if (focused_view->type == C_WORKSPACE && focused_view->children->length == 0) {
+ if (focused_view->floating->length > 0) {
+ focused_view = focused_view->floating->items[focused_view->floating->length-1];
+ focused_view = get_focused_view(focused_view);
+ }
+ }
+ set_focused_container(focused_view);
}
static void handle_view_focus(wlc_handle view, bool focus) {