diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-11-01 08:29:45 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-11-01 08:29:45 +1000 |
commit | bf19f63a79f4d844259800c9415599271438cabd (patch) | |
tree | 3f81a96d7aa72cc4cd8e94c3f656ce27c6b6b34f /sway/commands/focus.c | |
parent | Merge pull request #3042 from madblobfish/swaymsg-fish-completions (diff) | |
download | sway-bf19f63a79f4d844259800c9415599271438cabd.tar.gz sway-bf19f63a79f4d844259800c9415599271438cabd.tar.zst sway-bf19f63a79f4d844259800c9415599271438cabd.zip |
Wrap to fartherest output when running focus output
Also moves the `opposite_direction` function into `util.c` as it's used
in two places now.
Diffstat (limited to 'sway/commands/focus.c')
-rw-r--r-- | sway/commands/focus.c | 11 |
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, | |||
196 | } | 196 | } |
197 | struct sway_workspace *ws = seat_get_focused_workspace(seat); | 197 | struct sway_workspace *ws = seat_get_focused_workspace(seat); |
198 | output = output_get_in_direction(ws->output, direction); | 198 | output = output_get_in_direction(ws->output, direction); |
199 | |||
200 | if (!output) { | ||
201 | int center_lx = ws->output->lx + ws->output->width / 2; | ||
202 | int center_ly = ws->output->ly + ws->output->height / 2; | ||
203 | struct wlr_output *target = wlr_output_layout_farthest_output( | ||
204 | root->output_layout, opposite_direction(direction), | ||
205 | ws->output->wlr_output, center_lx, center_ly); | ||
206 | if (target) { | ||
207 | output = output_from_wlr_output(target); | ||
208 | } | ||
209 | } | ||
199 | } | 210 | } |
200 | 211 | ||
201 | free(identifier); | 212 | free(identifier); |