aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/focus.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands/focus.c')
-rw-r--r--sway/commands/focus.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/sway/commands/focus.c b/sway/commands/focus.c
index 9cd8bfae..ce3d032f 100644
--- a/sway/commands/focus.c
+++ b/sway/commands/focus.c
@@ -35,14 +35,16 @@ static struct cmd_results *focus_mode(struct sway_container *con,
35 struct sway_seat *seat, bool floating) { 35 struct sway_seat *seat, bool floating) {
36 struct sway_container *ws = con->type == C_WORKSPACE ? 36 struct sway_container *ws = con->type == C_WORKSPACE ?
37 con : container_parent(con, C_WORKSPACE); 37 con : container_parent(con, C_WORKSPACE);
38 struct sway_container *new_focus = ws; 38 struct sway_container *new_focus = NULL;
39 if (floating) { 39 if (floating) {
40 new_focus = ws->sway_workspace->floating; 40 new_focus = seat_get_focus_inactive(seat, ws->sway_workspace->floating);
41 if (new_focus->children->length == 0) { 41 } else {
42 return cmd_results_new(CMD_SUCCESS, NULL, NULL); 42 new_focus = seat_get_focus_inactive_tiling(seat, ws);
43 } 43 }
44 if (!new_focus) {
45 new_focus = ws;
44 } 46 }
45 seat_set_focus(seat, seat_get_active_child(seat, new_focus)); 47 seat_set_focus(seat, new_focus);
46 return cmd_results_new(CMD_SUCCESS, NULL, NULL); 48 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
47} 49}
48 50