diff options
author | Nils Schulte <git@nilsschulte.de> | 2020-07-16 10:23:24 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2020-07-21 10:07:01 +0200 |
commit | 6898d1963f7a7f6dcc0bff5d4c484818f38cdacf (patch) | |
tree | d8fd7ba5347f23e24cfa470727b2b6bd5b693342 /include | |
parent | sway.5: add missing underscore (diff) | |
download | sway-6898d1963f7a7f6dcc0bff5d4c484818f38cdacf.tar.gz sway-6898d1963f7a7f6dcc0bff5d4c484818f38cdacf.tar.zst sway-6898d1963f7a7f6dcc0bff5d4c484818f38cdacf.zip |
moved and renamed movement-unit parsing to common
Diffstat (limited to 'include')
-rw-r--r-- | include/util.h | 24 |
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 @@ | |||
5 | #include <stdbool.h> | 5 | #include <stdbool.h> |
6 | #include <wayland-server-protocol.h> | 6 | #include <wayland-server-protocol.h> |
7 | 7 | ||
8 | enum movement_unit { | ||
9 | MOVEMENT_UNIT_PX, | ||
10 | MOVEMENT_UNIT_PPT, | ||
11 | MOVEMENT_UNIT_DEFAULT, | ||
12 | MOVEMENT_UNIT_INVALID, | ||
13 | }; | ||
14 | |||
15 | struct movement_amount { | ||
16 | int amount; | ||
17 | enum movement_unit unit; | ||
18 | }; | ||
19 | |||
20 | /* | ||
21 | * Parse units such as "px" or "ppt" | ||
22 | */ | ||
23 | enum movement_unit parse_movement_unit(const char *unit); | ||
24 | |||
25 | /* | ||
26 | * Parse arguments such as "10", "10px" or "10 px". | ||
27 | * Returns the number of arguments consumed. | ||
28 | */ | ||
29 | int parse_movement_amount(int argc, char **argv, | ||
30 | struct movement_amount *amount); | ||
31 | |||
8 | /** | 32 | /** |
9 | * Get the current time, in milliseconds. | 33 | * Get the current time, in milliseconds. |
10 | */ | 34 | */ |