aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/focus.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-07-26 22:58:42 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-07-28 22:41:04 +1000
commitda2a87f6c71bfe90a4d77542bfc7ed22899f67be (patch)
tree76cb0dcdd9006bbec11321645e096ea47cd79e82 /sway/commands/focus.c
parentOperate on floating split container when a child is focused (diff)
downloadsway-da2a87f6c71bfe90a4d77542bfc7ed22899f67be.tar.gz
sway-da2a87f6c71bfe90a4d77542bfc7ed22899f67be.tar.zst
sway-da2a87f6c71bfe90a4d77542bfc7ed22899f67be.zip
When unfloating, return container to previously focused tiled container
This introduces seat_get_focus_inactive_tiling and updates `focus mode_toggle` to use it instead, because the previous method wasn't guaranteed to return a tiling view.
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