From bf19f63a79f4d844259800c9415599271438cabd Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Thu, 1 Nov 2018 08:29:45 +1000 Subject: 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. --- common/util.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'common/util.c') diff --git a/common/util.c b/common/util.c index 78d46a2a..f4588b57 100644 --- a/common/util.c +++ b/common/util.c @@ -1,4 +1,5 @@ #define _XOPEN_SOURCE 700 +#include #include #include #include @@ -138,3 +139,18 @@ bool parse_boolean(const char *boolean, bool current) { // All other values are false to match i3 return false; } + +enum wlr_direction opposite_direction(enum wlr_direction d) { + switch (d) { + case WLR_DIRECTION_UP: + return WLR_DIRECTION_DOWN; + case WLR_DIRECTION_DOWN: + return WLR_DIRECTION_UP; + case WLR_DIRECTION_RIGHT: + return WLR_DIRECTION_LEFT; + case WLR_DIRECTION_LEFT: + return WLR_DIRECTION_RIGHT; + } + assert(false); + return 0; +} -- cgit v1.2.3-54-g00ecf