From: Joshua Ashton Date: Sun, 17 Oct 2021 18:37:25 +0000 (+0000) Subject: include: Add min/max helpers X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=a6e1ee0a256616f5257839726b79992cec3f69fe;p=proto%2Flabwc.git include: Add min/max helpers Signed-off-by: Joshua Ashton --- diff --git a/include/labwc.h b/include/labwc.h index 1a575450..68c54692 100644 --- a/include/labwc.h +++ b/include/labwc.h @@ -41,6 +41,16 @@ #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,