mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 07:26:00 +01:00
internal: cleanup headers in helpers/
This commit is contained in:
parent
6e53c47e68
commit
261c3307f7
19 changed files with 135 additions and 121 deletions
2
.github/workflows/release.yaml
vendored
2
.github/workflows/release.yaml
vendored
|
@ -18,7 +18,7 @@ jobs:
|
||||||
- name: Create tarball with submodules
|
- name: Create tarball with submodules
|
||||||
id: tar
|
id: tar
|
||||||
run: |
|
run: |
|
||||||
sed -i "1s/^/#define GIT_COMMIT_HASH \"$(git rev-parse HEAD)\"\n#define GIT_TAG \"$(git describe --tags)\"\n/" ./src/defines.hpp
|
sed -i "1s/^/#define GIT_COMMIT_HASH \"$(git rev-parse HEAD)\"\n#define GIT_TAG \"$(git describe --tags)\"\n/" ./src/macros.hpp
|
||||||
mkdir hyprland-source; mv ./* ./hyprland-source || tar -czv --owner=0 --group=0 --no-same-owner --no-same-permissions -f source.tar.gz *
|
mkdir hyprland-source; mv ./* ./hyprland-source || tar -czv --owner=0 --group=0 --no-same-owner --no-same-permissions -f source.tar.gz *
|
||||||
|
|
||||||
- id: whatrelease
|
- id: whatrelease
|
||||||
|
|
|
@ -7,7 +7,7 @@ enum eConfigValueDataTypes {
|
||||||
CVD_TYPE_GRADIENT = 0
|
CVD_TYPE_GRADIENT = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
interface ICustomConfigValueData {
|
class ICustomConfigValueData {
|
||||||
public:
|
public:
|
||||||
virtual ~ICustomConfigValueData() = 0;
|
virtual ~ICustomConfigValueData() = 0;
|
||||||
|
|
||||||
|
|
|
@ -1,86 +1,5 @@
|
||||||
#include "includes.hpp"
|
#include "includes.hpp"
|
||||||
#include "debug/Log.hpp"
|
#include "debug/Log.hpp"
|
||||||
#include "helpers/MiscFunctions.hpp"
|
|
||||||
#include "helpers/WLListener.hpp"
|
#include "helpers/WLListener.hpp"
|
||||||
#include "helpers/Color.hpp"
|
#include "helpers/Color.hpp"
|
||||||
|
#include "macros.hpp"
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
#ifndef NDEBUG
|
|
||||||
#ifdef HYPRLAND_DEBUG
|
|
||||||
#define ISDEBUG true
|
|
||||||
#else
|
|
||||||
#define ISDEBUG false
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#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 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 DELTALESSTHAN(a, b, delta) (abs((a) - (b)) < (delta))
|
|
||||||
|
|
||||||
#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 GREEN(c) ((double)(((c) >> 8) & 0xff) / 255.0)
|
|
||||||
#define BLUE(c) ((double)(((c)) & 0xff) / 255.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 */ \
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#define RASSERT(expr, reason, ...)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#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; \
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#define UNREACHABLE() std::unreachable();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// git stuff
|
|
||||||
#ifndef GIT_COMMIT_HASH
|
|
||||||
#define GIT_COMMIT_HASH "?"
|
|
||||||
#endif
|
|
||||||
#ifndef GIT_BRANCH
|
|
||||||
#define GIT_BRANCH "?"
|
|
||||||
#endif
|
|
||||||
#ifndef GIT_COMMIT_MESSAGE
|
|
||||||
#define GIT_COMMIT_MESSAGE "?"
|
|
||||||
#endif
|
|
||||||
#ifndef GIT_DIRTY
|
|
||||||
#define GIT_DIRTY "?"
|
|
||||||
#endif
|
|
||||||
#ifndef GIT_TAG
|
|
||||||
#define GIT_TAG "?"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define SPECIAL_WORKSPACE_START (-99)
|
|
||||||
|
|
||||||
#define PI 3.14159265358979
|
|
||||||
|
|
|
@ -1,18 +1,20 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../defines.hpp"
|
#include <functional>
|
||||||
#include <any>
|
#include <any>
|
||||||
|
#include <chrono>
|
||||||
|
#include "Vector2D.hpp"
|
||||||
|
#include "Color.hpp"
|
||||||
|
#include "../macros.hpp"
|
||||||
|
|
||||||
enum ANIMATEDVARTYPE
|
enum ANIMATEDVARTYPE {
|
||||||
{
|
|
||||||
AVARTYPE_INVALID = -1,
|
AVARTYPE_INVALID = -1,
|
||||||
AVARTYPE_FLOAT,
|
AVARTYPE_FLOAT,
|
||||||
AVARTYPE_VECTOR,
|
AVARTYPE_VECTOR,
|
||||||
AVARTYPE_COLOR
|
AVARTYPE_COLOR
|
||||||
};
|
};
|
||||||
|
|
||||||
enum AVARDAMAGEPOLICY
|
enum AVARDAMAGEPOLICY {
|
||||||
{
|
|
||||||
AVARDAMAGE_NONE = -1,
|
AVARDAMAGE_NONE = -1,
|
||||||
AVARDAMAGE_ENTIRE = 0,
|
AVARDAMAGE_ENTIRE = 0,
|
||||||
AVARDAMAGE_BORDER,
|
AVARDAMAGE_BORDER,
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include "BezierCurve.hpp"
|
#include "BezierCurve.hpp"
|
||||||
|
#include "../debug/Log.hpp"
|
||||||
|
#include "../macros.hpp"
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
void CBezierCurve::setup(std::vector<Vector2D>* pVec) {
|
void CBezierCurve::setup(std::vector<Vector2D>* pVec) {
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../defines.hpp"
|
|
||||||
#include <deque>
|
#include <deque>
|
||||||
|
#include <array>
|
||||||
|
#include <vector>
|
||||||
|
#include "Vector2D.hpp"
|
||||||
|
|
||||||
constexpr int BAKEDPOINTS = 255;
|
constexpr int BAKEDPOINTS = 255;
|
||||||
constexpr float INVBAKEDPOINTS = 1.f / BAKEDPOINTS;
|
constexpr float INVBAKEDPOINTS = 1.f / BAKEDPOINTS;
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
#include "Color.hpp"
|
#include "Color.hpp"
|
||||||
#include "../defines.hpp"
|
|
||||||
|
#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)
|
||||||
|
|
||||||
CColor::CColor() {}
|
CColor::CColor() {}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../includes.hpp"
|
#include <string>
|
||||||
|
#include <wayland-server.h>
|
||||||
|
#include <wlr/util/box.h>
|
||||||
|
#include "Vector2D.hpp"
|
||||||
|
|
||||||
std::string absolutePath(const std::string&, const std::string&);
|
std::string absolutePath(const std::string&, const std::string&);
|
||||||
void addWLSignal(wl_signal*, wl_listener*, void* pOwner, const std::string& ownerString);
|
void addWLSignal(wl_signal*, wl_listener*, void* pOwner, const std::string& ownerString);
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <array>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
inline const std::vector<std::string> SPLASHES = {
|
inline const std::vector<std::string> SPLASHES = {
|
||||||
|
// clang-format off
|
||||||
"Woo, animations!",
|
"Woo, animations!",
|
||||||
"It's like Hypr, but better.",
|
"It's like Hypr, but better.",
|
||||||
"Release 1.0 when?",
|
"Release 1.0 when?",
|
||||||
|
@ -60,4 +61,5 @@ inline const std::vector<std::string> SPLASHES = {
|
||||||
"Thanks ThatOneCalculator!",
|
"Thanks ThatOneCalculator!",
|
||||||
"The AUR packages always work, except for the times they don't.",
|
"The AUR packages always work, except for the times they don't.",
|
||||||
"Funny animation compositor woo"
|
"Funny animation compositor woo"
|
||||||
|
// clang-format on
|
||||||
};
|
};
|
|
@ -26,6 +26,7 @@ struct SSurfaceTreeNode {
|
||||||
void* globalOffsetData;
|
void* globalOffsetData;
|
||||||
CWindow* pWindowOwner = nullptr;
|
CWindow* pWindowOwner = nullptr;
|
||||||
|
|
||||||
|
//
|
||||||
bool operator==(const SSurfaceTreeNode& rhs) const {
|
bool operator==(const SSurfaceTreeNode& rhs) const {
|
||||||
return pSurface == rhs.pSurface;
|
return pSurface == rhs.pSurface;
|
||||||
}
|
}
|
||||||
|
@ -43,6 +44,7 @@ struct SSubsurface {
|
||||||
|
|
||||||
CWindow* pWindowOwner = nullptr;
|
CWindow* pWindowOwner = nullptr;
|
||||||
|
|
||||||
|
//
|
||||||
bool operator==(const SSubsurface& rhs) const {
|
bool operator==(const SSubsurface& rhs) const {
|
||||||
return pSubsurface == rhs.pSubsurface;
|
return pSubsurface == rhs.pSubsurface;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../defines.hpp"
|
#include <chrono>
|
||||||
|
|
||||||
class CTimer {
|
class CTimer {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <math.h>
|
#include <cmath>
|
||||||
|
|
||||||
class Vector2D {
|
class Vector2D {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../includes.hpp"
|
#include <string>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <wayland-server.h>
|
||||||
|
|
||||||
class CHyprWLListener {
|
class CHyprWLListener {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../defines.hpp"
|
#include "../defines.hpp"
|
||||||
|
|
||||||
class CWLSurface {
|
class CWLSurface {
|
||||||
public:
|
public:
|
||||||
CWLSurface() = default;
|
CWLSurface() = default;
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../defines.hpp"
|
|
||||||
#include "AnimatedVariable.hpp"
|
#include "AnimatedVariable.hpp"
|
||||||
|
#include <string>
|
||||||
|
#include "../defines.hpp"
|
||||||
|
#include "../wlrunstable/wlr_ext_workspace_v1.hpp"
|
||||||
|
|
||||||
enum eFullscreenMode : uint8_t
|
enum eFullscreenMode : uint8_t {
|
||||||
{
|
|
||||||
FULLSCREEN_FULL = 0,
|
FULLSCREEN_FULL = 0,
|
||||||
FULLSCREEN_MAXIMIZED
|
FULLSCREEN_MAXIMIZED
|
||||||
};
|
};
|
||||||
|
|
|
@ -23,7 +23,7 @@ enum eRectCorner {
|
||||||
CORNER_BOTTOMLEFT
|
CORNER_BOTTOMLEFT
|
||||||
};
|
};
|
||||||
|
|
||||||
interface IHyprLayout {
|
class IHyprLayout {
|
||||||
public:
|
public:
|
||||||
virtual ~IHyprLayout() = 0;
|
virtual ~IHyprLayout() = 0;
|
||||||
virtual void onEnable() = 0;
|
virtual void onEnable() = 0;
|
||||||
|
|
77
src/macros.hpp
Normal file
77
src/macros.hpp
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "helpers/MiscFunctions.hpp"
|
||||||
|
#include <cmath>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
#ifdef HYPRLAND_DEBUG
|
||||||
|
#define ISDEBUG true
|
||||||
|
#else
|
||||||
|
#define ISDEBUG false
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define ISDEBUG false
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// git stuff
|
||||||
|
#ifndef GIT_COMMIT_HASH
|
||||||
|
#define GIT_COMMIT_HASH "?"
|
||||||
|
#endif
|
||||||
|
#ifndef GIT_BRANCH
|
||||||
|
#define GIT_BRANCH "?"
|
||||||
|
#endif
|
||||||
|
#ifndef GIT_COMMIT_MESSAGE
|
||||||
|
#define GIT_COMMIT_MESSAGE "?"
|
||||||
|
#endif
|
||||||
|
#ifndef GIT_DIRTY
|
||||||
|
#define GIT_DIRTY "?"
|
||||||
|
#endif
|
||||||
|
#ifndef GIT_TAG
|
||||||
|
#define GIT_TAG "?"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define SPECIAL_WORKSPACE_START (-99)
|
||||||
|
|
||||||
|
#define PI 3.14159265358979
|
||||||
|
|
||||||
|
#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 DELTALESSTHAN(a, b, delta) (abs((a) - (b)) < (delta))
|
||||||
|
|
||||||
|
#define STICKS(a, b) abs((a) - (b)) < 2
|
||||||
|
|
||||||
|
#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 */ \
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#define RASSERT(expr, reason, ...)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#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; \
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#define UNREACHABLE() std::unreachable();
|
||||||
|
#endif
|
|
@ -20,14 +20,14 @@ class CWaylandResource {
|
||||||
wl_resource* m_pWLResource = nullptr;
|
wl_resource* m_pWLResource = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
interface IWaylandProtocol {
|
class IWaylandProtocol {
|
||||||
public:
|
public:
|
||||||
IWaylandProtocol(const wl_interface* iface, const int& ver, const std::string& name);
|
IWaylandProtocol(const wl_interface* iface, const int& ver, const std::string& name);
|
||||||
~IWaylandProtocol();
|
~IWaylandProtocol();
|
||||||
|
|
||||||
virtual void onDisplayDestroy();
|
virtual void onDisplayDestroy();
|
||||||
|
|
||||||
virtual void bindManager(wl_client * client, void* data, uint32_t ver, uint32_t id) = 0;
|
virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wl_global* m_pGlobal = nullptr;
|
wl_global* m_pGlobal = nullptr;
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
|
|
||||||
#include "../../defines.hpp"
|
#include "../../defines.hpp"
|
||||||
|
|
||||||
enum eDecorationType
|
enum eDecorationType {
|
||||||
{
|
|
||||||
DECORATION_NONE = -1,
|
DECORATION_NONE = -1,
|
||||||
DECORATION_GROUPBAR,
|
DECORATION_GROUPBAR,
|
||||||
DECORATION_SHADOW,
|
DECORATION_SHADOW,
|
||||||
|
@ -18,7 +17,7 @@ struct SWindowDecorationExtents {
|
||||||
class CWindow;
|
class CWindow;
|
||||||
class CMonitor;
|
class CMonitor;
|
||||||
|
|
||||||
interface IHyprWindowDecoration {
|
class IHyprWindowDecoration {
|
||||||
public:
|
public:
|
||||||
virtual ~IHyprWindowDecoration() = 0;
|
virtual ~IHyprWindowDecoration() = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue