summaryrefslogtreecommitdiff
path: root/sway/commands/focus.c
diff options
context:
space:
mode:
authorDrew DeVault <[email protected]>2018-11-01 01:01:17 +0100
committerGitHub <[email protected]>2018-11-01 01:01:17 +0100
commit35fda6765b154c1824b3e347579b9d41b309212c (patch)
tree3f81a96d7aa72cc4cd8e94c3f656ce27c6b6b34f /sway/commands/focus.c
parentf841d2ed7421805b4b5bac0433fbb4db8d1d0f20 (diff)
parentbf19f63a79f4d844259800c9415599271438cabd (diff)
Merge pull request #3037 from RyanDwyer/focus-output-wrap
Wrap to fartherest output when running focus output
Diffstat (limited to 'sway/commands/focus.c')
-rw-r--r--sway/commands/focus.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sway/commands/focus.c b/sway/commands/focus.c
index 521b2427..cef92144 100644
--- a/sway/commands/focus.c
+++ b/sway/commands/focus.c
@@ -196,6 +196,17 @@ static struct cmd_results *focus_output(struct sway_seat *seat,
}
struct sway_workspace *ws = seat_get_focused_workspace(seat);
output = output_get_in_direction(ws->output, direction);
+
+ if (!output) {
+ int center_lx = ws->output->lx + ws->output->width / 2;
+ int center_ly = ws->output->ly + ws->output->height / 2;
+ struct wlr_output *target = wlr_output_layout_farthest_output(
+ root->output_layout, opposite_direction(direction),
+ ws->output->wlr_output, center_lx, center_ly);
+ if (target) {
+ output = output_from_wlr_output(target);
+ }
+ }
}
free(identifier);