diff options
| author | Fabrice <fabrice@schaub-dev.xyz> | 2026-02-10 08:24:06 +0100 |
|---|---|---|
| committer | Fabrice <fabrice@schaub-dev.xyz> | 2026-02-10 08:24:06 +0100 |
| commit | 5f861f0f0b81f77bd6ebf3d7e666af2fa0fca2b1 (patch) | |
| tree | 6d944c2184f84cc9505b5df9e06cb23bcbb780e5 /src/utils.h | |
| parent | 5b5eb5a16969afc4862fac387940818efc26780a (diff) | |
wl state
Diffstat (limited to 'src/utils.h')
| -rw-r--r-- | src/utils.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/utils.h b/src/utils.h index a89f498..5f9d1cb 100644 --- a/src/utils.h +++ b/src/utils.h @@ -4,10 +4,8 @@ #include <cstdlib> #include <stdint.h> -extern "C" { #include "xdg-shell.h" #include <wayland-client.h> -} typedef uint8_t u8; typedef uint16_t u16; @@ -28,6 +26,8 @@ typedef struct xdg_wm_base *xdg_wm_base_t; typedef struct xdg_surface *xdg_surface_t; typedef struct xdg_toplevel *xdg_toplevel_t; +static inline u32 wayc_min(u32 a, u32 b) { return a > b ? a : b; } + [[noreturn]] static inline void wayc_panic_impl(const char *file, int line, const char *func, const char *fmt, ...) { @@ -40,7 +40,7 @@ typedef struct xdg_toplevel *xdg_toplevel_t; exit(EXIT_FAILURE); } -#define wayc_panic(...) \ +#define wayc_panic(...) \ wayc_panic_impl(__FILE__, __LINE__, __func__, __VA_ARGS__) #define wayc_assert(expr) \ @@ -48,3 +48,5 @@ typedef struct xdg_toplevel *xdg_toplevel_t; if (!(expr)) \ wayc_panic("Assertion failed: %s", #expr); \ } while (0) + +#define wayc_notnull(expr) wayc_assert(expr != NULL) |
