aboutsummaryrefslogtreecommitdiff
path: root/sway/commands/focus.c
diff options
context:
space:
mode:
authorRyan Dwyer <ryandwyer1@gmail.com>2018-08-17 17:32:53 +1000
committerRyan Dwyer <ryandwyer1@gmail.com>2018-08-17 17:32:53 +1000
commit3a888163a03e8fb6fbe91bfe8e2fe4f3d2f03cec (patch)
tree56dff4af22bf816ab5ec024f694d41ef3275d48e /sway/commands/focus.c
parent32193c7e4def7c0ba9cf8a7fcff02b1840d2b279 (diff)
Refactor seat_get_focus functions
Fixes #2467. This commit introduces seat_get_focus_inactive_floating to supplement seat_get_focus_inactive_tiling, and uses it during `focus mode_toggle` which fixes a focus bug. This also refactors the seat_get_focus_inactive functions so that they do their selection logic themselves rather than offloading it to seat_get_focus_by_type which was getting bloated. seat_get_focus_by_type is now removed. Lastly, this commit changes seat_get_focus to just return the first container in the focus stack rather than looping and calling seat_get_focus_by_type.
Diffstat (limited to 'sway/commands/focus.c')
-rw-r--r--sway/commands/focus.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sway/commands/focus.c b/sway/commands/focus.c
index 76d3f1dc..135a2908 100644
--- a/sway/commands/focus.c
+++ b/sway/commands/focus.c
@@ -46,14 +46,13 @@ static struct cmd_results *focus_mode(struct sway_container *con,
struct sway_container *new_focus = NULL;
if (floating) {
- new_focus = seat_get_focus_inactive(seat, ws->sway_workspace->floating);
+ new_focus = seat_get_focus_inactive_floating(seat, ws);
} else {
new_focus = seat_get_focus_inactive_tiling(seat, ws);
}
- if (!new_focus) {
- new_focus = ws;
+ if (new_focus) {
+ seat_set_focus(seat, new_focus);
}
- seat_set_focus(seat, new_focus);
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
}