aboutsummaryrefslogtreecommitdiff
path: root/common/util.c
diff options
context:
space:
mode:
authorFurkan Sahin <furkan-dev@proton.me>2018-11-01 08:29:45 +1000
committerFurkan Sahin <furkan-dev@proton.me>2018-11-01 08:29:45 +1000
commit0b8ebe01b82c53370c4b229a58c361d46838edee (patch)
tree3f81a96d7aa72cc4cd8e94c3f656ce27c6b6b34f /common/util.c
parentf79cf917f9bcc310eb61d353f9e01a7da60715bd (diff)
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 'common/util.c')
-rw-r--r--common/util.c16
1 files changed, 16 insertions, 0 deletions
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 <assert.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
@@ -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;
+}