mirror of
https://github.com/hyprwm/Hypr.git
synced 2024-11-08 08:55:58 +01:00
c8c879f103
I have had this crash my WM on boot once in a blue moon. This happens rarely and should NOT happen when the WM is already running. If anyone has a solution, feel free to contribute. If you want to be 100% safe, use bar_enabled=0 in the config.
70 lines
No EOL
2.1 KiB
C++
70 lines
No EOL
2.1 KiB
C++
#include <stdlib.h>
|
|
#include <sys/wait.h>
|
|
#include <unistd.h>
|
|
#include <xcb/randr.h>
|
|
#include <xcb/xcb.h>
|
|
#include <xcb/xcb_ewmh.h>
|
|
#include <xcb/xcb_icccm.h>
|
|
#include <xcb/xcb_keysyms.h>
|
|
#include <xcb/xcb_atom.h>
|
|
#include <xcb/xcb_aux.h>
|
|
#include <xcb/xinerama.h>
|
|
#include <xcb/xcb_event.h>
|
|
#include <xcb/xcb_util.h>
|
|
#include <xcb/xcb_cursor.h>
|
|
|
|
#include <cairo/cairo.h>
|
|
#include <cairo/cairo-xcb.h>
|
|
#include <glib-2.0/glib.h>
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
#include <algorithm>
|
|
#include <map>
|
|
|
|
#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) |