aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sway/handlers.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/sway/handlers.c b/sway/handlers.c
index 8b127d35..75f6a785 100644
--- a/sway/handlers.c
+++ b/sway/handlers.c
@@ -163,6 +163,18 @@ static bool handle_view_created(wlc_handle handle) {
163 } 163 }
164 if (!focused || focused->type == C_OUTPUT) { 164 if (!focused || focused->type == C_OUTPUT) {
165 focused = get_focused_container(&root_container); 165 focused = get_focused_container(&root_container);
166 // Move focus from floating view
167 if (focused->is_floating) {
168 // To workspace if there are no children
169 if (focused->parent->children->length == 0) {
170 focused = focused->parent;
171 }
172 // TODO find a better way of doing this
173 // Or to focused container
174 else {
175 focused = get_focused_container(focused->parent->children->items[0]);
176 }
177 }
166 } 178 }
167 sway_log(L_DEBUG, "handle:%ld type:%x state:%x parent:%ld " 179 sway_log(L_DEBUG, "handle:%ld type:%x state:%x parent:%ld "
168 "mask:%d (x:%d y:%d w:%d h:%d) title:%s " 180 "mask:%d (x:%d y:%d w:%d h:%d) title:%s "