common: move MIN and MAX to common/macros.h

This commit is contained in:
John Lindgren 2023-10-20 20:24:29 -04:00 committed by Johan Malm
parent 5cb1d0e83f
commit 048d22d473
5 changed files with 21 additions and 8 deletions

View file

@ -32,4 +32,22 @@
(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 */

View file

@ -57,14 +57,6 @@
#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,

View 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"

View 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"

View 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"