mirror of
https://github.com/labwc/labwc.git
synced 2025-11-02 09:01:47 -05:00
include/labwc.h: Provide MIN/MAX macros
This commit is contained in:
parent
9d7386effd
commit
7b48da4ab2
4 changed files with 8 additions and 6 deletions
|
|
@ -61,6 +61,14 @@
|
||||||
#define XCURSOR_DEFAULT "left_ptr"
|
#define XCURSOR_DEFAULT "left_ptr"
|
||||||
#define XCURSOR_SIZE 24
|
#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 {
|
enum input_mode {
|
||||||
LAB_INPUT_STATE_PASSTHROUGH = 0,
|
LAB_INPUT_STATE_PASSTHROUGH = 0,
|
||||||
LAB_INPUT_STATE_MOVE,
|
LAB_INPUT_STATE_MOVE,
|
||||||
|
|
|
||||||
|
|
@ -123,10 +123,8 @@ get_scale_box(struct wlr_buffer *buffer, double container_width,
|
||||||
|
|
||||||
/* Scale down buffer if required */
|
/* Scale down buffer if required */
|
||||||
if (icon_geo.width && icon_geo.height) {
|
if (icon_geo.width && icon_geo.height) {
|
||||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
|
||||||
double scale = MIN(container_width / icon_geo.width,
|
double scale = MIN(container_width / icon_geo.width,
|
||||||
container_height / icon_geo.height);
|
container_height / icon_geo.height);
|
||||||
#undef MIN
|
|
||||||
if (scale < 1.0f) {
|
if (scale < 1.0f) {
|
||||||
icon_geo.width = (double)icon_geo.width * scale;
|
icon_geo.width = (double)icon_geo.width * scale;
|
||||||
icon_geo.height = (double)icon_geo.height * scale;
|
icon_geo.height = (double)icon_geo.height * scale;
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,6 @@
|
||||||
#define LAB_FALLBACK_WIDTH 640
|
#define LAB_FALLBACK_WIDTH 640
|
||||||
#define LAB_FALLBACK_HEIGHT 480
|
#define LAB_FALLBACK_HEIGHT 480
|
||||||
|
|
||||||
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All view_apply_xxx_geometry() functions must *not* modify
|
* All view_apply_xxx_geometry() functions must *not* modify
|
||||||
* any state besides repositioning or resizing the view.
|
* any state besides repositioning or resizing the view.
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,6 @@
|
||||||
#include "view.h"
|
#include "view.h"
|
||||||
#include "workspaces.h"
|
#include "workspaces.h"
|
||||||
|
|
||||||
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
round_to_increment(int val, int base, int inc)
|
round_to_increment(int val, int base, int inc)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue