include/labwc.h: Provide MIN/MAX macros

This commit is contained in:
Consolatis 2023-01-06 15:06:57 +01:00
parent 9d7386effd
commit 7b48da4ab2
4 changed files with 8 additions and 6 deletions

View file

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

@ -123,10 +123,8 @@ get_scale_box(struct wlr_buffer *buffer, double container_width,
/* Scale down buffer if required */
if (icon_geo.width && icon_geo.height) {
#define MIN(a, b) ((a) < (b) ? (a) : (b))
double scale = MIN(container_width / icon_geo.width,
container_height / icon_geo.height);
#undef MIN
if (scale < 1.0f) {
icon_geo.width = (double)icon_geo.width * scale;
icon_geo.height = (double)icon_geo.height * scale;

View file

@ -14,8 +14,6 @@
#define LAB_FALLBACK_WIDTH 640
#define LAB_FALLBACK_HEIGHT 480
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
/**
* All view_apply_xxx_geometry() functions must *not* modify
* any state besides repositioning or resizing the view.

View file

@ -7,8 +7,6 @@
#include "view.h"
#include "workspaces.h"
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
static int
round_to_increment(int val, int base, int inc)
{