aboutsummaryrefslogtreecommitdiffstats
path: root/common/util.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-11-01 08:29:45 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-11-01 08:29:45 +1000
commitbf19f63a79f4d844259800c9415599271438cabd (patch)
tree3f81a96d7aa72cc4cd8e94c3f656ce27c6b6b34f /common/util.c
parentMerge pull request #3042 from madblobfish/swaymsg-fish-completions (diff)
downloadsway-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 '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 @@
1#define _XOPEN_SOURCE 700 1#define _XOPEN_SOURCE 700
2#include <assert.h>
2#include <sys/types.h> 3#include <sys/types.h>
3#include <sys/stat.h> 4#include <sys/stat.h>
4#include <unistd.h> 5#include <unistd.h>
@@ -138,3 +139,18 @@ bool parse_boolean(const char *boolean, bool current) {
138 // All other values are false to match i3 139 // All other values are false to match i3
139 return false; 140 return false;
140} 141}
142
143enum wlr_direction opposite_direction(enum wlr_direction d) {
144 switch (d) {
145 case WLR_DIRECTION_UP:
146 return WLR_DIRECTION_DOWN;
147 case WLR_DIRECTION_DOWN:
148 return WLR_DIRECTION_UP;
149 case WLR_DIRECTION_RIGHT:
150 return WLR_DIRECTION_LEFT;
151 case WLR_DIRECTION_LEFT:
152 return WLR_DIRECTION_RIGHT;
153 }
154 assert(false);
155 return 0;
156}