#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "./helpers/Vector.hpp" #include "./utilities/Debug.hpp" #define EXPOSED_MEMBER(var, type, prefix) \ private: \ type m_##prefix##var; \ public: \ type get##var() { return this->m_##prefix##var; } \ void set##var(type value) { this->m_##prefix##var = value; } #define EVENT(name) \ void event##name(xcb_generic_event_t* event); #define STICKS(a, b) abs((a) - (b)) < 2 #define VECINRECT(vec, x1, y1, x2, y2) (vec.x >= (x1) && vec.x <= (x2) && vec.y >= (y1) && vec.y <= (y2)) #define XCBQUERYCHECK(name, query, errormsg) \ xcb_generic_error_t* error##name; \ const auto name = query; \ \ if (error##name != NULL) { \ Debug::log(ERR, errormsg); \ free(error##name); \ free(name); \ return; \ } \ free(error##name); #define VECTORDELTANONZERO(veca, vecb) ((int)abs(veca.x - vecb.x) > 0 || (int)abs(veca.y - vecb.y) > 0) #define PROP(cookie, name, len) const auto cookie = xcb_get_property(DisplayConnection, false, window, name, XCB_GET_PROPERTY_TYPE_ANY, 0, len); \ const auto cookie##reply = xcb_get_property_reply(DisplayConnection, cookie, NULL) #define HYPRATOM(name) {name, 0} #define ALPHA(c) ((double)(((c) >> 24) & 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)