aboutsummaryrefslogtreecommitdiff
path: root/sway/handlers.c
diff options
context:
space:
mode:
authorNicklas Warming Jacobsen <nicklaswj@gmail.com>2015-08-25 20:15:23 +0200
committerNicklas Warming Jacobsen <nicklaswj@gmail.com>2015-08-25 20:15:23 +0200
commit7a1c36716aa1248fc6410df8fddb6702dfa99c0f (patch)
tree6c7efea5390e43aa11d9fa4a3299b4f65ad2fe15 /sway/handlers.c
parent2e755cf13fb653a397a8895121184322dc1dcdd6 (diff)
Focus floating window, if any, when the last tiling has been closed
Diffstat (limited to 'sway/handlers.c')
-rw-r--r--sway/handlers.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/sway/handlers.c b/sway/handlers.c
index 3a4e31ae..b5e0a0e1 100644
--- a/sway/handlers.c
+++ b/sway/handlers.c
@@ -227,7 +227,17 @@ 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){
+ sway_log(L_DEBUG, "we are here first");
+ if(focused_view->floating->length > 0){
+ sway_log(L_DEBUG, "we are here %d", focused_view->floating->length);
+ 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) {