]> git.mdlowis.com Git - proto/labwc.git/commitdiff
include: Add min/max helpers
authorJoshua Ashton <joshua@froggi.es>
Sun, 17 Oct 2021 18:37:25 +0000 (18:37 +0000)
committerJohan Malm <johanmalm@users.noreply.github.com>
Sun, 17 Oct 2021 18:49:05 +0000 (19:49 +0100)
Signed-off-by: Joshua Ashton <joshua@froggi.es>
include/labwc.h

index 1a575450167ce891d76cbd4cca1fcdd7448355cc..68c5469296b8f99e93c5db8b0e5d2c0110be1373 100644 (file)
 #define XCURSOR_SIZE 24
 #define XCURSOR_MOVE "grabbing"
 
+#define max(a,b) \
+       ({ __typeof__ (a) _a = (a); \
+               __typeof__ (b) _b = (b); \
+               _a > _b ? _a : _b; })
+
+#define min(a,b) \
+       ({ __typeof__ (a) _a = (a); \
+               __typeof__ (b) _b = (b); \
+               _a < _b ? _a : _b; })
+
 enum input_mode {
        LAB_INPUT_STATE_PASSTHROUGH = 0,
        LAB_INPUT_STATE_MOVE,