diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-07-26 22:58:42 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-07-28 22:41:04 +1000 |
commit | da2a87f6c71bfe90a4d77542bfc7ed22899f67be (patch) | |
tree | 76cb0dcdd9006bbec11321645e096ea47cd79e82 /sway/commands | |
parent | 936168e740067a8658c7097ff76588b070faa71f (diff) |
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')
-rw-r--r-- | sway/commands/focus.c | 14 |
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, struct sway_seat *seat, bool floating) { struct sway_container *ws = con->type == C_WORKSPACE ? con : container_parent(con, C_WORKSPACE); - struct sway_container *new_focus = ws; + struct sway_container *new_focus = NULL; if (floating) { - new_focus = ws->sway_workspace->floating; - if (new_focus->children->length == 0) { - return cmd_results_new(CMD_SUCCESS, NULL, NULL); - } + new_focus = seat_get_focus_inactive(seat, ws->sway_workspace->floating); + } else { + new_focus = seat_get_focus_inactive_tiling(seat, ws); + } + if (!new_focus) { + new_focus = ws; } - seat_set_focus(seat, seat_get_active_child(seat, new_focus)); + seat_set_focus(seat, new_focus); return cmd_results_new(CMD_SUCCESS, NULL, NULL); } |