aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNils Schulte <git@nilsschulte.de>2020-07-16 10:23:24 +0200
committerSimon Ser <contact@emersion.fr>2020-07-21 10:07:01 +0200
commit6898d1963f7a7f6dcc0bff5d4c484818f38cdacf (patch)
treed8fd7ba5347f23e24cfa470727b2b6bd5b693342 /include
parent36c3c222d2418b30fea02c28ea21652ec90238c4 (diff)
downloadsway-6898d1963f7a7f6dcc0bff5d4c484818f38cdacf.tar.xz
moved and renamed movement-unit parsing to common
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.
*/