aboutsummaryrefslogtreecommitdiff
path: root/include/util.h
diff options
context:
space:
mode:
authorFurkan Sahin <furkan-dev@proton.me>2020-07-16 10:23:24 +0200
committerFurkan Sahin <furkan-dev@proton.me>2020-07-16 10:23:24 +0200
commit2eedc2498fcd5c30b465aa562bf9feb00770ab24 (patch)
treed8fd7ba5347f23e24cfa470727b2b6bd5b693342 /include/util.h
parenta2235c014fc5f68b2d59b378c3118793839f611f (diff)
moved and renamed movement-unit parsing to common
Diffstat (limited to 'include/util.h')
-rw-r--r--include/util.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/util.h b/include/util.h
index 7f47d713..c80da1cb 100644
--- a/include/util.h
+++ b/include/util.h
@@ -5,6 +5,30 @@
#include <stdbool.h>
#include <wayland-server-protocol.h>
+enum movement_unit {
+ MOVEMENT_UNIT_PX,
+ MOVEMENT_UNIT_PPT,
+ MOVEMENT_UNIT_DEFAULT,
+ MOVEMENT_UNIT_INVALID,
+};
+
+struct movement_amount {
+ int amount;
+ enum movement_unit unit;
+};
+
+/*
+ * Parse units such as "px" or "ppt"
+ */
+enum movement_unit parse_movement_unit(const char *unit);
+
+/*
+ * Parse arguments such as "10", "10px" or "10 px".
+ * Returns the number of arguments consumed.
+ */
+int parse_movement_amount(int argc, char **argv,
+ struct movement_amount *amount);
+
/**
* Get the current time, in milliseconds.
*/