aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-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.
*/