summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/util.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/common/util.c b/common/util.c
index 467aa4b5..561b3804 100644
--- a/common/util.c
+++ b/common/util.c
@@ -175,3 +175,24 @@ failed:
175 free(current); 175 free(current);
176 return NULL; 176 return NULL;
177} 177}
178
179bool sway_dir_to_wlr(enum movement_direction dir, enum wlr_direction *out) {
180 switch (dir) {
181 case MOVE_UP:
182 *out = WLR_DIRECTION_UP;
183 break;
184 case MOVE_DOWN:
185 *out = WLR_DIRECTION_DOWN;
186 break;
187 case MOVE_LEFT:
188 *out = WLR_DIRECTION_LEFT;
189 break;
190 case MOVE_RIGHT:
191 *out = WLR_DIRECTION_RIGHT;
192 break;
193 default:
194 return false;
195 }
196
197 return true;
198}