]> git.mdlowis.com Git - proto/labwc.git/commitdiff
common: move MIN and MAX to common/macros.h
authorJohn Lindgren <john@jlindgren.net>
Sat, 21 Oct 2023 00:24:29 +0000 (20:24 -0400)
committerJohan Malm <johanmalm@users.noreply.github.com>
Sat, 21 Oct 2023 11:37:42 +0000 (12:37 +0100)
include/common/macros.h
include/labwc.h
src/config/rcxml.c
src/ssd/resize_indicator.c
src/view.c

index dc0eb65dce12e3cf8381138ceb05b6fea0bdb477..17ada31ee92b7bdcca3e1d12ab0ffed32a4503a0 100644 (file)
        (dest)->name.notify = handle_##name; \
        wl_signal_add(&(src)->events.name, &(dest)->name)
 
+/**
+ * MIN() - Minimum of two values.
+ *
+ * @note Arguments may be evaluated twice.
+ */
+#ifndef MIN
+#define MIN(a, b) (((a) < (b)) ? (a) : (b))
+#endif
+
+/**
+ * MAX() - Maximum of two values.
+ *
+ * @note Arguments may be evaluated twice.
+ */
+#ifndef MAX
+#define MAX(a, b) (((a) > (b)) ? (a) : (b))
+#endif
+
 #endif /* LABWC_MACROS_H */
index e128a5c0023fe4ed04d85542c2d075b0981553fd..bae2dfb9e4bec560bc74c2e0d8e0f8b7910aff69 100644 (file)
 #define XCURSOR_DEFAULT "left_ptr"
 #define XCURSOR_SIZE 24
 
-#ifndef MIN
-#define MIN(a, b) (((a) < (b)) ? (a) : (b))
-#endif
-
-#ifndef MAX
-#define MAX(a, b) (((a) > (b)) ? (a) : (b))
-#endif
-
 enum input_mode {
        LAB_INPUT_STATE_PASSTHROUGH = 0,
        LAB_INPUT_STATE_MOVE,
index 79ea79d8241ec15ffaf0f981c93ed413dc7befee..0f8547ba05cd9d60c08d5f724c2c4994b099a9dc 100644 (file)
@@ -17,6 +17,7 @@
 #include <wlr/util/log.h>
 #include "action.h"
 #include "common/list.h"
+#include "common/macros.h"
 #include "common/mem.h"
 #include "common/nodename.h"
 #include "common/parse-bool.h"
index d972d470c3df33a47463f2747ad8caa59a1d1354..5360f1c0debfcd75195a6f0cb7e729a21814d68f 100644 (file)
@@ -3,6 +3,7 @@
 #include <wlr/types/wlr_scene.h>
 #include <wlr/util/box.h>
 #include <wlr/util/log.h>
+#include "common/macros.h"
 #include "common/scaled_font_buffer.h"
 #include "labwc.h"
 #include "resize_indicator.h"
index e85934bf38932d3624468771c04e1a8444de7c77..e85ffab17783aaa70a1dfd1f51f0a0bbe036178a 100644 (file)
@@ -2,6 +2,7 @@
 #include <assert.h>
 #include <stdio.h>
 #include <strings.h>
+#include "common/macros.h"
 #include "common/match.h"
 #include "common/mem.h"
 #include "common/scene-helpers.h"