From 7a1c36716aa1248fc6410df8fddb6702dfa99c0f Mon Sep 17 00:00:00 2001 From: Nicklas Warming Jacobsen Date: Tue, 25 Aug 2015 20:15:23 +0200 Subject: [PATCH 1/3] Focus floating window, if any, when the last tiling has been closed --- sway/handlers.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sway/handlers.c b/sway/handlers.c index 3a4e31aef..b5e0a0e10 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) { From a70b9a9a7aa17e54f7e5b91a21635edb01d46092 Mon Sep 17 00:00:00 2001 From: Nicklas Warming Jacobsen Date: Tue, 25 Aug 2015 20:25:38 +0200 Subject: [PATCH 2/3] removed stupid test code --- sway/handlers.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sway/handlers.c b/sway/handlers.c index b5e0a0e10..aca7806bc 100644 --- a/sway/handlers.c +++ b/sway/handlers.c @@ -230,9 +230,7 @@ static void handle_view_destroyed(wlc_handle handle) { 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); } From 227d5dbe08e5be9e0fa116925581a086c8bf60d1 Mon Sep 17 00:00:00 2001 From: Nicklas Warming Jacobsen Date: Tue, 25 Aug 2015 22:00:39 +0200 Subject: [PATCH 3/3] code style clean up --- sway/handlers.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sway/handlers.c b/sway/handlers.c index aca7806bc..b5ffb0603 100644 --- a/sway/handlers.c +++ b/sway/handlers.c @@ -228,13 +228,13 @@ static void handle_view_destroyed(wlc_handle handle) { break; } - 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); - } - } + 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); }