2021-11-18 18:04:09 +01:00
|
|
|
#include <stdlib.h>
|
2021-11-27 13:28:30 +01:00
|
|
|
#include <fcntl.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/types.h>
|
2021-11-18 18:04:09 +01:00
|
|
|
#include <sys/wait.h>
|
|
|
|
#include <unistd.h>
|
2021-11-21 17:40:02 +01:00
|
|
|
#include <xcb/randr.h>
|
2021-11-18 18:04:09 +01:00
|
|
|
#include <xcb/xcb.h>
|
2021-11-21 17:40:02 +01:00
|
|
|
#include <xcb/xcb_ewmh.h>
|
|
|
|
#include <xcb/xcb_icccm.h>
|
2021-11-18 18:04:09 +01:00
|
|
|
#include <xcb/xcb_keysyms.h>
|
2021-11-23 22:15:36 +01:00
|
|
|
#include <xcb/xcb_atom.h>
|
|
|
|
#include <xcb/xcb_aux.h>
|
|
|
|
#include <xcb/xinerama.h>
|
|
|
|
#include <xcb/xcb_event.h>
|
|
|
|
#include <xcb/xcb_util.h>
|
2021-11-25 17:57:50 +01:00
|
|
|
#include <xcb/xcb_cursor.h>
|
2021-11-28 14:03:34 +01:00
|
|
|
#include <xcb/shape.h>
|
2021-11-18 18:04:09 +01:00
|
|
|
|
2021-11-26 20:20:11 +01:00
|
|
|
#include <cairo/cairo.h>
|
|
|
|
#include <cairo/cairo-xcb.h>
|
|
|
|
#include <glib-2.0/glib.h>
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2021-11-20 09:25:21 +01:00
|
|
|
#include <memory>
|
2021-11-21 17:40:02 +01:00
|
|
|
#include <string>
|
|
|
|
#include <algorithm>
|
2021-11-24 18:37:45 +01:00
|
|
|
#include <map>
|
2021-11-18 18:04:09 +01:00
|
|
|
|
|
|
|
#include "./helpers/Vector.hpp"
|
|
|
|
#include "./utilities/Debug.hpp"
|
|
|
|
|
2021-11-27 13:28:30 +01:00
|
|
|
#ifndef NDEBUG
|
|
|
|
#define ISDEBUG true
|
|
|
|
#else
|
|
|
|
#define ISDEBUG false
|
|
|
|
#endif
|
|
|
|
|
2021-11-18 18:04:09 +01:00
|
|
|
#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);
|
|
|
|
|
2021-11-21 17:40:02 +01:00
|
|
|
#define STICKS(a, b) abs((a) - (b)) < 2
|
|
|
|
|
2021-11-22 22:37:01 +01:00
|
|
|
#define VECINRECT(vec, x1, y1, x2, y2) (vec.x >= (x1) && vec.x <= (x2) && vec.y >= (y1) && vec.y <= (y2))
|
|
|
|
|
|
|
|
#define XCBQUERYCHECK(name, query, errormsg) \
|
2021-11-23 16:24:31 +01:00
|
|
|
xcb_generic_error_t* error##name; \
|
2021-11-22 22:37:01 +01:00
|
|
|
const auto name = query; \
|
|
|
|
\
|
2021-11-23 16:24:31 +01:00
|
|
|
if (error##name != NULL) { \
|
2021-11-22 22:37:01 +01:00
|
|
|
Debug::log(ERR, errormsg); \
|
2021-11-23 16:24:31 +01:00
|
|
|
free(error##name); \
|
2021-11-22 22:37:01 +01:00
|
|
|
free(name); \
|
|
|
|
return; \
|
|
|
|
} \
|
2021-11-23 16:24:31 +01:00
|
|
|
free(error##name);
|
2021-11-23 18:48:03 +01:00
|
|
|
|
|
|
|
|
|
|
|
#define VECTORDELTANONZERO(veca, vecb) ((int)abs(veca.x - vecb.x) > 0 || (int)abs(veca.y - vecb.y) > 0)
|
2021-11-23 22:15:36 +01:00
|
|
|
|
|
|
|
#define PROP(cookie, name, len) const auto cookie = xcb_get_property(DisplayConnection, false, window, name, XCB_GET_PROPERTY_TYPE_ANY, 0, len); \
|
2021-11-24 18:37:45 +01:00
|
|
|
const auto cookie##reply = xcb_get_property_reply(DisplayConnection, cookie, NULL)
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-11-25 16:51:09 +01:00
|
|
|
#define HYPRATOM(name) {name, 0}
|
|
|
|
|
2021-11-26 20:20:11 +01:00
|
|
|
#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)
|