diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2022-12-16 17:17:31 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-16 17:17:31 +0000 |
| commit | 98a4fa2b0d79298fa29b048a3ba15c3bf5aed8cd (patch) | |
| tree | 64e78342cf08e5f9ad87bd5f6ea36233133be7bb /src/defines.hpp | |
| parent | 7c33c7fc64203c17b4f3625a16ae6b4774992c0e (diff) | |
Added clang format (#1239)
* clang-format stuff and format files
Diffstat (limited to 'src/defines.hpp')
| -rw-r--r-- | src/defines.hpp | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/src/defines.hpp b/src/defines.hpp index 6e6278bc..cad434fd 100644 --- a/src/defines.hpp +++ b/src/defines.hpp @@ -18,39 +18,44 @@ #define ISDEBUG false #endif -#define LISTENER(name) void listener_##name(wl_listener*, void*); inline wl_listener listen_##name = { .notify = listener_##name } -#define DYNLISTENFUNC(name) void listener_##name(void*, void*) -#define DYNLISTENER(name) CHyprWLListener hyprListener_##name +#define LISTENER(name) \ + void listener_##name(wl_listener*, void*); \ + inline wl_listener listen_##name = {.notify = listener_##name} +#define DYNLISTENFUNC(name) void listener_##name(void*, void*) +#define DYNLISTENER(name) CHyprWLListener hyprListener_##name #define DYNMULTILISTENER(name) wl_listener listen_##name -#define VECINRECT(vec, x1, y1, x2, y2) (vec.x >= (x1) && vec.x <= (x2) && vec.y >= (y1) && vec.y <= (y2)) +#define VECINRECT(vec, x1, y1, x2, y2) ((vec).x >= (x1) && (vec).x <= (x2) && (vec).y >= (y1) && (vec).y <= (y2)) -#define DELTALESSTHAN(a, b, delta) (abs((a) - (b)) < delta) +#define DELTALESSTHAN(a, b, delta) (abs((a) - (b)) < (delta)) -#define PIXMAN_DAMAGE_FOREACH(region) int rectsNum = 0; \ - const auto RECTSARR = pixman_region32_rectangles(region, &rectsNum); \ +#define PIXMAN_DAMAGE_FOREACH(region) \ + int rectsNum = 0; \ + const auto RECTSARR = pixman_region32_rectangles(region, &rectsNum); \ for (int i = 0; i < rectsNum; ++i) #define PIXMAN_REGION_FOREACH(region) PIXMAN_DAMAGE_FOREACH(region) - #define interface class #define STICKS(a, b) abs((a) - (b)) < 2 #define ALPHA(c) ((double)(((c) >> 24) & 0xff) / 255.0) -#define RED(c) ((double)(((c) >> 16) & 0xff) / 255.0) +#define RED(c) ((double)(((c) >> 16) & 0xff) / 255.0) #define GREEN(c) ((double)(((c) >> 8) & 0xff) / 255.0) -#define BLUE(c) ((double)(((c)) & 0xff) / 255.0) +#define BLUE(c) ((double)(((c)) & 0xff) / 255.0) -#define HYPRATOM(name) {name, 0} +#define HYPRATOM(name) \ + { name, 0 } #ifndef __INTELLISENSE__ -#define RASSERT(expr, reason, ...) \ - if (!(expr)) { \ - Debug::log(CRIT, "\n==========================================================================================\nASSERTION FAILED! \n\n%s\n\nat: line %d in %s", getFormat(reason, ##__VA_ARGS__).c_str(), __LINE__, ([]() constexpr->std::string { return std::string(__FILE__).substr(std::string(__FILE__).find_last_of('/') + 1); })().c_str()); \ - printf("Assertion failed! See the log in /tmp/hypr/hyprland.log for more info."); \ - *((int*)nullptr) = 1; /* so that we crash and get a coredump */ \ +#define RASSERT(expr, reason, ...) \ + if (!(expr)) { \ + Debug::log(CRIT, "\n==========================================================================================\nASSERTION FAILED! \n\n%s\n\nat: line %d in %s", \ + getFormat(reason, ##__VA_ARGS__).c_str(), __LINE__, \ + ([]() constexpr->std::string { return std::string(__FILE__).substr(std::string(__FILE__).find_last_of('/') + 1); })().c_str()); \ + printf("Assertion failed! See the log in /tmp/hypr/hyprland.log for more info."); \ + *((int*)nullptr) = 1; /* so that we crash and get a coredump */ \ } #else #define RASSERT(expr, reason, ...) @@ -59,7 +64,11 @@ #define ASSERT(expr) RASSERT(expr, "?") #if ISDEBUG -#define UNREACHABLE() { Debug::log(CRIT, "\n\nMEMORY CORRUPTED: Unreachable failed! (Reached an unreachable position, memory corruption!!!)"); *((int*)nullptr) = 1; } +#define UNREACHABLE() \ + { \ + Debug::log(CRIT, "\n\nMEMORY CORRUPTED: Unreachable failed! (Reached an unreachable position, memory corruption!!!)"); \ + *((int*)nullptr) = 1; \ + } #else #define UNREACHABLE() std::unreachable(); #endif @@ -78,6 +87,6 @@ #define GIT_DIRTY "?" #endif -#define SPECIAL_WORKSPACE_START -99 +#define SPECIAL_WORKSPACE_START (-99) #define PI 3.14159265358979 |
