style/ci: apply clang-format and verify it in ci (#4039)

* style: apply clang-format

* ci: add new clang-format job to CI
This commit is contained in:
François Conzelmann 2023-12-06 23:54:56 +01:00 committed by GitHub
parent 5489f9f07a
commit 4a42344e97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 131 additions and 143 deletions

1
.clang-format-ignore Normal file
View File

@ -0,0 +1 @@
subprojects/**/*

View File

@ -106,3 +106,32 @@ jobs:
run: mkdir -p build && cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DNO_XWAYLAND:STRING=true -H./ -B./build -G Ninja run: mkdir -p build && cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DNO_XWAYLAND:STRING=true -H./ -B./build -G Ninja
- name: Compile - name: Compile
run: make release run: make release
clang-format:
name: "Code Style (Arch)"
runs-on: ubuntu-latest
container:
image: archlinux
steps:
- name: Download dependencies
run: |
sed -i 's/SigLevel = Required DatabaseOptional/SigLevel = Optional TrustAll/' /etc/pacman.conf
pacman --noconfirm --noprogressbar -Syyu
pacman --noconfirm --noprogressbar -Sy glslang libepoxy libfontenc libxcvt libxfont2 libxkbfile vulkan-headers vulkan-validation-layers git go clang lld libc++ pkgconf meson ninja wayland wayland-protocols libinput libxkbcommon pixman glm libdrm libglvnd cairo pango systemd scdoc base-devel seatd cmake jq python libliftoff tomlplusplus
- name: Set up user
run: |
useradd -m githubuser
echo -e "root ALL=(ALL:ALL) ALL\ngithubuser ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers
- name: Install libdisplay-info from the AUR
run: |
su githubuser -c "cd ~ && git clone https://aur.archlinux.org/libdisplay-info.git && cd ./libdisplay-info && makepkg -si --skippgpcheck --noconfirm --noprogressbar"
- name: Checkout Hyprland
uses: actions/checkout@v3
with:
submodules: true
- name: Configure
run: |
meson obj-x86_64-pc-linux-gnu \
-Ddefault_library=static
- name: clang-format check
run: ninja -C obj-x86_64-pc-linux-gnu clang-format-check

View File

@ -29,8 +29,7 @@
#include "plugins/PluginSystem.hpp" #include "plugins/PluginSystem.hpp"
#include "helpers/Watchdog.hpp" #include "helpers/Watchdog.hpp"
enum eManagersInitStage enum eManagersInitStage {
{
STAGE_PRIORITY = 0, STAGE_PRIORITY = 0,
STAGE_LATE STAGE_LATE
}; };

View File

@ -2,8 +2,7 @@
#include "helpers/Vector2D.hpp" #include "helpers/Vector2D.hpp"
enum eIcons enum eIcons {
{
ICON_WARNING = 0, ICON_WARNING = 0,
ICON_INFO, ICON_INFO,
ICON_HINT, ICON_HINT,
@ -13,8 +12,7 @@ enum eIcons
ICON_NONE ICON_NONE
}; };
enum eRenderStage enum eRenderStage {
{
RENDER_PRE = 0, /* Before binding the gl context */ RENDER_PRE = 0, /* Before binding the gl context */
RENDER_BEGIN, /* Just when the rendering begins, nothing has been rendered yet. Damage, current render data in opengl valid. */ RENDER_BEGIN, /* Just when the rendering begins, nothing has been rendered yet. Damage, current render data in opengl valid. */
RENDER_PRE_WINDOWS, /* Pre windows, post bottom and overlay layers */ RENDER_PRE_WINDOWS, /* Pre windows, post bottom and overlay layers */

View File

@ -11,16 +11,14 @@
#include "macros.hpp" #include "macros.hpp"
#include "managers/XWaylandManager.hpp" #include "managers/XWaylandManager.hpp"
enum eIdleInhibitMode enum eIdleInhibitMode {
{
IDLEINHIBIT_NONE = 0, IDLEINHIBIT_NONE = 0,
IDLEINHIBIT_ALWAYS, IDLEINHIBIT_ALWAYS,
IDLEINHIBIT_FULLSCREEN, IDLEINHIBIT_FULLSCREEN,
IDLEINHIBIT_FOCUS IDLEINHIBIT_FOCUS
}; };
enum eGroupRules enum eGroupRules {
{
// effective only during first map, except for _ALWAYS variant // effective only during first map, except for _ALWAYS variant
GROUP_NONE = 0, GROUP_NONE = 0,
GROUP_SET = 1 << 0, // Open as new group or add to focused group GROUP_SET = 1 << 0, // Open as new group or add to focused group

View File

@ -13,19 +13,19 @@
std::string getRandomMessage() { std::string getRandomMessage() {
const std::vector<std::string> MESSAGES = {"Sorry, didn't mean to...", const std::vector<std::string> MESSAGES = {"Sorry, didn't mean to...",
"This was an accident, I swear!", "This was an accident, I swear!",
"Calm down, it was a misinput! MISINPUT!", "Calm down, it was a misinput! MISINPUT!",
"Oops", "Oops",
"Vaxry is going to be upset.", "Vaxry is going to be upset.",
"Who tried dividing by zero?!", "Who tried dividing by zero?!",
"Maybe you should try dusting your PC in the meantime?", "Maybe you should try dusting your PC in the meantime?",
"I tried so hard, and got so far...", "I tried so hard, and got so far...",
"I don't feel so good...", "I don't feel so good...",
"*thud*", "*thud*",
"Well this is awkward.", "Well this is awkward.",
"\"stable\"", "\"stable\"",
"I hope you didn't have any unsaved progress.", "I hope you didn't have any unsaved progress.",
"All these computers..."}; "All these computers..."};
std::random_device dev; std::random_device dev;
std::mt19937 engine(dev()); std::mt19937 engine(dev());

View File

@ -75,10 +75,9 @@ std::string monitorsRequest(std::string request, HyprCtl::eHyprCtlOutputFormat f
"vrr": {}, "vrr": {},
"activelyTearing": {} "activelyTearing": {}
}},)#", }},)#",
m->ID, escapeJSONStrings(m->szName), escapeJSONStrings(m->szDescription), (m->output->make ? m->output->make : ""), m->ID, escapeJSONStrings(m->szName), escapeJSONStrings(m->szDescription), (m->output->make ? m->output->make : ""), (m->output->model ? m->output->model : ""),
(m->output->model ? m->output->model : ""), (m->output->serial ? m->output->serial : ""), (int)m->vecPixelSize.x, (int)m->vecPixelSize.y, m->refreshRate, (m->output->serial ? m->output->serial : ""), (int)m->vecPixelSize.x, (int)m->vecPixelSize.y, m->refreshRate, (int)m->vecPosition.x, (int)m->vecPosition.y,
(int)m->vecPosition.x, (int)m->vecPosition.y, m->activeWorkspace, m->activeWorkspace, (m->activeWorkspace == -1 ? "" : escapeJSONStrings(g_pCompositor->getWorkspaceByID(m->activeWorkspace)->m_szName)), m->specialWorkspaceID,
(m->activeWorkspace == -1 ? "" : escapeJSONStrings(g_pCompositor->getWorkspaceByID(m->activeWorkspace)->m_szName)), m->specialWorkspaceID,
escapeJSONStrings(getWorkspaceNameFromSpecialID(m->specialWorkspaceID)), (int)m->vecReservedTopLeft.x, (int)m->vecReservedTopLeft.y, escapeJSONStrings(getWorkspaceNameFromSpecialID(m->specialWorkspaceID)), (int)m->vecReservedTopLeft.x, (int)m->vecReservedTopLeft.y,
(int)m->vecReservedBottomRight.x, (int)m->vecReservedBottomRight.y, m->scale, (int)m->transform, (m.get() == g_pCompositor->m_pLastMonitor ? "true" : "false"), (int)m->vecReservedBottomRight.x, (int)m->vecReservedBottomRight.y, m->scale, (int)m->transform, (m.get() == g_pCompositor->m_pLastMonitor ? "true" : "false"),
(m->dpmsStatus ? "true" : "false"), (m->output->adaptive_sync_status == WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED ? "true" : "false"), (m->dpmsStatus ? "true" : "false"), (m->output->adaptive_sync_status == WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED ? "true" : "false"),
@ -93,17 +92,17 @@ std::string monitorsRequest(std::string request, HyprCtl::eHyprCtlOutputFormat f
if (!m->output || m->ID == -1ull) if (!m->output || m->ID == -1ull)
continue; continue;
result += std::format( result +=
"Monitor {} (ID {}):\n\t{}x{}@{:.5f} at {}x{}\n\tdescription: {}\n\tmake: {}\n\tmodel: {}\n\tserial: {}\n\tactive workspace: {} ({})\n\tspecial " std::format("Monitor {} (ID {}):\n\t{}x{}@{:.5f} at {}x{}\n\tdescription: {}\n\tmake: {}\n\tmodel: {}\n\tserial: {}\n\tactive workspace: {} ({})\n\tspecial "
"workspace: {} ({})\n\treserved: {} " "workspace: {} ({})\n\treserved: {} "
"{} {} {}\n\tscale: {:.2f}\n\ttransform: " "{} {} {}\n\tscale: {:.2f}\n\ttransform: "
"{}\n\tfocused: {}\n\tdpmsStatus: {}\n\tvrr: {}\n\tactivelyTearing: {}\n\n", "{}\n\tfocused: {}\n\tdpmsStatus: {}\n\tvrr: {}\n\tactivelyTearing: {}\n\n",
m->szName, m->ID, (int)m->vecPixelSize.x, (int)m->vecPixelSize.y, m->refreshRate, (int)m->vecPosition.x, (int)m->vecPosition.y, m->szName, m->ID, (int)m->vecPixelSize.x, (int)m->vecPixelSize.y, m->refreshRate, (int)m->vecPosition.x, (int)m->vecPosition.y, m->szDescription,
m->szDescription, (m->output->make ? m->output->make : ""), (m->output->model ? m->output->model : ""), (m->output->make ? m->output->make : ""), (m->output->model ? m->output->model : ""), (m->output->serial ? m->output->serial : ""), m->activeWorkspace,
(m->output->serial ? m->output->serial : ""), m->activeWorkspace, (m->activeWorkspace == -1 ? "" : g_pCompositor->getWorkspaceByID(m->activeWorkspace)->m_szName), (m->activeWorkspace == -1 ? "" : g_pCompositor->getWorkspaceByID(m->activeWorkspace)->m_szName), m->specialWorkspaceID,
m->specialWorkspaceID, getWorkspaceNameFromSpecialID(m->specialWorkspaceID), (int)m->vecReservedTopLeft.x, (int)m->vecReservedTopLeft.y, getWorkspaceNameFromSpecialID(m->specialWorkspaceID), (int)m->vecReservedTopLeft.x, (int)m->vecReservedTopLeft.y, (int)m->vecReservedBottomRight.x,
(int)m->vecReservedBottomRight.x, (int)m->vecReservedBottomRight.y, m->scale, (int)m->transform, (m.get() == g_pCompositor->m_pLastMonitor ? "yes" : "no"), (int)m->vecReservedBottomRight.y, m->scale, (int)m->transform, (m.get() == g_pCompositor->m_pLastMonitor ? "yes" : "no"), (int)m->dpmsStatus,
(int)m->dpmsStatus, (int)(m->output->adaptive_sync_status == WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED), m->tearingState.activelyTearing); (int)(m->output->adaptive_sync_status == WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED), m->tearingState.activelyTearing);
} }
} }

View File

@ -19,8 +19,7 @@ namespace HyprCtl {
inline int iSocketFD = -1; inline int iSocketFD = -1;
enum eHyprCtlOutputFormat enum eHyprCtlOutputFormat {
{
FORMAT_NORMAL = 0, FORMAT_NORMAL = 0,
FORMAT_JSON FORMAT_JSON
}; };

View File

@ -10,16 +10,15 @@
#include <cairo/cairo.h> #include <cairo/cairo.h>
enum eIconBackend enum eIconBackend {
{
ICONS_BACKEND_NONE = 0, ICONS_BACKEND_NONE = 0,
ICONS_BACKEND_NF, ICONS_BACKEND_NF,
ICONS_BACKEND_FA ICONS_BACKEND_FA
}; };
static const std::array<std::array<std::string, ICON_NONE + 1>, 3 /* backends */> ICONS_ARRAY = { static const std::array<std::array<std::string, ICON_NONE + 1>, 3 /* backends */> ICONS_ARRAY = {
std::array<std::string, ICON_NONE + 1>{"[!]", "[i]", "[Hint]", "[Err]", "[?]", "[ok]", ""}, std::array<std::string, ICON_NONE + 1>{"", "", "", "", "", "󰸞", ""}, std::array<std::string, ICON_NONE + 1>{"[!]", "[i]", "[Hint]", "[Err]", "[?]", "[ok]", ""},
std::array<std::string, ICON_NONE + 1>{"", "", "", "", "", ""}}; std::array<std::string, ICON_NONE + 1>{"", "", "", "", "", "󰸞", ""}, std::array<std::string, ICON_NONE + 1>{"", "", "", "", "", ""}};
static const std::array<CColor, ICON_NONE + 1> ICONS_COLORS = {CColor{255.0 / 255.0, 204 / 255.0, 102 / 255.0, 1.0}, static const std::array<CColor, ICON_NONE + 1> ICONS_COLORS = {CColor{255.0 / 255.0, 204 / 255.0, 102 / 255.0, 1.0},
CColor{128 / 255.0, 255 / 255.0, 255 / 255.0, 1.0}, CColor{128 / 255.0, 255 / 255.0, 255 / 255.0, 1.0},
CColor{179 / 255.0, 255 / 255.0, 204 / 255.0, 1.0}, CColor{179 / 255.0, 255 / 255.0, 204 / 255.0, 1.0},

View File

@ -10,8 +10,7 @@
#define LOGMESSAGESIZE 1024 #define LOGMESSAGESIZE 1024
#define ROLLING_LOG_SIZE 4096 #define ROLLING_LOG_SIZE 4096
enum LogLevel enum LogLevel {
{
NONE = -1, NONE = -1,
LOG = 0, LOG = 0,
WARN, WARN,

View File

@ -191,7 +191,7 @@ void Events::listener_repositionPopupXDG(void* owner, void* data) {
const auto PMONITOR = g_pCompositor->m_pLastMonitor; const auto PMONITOR = g_pCompositor->m_pLastMonitor;
CBox box = {PMONITOR->vecPosition.x - lx + PPOPUP->popup->current.geometry.x, PMONITOR->vecPosition.y - ly + PPOPUP->popup->current.geometry.y, PMONITOR->vecSize.x, CBox box = {PMONITOR->vecPosition.x - lx + PPOPUP->popup->current.geometry.x, PMONITOR->vecPosition.y - ly + PPOPUP->popup->current.geometry.y, PMONITOR->vecSize.x,
PMONITOR->vecSize.y}; PMONITOR->vecSize.y};
wlr_xdg_popup_unconstrain_from_box(PPOPUP->popup, box.pWlr()); wlr_xdg_popup_unconstrain_from_box(PPOPUP->popup, box.pWlr());
} }

View File

@ -8,16 +8,14 @@
#include "../macros.hpp" #include "../macros.hpp"
#include "../debug/Log.hpp" #include "../debug/Log.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,
@ -37,10 +35,10 @@ class CAnimatedVariable {
void create(ANIMATEDVARTYPE, SAnimationPropertyConfig*, void* pWindow, AVARDAMAGEPOLICY); void create(ANIMATEDVARTYPE, SAnimationPropertyConfig*, void* pWindow, AVARDAMAGEPOLICY);
void create(ANIMATEDVARTYPE, std::any val, SAnimationPropertyConfig*, void* pWindow, AVARDAMAGEPOLICY); void create(ANIMATEDVARTYPE, std::any val, SAnimationPropertyConfig*, void* pWindow, AVARDAMAGEPOLICY);
CAnimatedVariable(const CAnimatedVariable&) = delete; CAnimatedVariable(const CAnimatedVariable&) = delete;
CAnimatedVariable(CAnimatedVariable&&) = delete; CAnimatedVariable(CAnimatedVariable&&) = delete;
CAnimatedVariable& operator=(const CAnimatedVariable&) = delete; CAnimatedVariable& operator=(const CAnimatedVariable&) = delete;
CAnimatedVariable& operator=(CAnimatedVariable&&) = delete; CAnimatedVariable& operator=(CAnimatedVariable&&) = delete;
~CAnimatedVariable(); ~CAnimatedVariable();

View File

@ -42,7 +42,7 @@ class CMonitor {
int activeWorkspace = -1; int activeWorkspace = -1;
float scale = 1; float scale = 1;
std::string szName = ""; std::string szName = "";
std::string szDescription = ""; std::string szDescription = "";
Vector2D vecReservedTopLeft = Vector2D(0, 0); Vector2D vecReservedTopLeft = Vector2D(0, 0);

View File

@ -13,10 +13,10 @@ class CWLSurface {
void assign(wlr_surface* pSurface); void assign(wlr_surface* pSurface);
void unassign(); void unassign();
CWLSurface(const CWLSurface&) = delete; CWLSurface(const CWLSurface&) = delete;
CWLSurface(CWLSurface&&) = delete; CWLSurface(CWLSurface&&) = delete;
CWLSurface& operator=(const CWLSurface&) = delete; CWLSurface& operator=(const CWLSurface&) = delete;
CWLSurface& operator=(CWLSurface&&) = delete; CWLSurface& operator=(CWLSurface&&) = delete;
wlr_surface* wlr() const; wlr_surface* wlr() const;
bool exists() const; bool exists() const;

View File

@ -90,7 +90,7 @@ void CWorkspace::startAnim(bool in, bool left, bool instant) {
} }
} else if (ANIMSTYLE == "slidevert") { } else if (ANIMSTYLE == "slidevert") {
// fallback is slide // fallback is slide
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID); const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
const auto YDISTANCE = PMONITOR->vecSize.y + *PWORKSPACEGAP; const auto YDISTANCE = PMONITOR->vecSize.y + *PWORKSPACEGAP;
m_fAlpha.setValueAndWarp(1.f); // fix a bug, if switching from fade -> slide. m_fAlpha.setValueAndWarp(1.f); // fix a bug, if switching from fade -> slide.
@ -103,7 +103,7 @@ void CWorkspace::startAnim(bool in, bool left, bool instant) {
} }
} else { } else {
// fallback is slide // fallback is slide
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID); const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
const auto XDISTANCE = PMONITOR->vecSize.x + *PWORKSPACEGAP; const auto XDISTANCE = PMONITOR->vecSize.x + *PWORKSPACEGAP;
m_fAlpha.setValueAndWarp(1.f); // fix a bug, if switching from fade -> slide. m_fAlpha.setValueAndWarp(1.f); // fix a bug, if switching from fade -> slide.

View File

@ -28,8 +28,7 @@ typedef struct {
} xcb_size_hints_t; } xcb_size_hints_t;
typedef unsigned int xcb_window_t; typedef unsigned int xcb_window_t;
typedef enum xcb_stack_mode_t typedef enum xcb_stack_mode_t {
{
XCB_STACK_MODE_ABOVE = 0, XCB_STACK_MODE_ABOVE = 0,
XCB_STACK_MODE_BELOW = 1, XCB_STACK_MODE_BELOW = 1,
XCB_STACK_MODE_TOP_IF = 2, XCB_STACK_MODE_TOP_IF = 2,

View File

@ -27,7 +27,7 @@
// pthread first because it uses class in a C++ way and XWayland includes that... // pthread first because it uses class in a C++ way and XWayland includes that...
#include <pthread.h> #include <pthread.h>
#define class _class #define class _class
#define namespace _namespace #define namespace _namespace
#define static #define static
#define delete delete_ #define delete delete_

View File

@ -5,8 +5,8 @@ bool Init::isSudo() {
} }
void Init::gainRealTime() { void Init::gainRealTime() {
const int minPrio = sched_get_priority_min(SCHED_RR); const int minPrio = sched_get_priority_min(SCHED_RR);
int old_policy; int old_policy;
struct sched_param param; struct sched_param param;
if (pthread_getschedparam(pthread_self(), &old_policy, &param)) { if (pthread_getschedparam(pthread_self(), &old_policy, &param)) {

View File

@ -15,8 +15,7 @@ struct SLayoutMessageHeader {
enum eFullscreenMode : int8_t; enum eFullscreenMode : int8_t;
enum eRectCorner enum eRectCorner {
{
CORNER_NONE = 0, CORNER_NONE = 0,
CORNER_TOPLEFT, CORNER_TOPLEFT,
CORNER_TOPRIGHT, CORNER_TOPRIGHT,
@ -24,8 +23,7 @@ enum eRectCorner
CORNER_BOTTOMLEFT CORNER_BOTTOMLEFT
}; };
enum eDirection enum eDirection {
{
DIRECTION_DEFAULT = -1, DIRECTION_DEFAULT = -1,
DIRECTION_UP = 0, DIRECTION_UP = 0,
DIRECTION_RIGHT, DIRECTION_RIGHT,

View File

@ -44,7 +44,7 @@
if (!(expr)) { \ if (!(expr)) { \
Debug::log(CRIT, "\n==========================================================================================\nASSERTION FAILED! \n\n{}\n\nat: line {} in {}", \ Debug::log(CRIT, "\n==========================================================================================\nASSERTION FAILED! \n\n{}\n\nat: line {} in {}", \
std::format(reason, ##__VA_ARGS__), __LINE__, \ std::format(reason, ##__VA_ARGS__), __LINE__, \
([]() constexpr->std::string { return std::string(__FILE__).substr(std::string(__FILE__).find_last_of('/') + 1); })()); \ ([]() constexpr -> std::string { return std::string(__FILE__).substr(std::string(__FILE__).find_last_of('/') + 1); })()); \
printf("Assertion failed! See the log in /tmp/hypr/hyprland.log for more info."); \ printf("Assertion failed! See the log in /tmp/hypr/hyprland.log for more info."); \
raise(SIGABRT); \ raise(SIGABRT); \
} }
@ -63,9 +63,7 @@
} }
#define FORMAT_FLAG(spec__, flag__) \ #define FORMAT_FLAG(spec__, flag__) \
case spec__: \ case spec__: (flag__) = true; break;
(flag__) = true; \
break;
#define FORMAT_NUMBER(buf__) \ #define FORMAT_NUMBER(buf__) \
case '0': \ case '0': \
@ -77,9 +75,7 @@
case '6': \ case '6': \
case '7': \ case '7': \
case '8': \ case '8': \
case '9': \ case '9': (buf__).push_back(*it); break;
(buf__).push_back(*it); \
break;
#if ISDEBUG #if ISDEBUG
#define UNREACHABLE() \ #define UNREACHABLE() \

View File

@ -20,6 +20,7 @@ class CEventManager {
void startThread(); void startThread();
std::thread m_tThread; std::thread m_tThread;
private: private:
void flushEvents(); void flushEvents();

View File

@ -29,8 +29,7 @@ struct SKeybind {
bool shadowed = false; bool shadowed = false;
}; };
enum eFocusWindowMode enum eFocusWindowMode {
{
MODE_CLASS_REGEX = 0, MODE_CLASS_REGEX = 0,
MODE_TITLE_REGEX, MODE_TITLE_REGEX,
MODE_ADDRESS, MODE_ADDRESS,

View File

@ -1657,7 +1657,7 @@ void CInputManager::setCursorIconOnBorder(CWindow* w) {
CBox box = w->getWindowMainSurfaceBox(); CBox box = w->getWindowMainSurfaceBox();
eBorderIconDirection direction = BORDERICON_NONE; eBorderIconDirection direction = BORDERICON_NONE;
CBox boxFullGrabInput = {box.x - *PEXTENDBORDERGRAB - BORDERSIZE, box.y - *PEXTENDBORDERGRAB - BORDERSIZE, box.width + 2 * (*PEXTENDBORDERGRAB + BORDERSIZE), CBox boxFullGrabInput = {box.x - *PEXTENDBORDERGRAB - BORDERSIZE, box.y - *PEXTENDBORDERGRAB - BORDERSIZE, box.width + 2 * (*PEXTENDBORDERGRAB + BORDERSIZE),
box.height + 2 * (*PEXTENDBORDERGRAB + BORDERSIZE)}; box.height + 2 * (*PEXTENDBORDERGRAB + BORDERSIZE)};
if (w->hasPopupAt(mouseCoords)) if (w->hasPopupAt(mouseCoords))
direction = BORDERICON_NONE; direction = BORDERICON_NONE;

View File

@ -7,14 +7,12 @@
#include "../../helpers/Timer.hpp" #include "../../helpers/Timer.hpp"
#include "InputMethodRelay.hpp" #include "InputMethodRelay.hpp"
enum eClickBehaviorMode enum eClickBehaviorMode {
{
CLICKMODE_DEFAULT = 0, CLICKMODE_DEFAULT = 0,
CLICKMODE_KILL CLICKMODE_KILL
}; };
enum eMouseBindMode enum eMouseBindMode {
{
MBIND_INVALID = -1, MBIND_INVALID = -1,
MBIND_MOVE = 0, MBIND_MOVE = 0,
MBIND_RESIZE = 1, MBIND_RESIZE = 1,
@ -22,8 +20,7 @@ enum eMouseBindMode
MBIND_RESIZE_FORCE_RATIO = 3 MBIND_RESIZE_FORCE_RATIO = 3
}; };
enum eBorderIconDirection enum eBorderIconDirection {
{
BORDERICON_NONE, BORDERICON_NONE,
BORDERICON_UP, BORDERICON_UP,
BORDERICON_DOWN, BORDERICON_DOWN,

View File

@ -76,12 +76,12 @@ void CInputManager::onSwipeEnd(wlr_pointer_swipe_end_event* e) {
workspaceIDRight = maxWorkspace + 1; workspaceIDRight = maxWorkspace + 1;
} }
auto PWORKSPACER = g_pCompositor->getWorkspaceByID(workspaceIDRight); // not guaranteed if PSWIPENEW || PSWIPENUMBER auto PWORKSPACER = g_pCompositor->getWorkspaceByID(workspaceIDRight); // not guaranteed if PSWIPENEW || PSWIPENUMBER
auto PWORKSPACEL = g_pCompositor->getWorkspaceByID(workspaceIDLeft); // not guaranteed if PSWIPENUMBER auto PWORKSPACEL = g_pCompositor->getWorkspaceByID(workspaceIDLeft); // not guaranteed if PSWIPENUMBER
const auto RENDEROFFSETMIDDLE = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.vec(); const auto RENDEROFFSETMIDDLE = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.vec();
const auto XDISTANCE = m_sActiveSwipe.pMonitor->vecSize.x + *PWORKSPACEGAP; const auto XDISTANCE = m_sActiveSwipe.pMonitor->vecSize.x + *PWORKSPACEGAP;
const auto YDISTANCE = m_sActiveSwipe.pMonitor->vecSize.y + *PWORKSPACEGAP; const auto YDISTANCE = m_sActiveSwipe.pMonitor->vecSize.y + *PWORKSPACEGAP;
CWorkspace* pSwitchedTo = nullptr; CWorkspace* pSwitchedTo = nullptr;
@ -204,9 +204,9 @@ void CInputManager::onSwipeUpdate(wlr_pointer_swipe_update_event* e) {
static auto* const PSWIPEUSER = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_use_r")->intValue; static auto* const PSWIPEUSER = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_use_r")->intValue;
static auto* const PWORKSPACEGAP = &g_pConfigManager->getConfigValuePtr("general:gaps_workspaces")->intValue; static auto* const PWORKSPACEGAP = &g_pConfigManager->getConfigValuePtr("general:gaps_workspaces")->intValue;
const auto XDISTANCE = m_sActiveSwipe.pMonitor->vecSize.x + *PWORKSPACEGAP; const auto XDISTANCE = m_sActiveSwipe.pMonitor->vecSize.x + *PWORKSPACEGAP;
const auto YDISTANCE = m_sActiveSwipe.pMonitor->vecSize.y + *PWORKSPACEGAP; const auto YDISTANCE = m_sActiveSwipe.pMonitor->vecSize.y + *PWORKSPACEGAP;
const bool VERTANIMS = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle == "slidevert" || const bool VERTANIMS = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle == "slidevert" ||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle.starts_with("slidefadevert"); m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle.starts_with("slidefadevert");
m_sActiveSwipe.delta += VERTANIMS ? (*PSWIPEINVR ? -e->dy : e->dy) : (*PSWIPEINVR ? -e->dx : e->dx); m_sActiveSwipe.delta += VERTANIMS ? (*PSWIPEINVR ? -e->dy : e->dy) : (*PSWIPEINVR ? -e->dx : e->dx);
@ -251,11 +251,9 @@ void CInputManager::onSwipeUpdate(wlr_pointer_swipe_update_event* e) {
g_pHyprRenderer->damageMonitor(m_sActiveSwipe.pMonitor); g_pHyprRenderer->damageMonitor(m_sActiveSwipe.pMonitor);
if (VERTANIMS) if (VERTANIMS)
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp( m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(0, ((-m_sActiveSwipe.delta) / *PSWIPEDIST) * YDISTANCE));
Vector2D(0, ((-m_sActiveSwipe.delta) / *PSWIPEDIST) * YDISTANCE));
else else
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp( m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / *PSWIPEDIST) * XDISTANCE, 0));
Vector2D(((-m_sActiveSwipe.delta) / *PSWIPEDIST) * XDISTANCE, 0));
g_pCompositor->updateWorkspaceWindowDecos(m_sActiveSwipe.pWorkspaceBegin->m_iID); g_pCompositor->updateWorkspaceWindowDecos(m_sActiveSwipe.pWorkspaceBegin->m_iID);
return; return;
@ -277,15 +275,11 @@ void CInputManager::onSwipeUpdate(wlr_pointer_swipe_update_event* e) {
} }
if (VERTANIMS) { if (VERTANIMS) {
PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D( PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D(0, ((-m_sActiveSwipe.delta) / *PSWIPEDIST) * YDISTANCE - YDISTANCE));
0, ((-m_sActiveSwipe.delta) / *PSWIPEDIST) * YDISTANCE - YDISTANCE)); m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(0, ((-m_sActiveSwipe.delta) / *PSWIPEDIST) * YDISTANCE));
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(
Vector2D(0, ((-m_sActiveSwipe.delta) / *PSWIPEDIST) * YDISTANCE));
} else { } else {
PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D( PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / *PSWIPEDIST) * XDISTANCE - XDISTANCE, 0));
((-m_sActiveSwipe.delta) / *PSWIPEDIST) * XDISTANCE - XDISTANCE, 0)); m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / *PSWIPEDIST) * XDISTANCE, 0));
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(
Vector2D(((-m_sActiveSwipe.delta) / *PSWIPEDIST) * XDISTANCE, 0));
} }
g_pCompositor->updateWorkspaceWindowDecos(workspaceIDLeft); g_pCompositor->updateWorkspaceWindowDecos(workspaceIDLeft);
@ -297,11 +291,9 @@ void CInputManager::onSwipeUpdate(wlr_pointer_swipe_update_event* e) {
g_pHyprRenderer->damageMonitor(m_sActiveSwipe.pMonitor); g_pHyprRenderer->damageMonitor(m_sActiveSwipe.pMonitor);
if (VERTANIMS) if (VERTANIMS)
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp( m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(0, ((-m_sActiveSwipe.delta) / *PSWIPEDIST) * YDISTANCE));
Vector2D(0, ((-m_sActiveSwipe.delta) / *PSWIPEDIST) * YDISTANCE));
else else
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp( m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / *PSWIPEDIST) * XDISTANCE, 0));
Vector2D(((-m_sActiveSwipe.delta) / *PSWIPEDIST) * XDISTANCE, 0));
g_pCompositor->updateWorkspaceWindowDecos(m_sActiveSwipe.pWorkspaceBegin->m_iID); g_pCompositor->updateWorkspaceWindowDecos(m_sActiveSwipe.pWorkspaceBegin->m_iID);
return; return;
@ -323,15 +315,11 @@ void CInputManager::onSwipeUpdate(wlr_pointer_swipe_update_event* e) {
} }
if (VERTANIMS) { if (VERTANIMS) {
PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D( PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D(0, ((-m_sActiveSwipe.delta) / *PSWIPEDIST) * YDISTANCE + YDISTANCE));
0, ((-m_sActiveSwipe.delta) / *PSWIPEDIST) * YDISTANCE + YDISTANCE)); m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(0, ((-m_sActiveSwipe.delta) / *PSWIPEDIST) * YDISTANCE));
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(
Vector2D(0, ((-m_sActiveSwipe.delta) / *PSWIPEDIST) * YDISTANCE));
} else { } else {
PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D( PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / *PSWIPEDIST) * XDISTANCE + XDISTANCE, 0));
((-m_sActiveSwipe.delta) / *PSWIPEDIST) * XDISTANCE + XDISTANCE, 0)); m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / *PSWIPEDIST) * XDISTANCE, 0));
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(
Vector2D(((-m_sActiveSwipe.delta) / *PSWIPEDIST) * XDISTANCE, 0));
} }
g_pCompositor->updateWorkspaceWindowDecos(workspaceIDRight); g_pCompositor->updateWorkspaceWindowDecos(workspaceIDRight);

View File

@ -14,10 +14,10 @@ class CFunctionHook {
bool hook(); bool hook();
bool unhook(); bool unhook();
CFunctionHook(const CFunctionHook&) = delete; CFunctionHook(const CFunctionHook&) = delete;
CFunctionHook(CFunctionHook&&) = delete; CFunctionHook(CFunctionHook&&) = delete;
CFunctionHook& operator=(const CFunctionHook&) = delete; CFunctionHook& operator=(const CFunctionHook&) = delete;
CFunctionHook& operator=(CFunctionHook&&) = delete; CFunctionHook& operator=(CFunctionHook&&) = delete;
void* m_pOriginal = nullptr; void* m_pOriginal = nullptr;

View File

@ -53,7 +53,9 @@ void CFractionalScaleProtocolManager::bindManager(wl_client* client, void* data,
static void handleDestroyScaleAddon(wl_client* client, wl_resource* resource); static void handleDestroyScaleAddon(wl_client* client, wl_resource* resource);
// //
static const struct wp_fractional_scale_v1_interface fractionalScaleAddonImpl { .destroy = handleDestroyScaleAddon }; static const struct wp_fractional_scale_v1_interface fractionalScaleAddonImpl {
.destroy = handleDestroyScaleAddon
};
// //
SFractionalScaleAddon* addonFromResource(wl_resource* resource) { SFractionalScaleAddon* addonFromResource(wl_resource* resource) {

View File

@ -10,8 +10,7 @@
class CMonitor; class CMonitor;
enum eClientOwners enum eClientOwners {
{
CLIENT_SCREENCOPY = 0, CLIENT_SCREENCOPY = 0,
CLIENT_TOPLEVEL_EXPORT CLIENT_TOPLEVEL_EXPORT
}; };

View File

@ -30,8 +30,7 @@ inline const float fullVerts[] = {
}; };
inline const float fanVertsFull[] = {-1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f}; inline const float fanVertsFull[] = {-1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f};
enum eDiscardMode enum eDiscardMode {
{
DISCARD_OPAQUE = 1, DISCARD_OPAQUE = 1,
DISCARD_ALPHA = 1 << 1 DISCARD_ALPHA = 1 << 1
}; };

View File

@ -13,23 +13,20 @@
struct SMonitorRule; struct SMonitorRule;
// TODO: add fuller damage tracking for updating only parts of a window // TODO: add fuller damage tracking for updating only parts of a window
enum DAMAGETRACKINGMODES enum DAMAGETRACKINGMODES {
{
DAMAGE_TRACKING_INVALID = -1, DAMAGE_TRACKING_INVALID = -1,
DAMAGE_TRACKING_NONE = 0, DAMAGE_TRACKING_NONE = 0,
DAMAGE_TRACKING_MONITOR, DAMAGE_TRACKING_MONITOR,
DAMAGE_TRACKING_FULL DAMAGE_TRACKING_FULL
}; };
enum eRenderPassMode enum eRenderPassMode {
{
RENDER_PASS_ALL = 0, RENDER_PASS_ALL = 0,
RENDER_PASS_MAIN, RENDER_PASS_MAIN,
RENDER_PASS_POPUP RENDER_PASS_POPUP
}; };
enum eRenderMode enum eRenderMode {
{
RENDER_MODE_NORMAL = 0, RENDER_MODE_NORMAL = 0,
RENDER_MODE_FULL_FAKE = 1, RENDER_MODE_FULL_FAKE = 1,
RENDER_MODE_TO_BUFFER = 2, RENDER_MODE_TO_BUFFER = 2,

View File

@ -2,8 +2,7 @@
#include "../defines.hpp" #include "../defines.hpp"
enum TEXTURETYPE enum TEXTURETYPE {
{
TEXTURE_INVALID, // Invalid TEXTURE_INVALID, // Invalid
TEXTURE_RGBA, // 4 channels TEXTURE_RGBA, // 4 channels
TEXTURE_RGBX, // discard A TEXTURE_RGBX, // discard A

View File

@ -9,14 +9,12 @@
class CWindow; class CWindow;
class IHyprWindowDecoration; class IHyprWindowDecoration;
enum eDecorationPositioningPolicy enum eDecorationPositioningPolicy {
{
DECORATION_POSITION_ABSOLUTE = 0, /* Decoration wants absolute positioning */ DECORATION_POSITION_ABSOLUTE = 0, /* Decoration wants absolute positioning */
DECORATION_POSITION_STICKY, /* Decoration is stuck to some edge of a window */ DECORATION_POSITION_STICKY, /* Decoration is stuck to some edge of a window */
}; };
enum eDecorationEdges enum eDecorationEdges {
{
DECORATION_EDGE_TOP = 1 << 0, DECORATION_EDGE_TOP = 1 << 0,
DECORATION_EDGE_BOTTOM = 1 << 1, DECORATION_EDGE_BOTTOM = 1 << 1,
DECORATION_EDGE_LEFT = 1 << 2, DECORATION_EDGE_LEFT = 1 << 2,

View File

@ -4,24 +4,21 @@
#include "../../helpers/Region.hpp" #include "../../helpers/Region.hpp"
#include "DecorationPositioner.hpp" #include "DecorationPositioner.hpp"
enum eDecorationType enum eDecorationType {
{
DECORATION_NONE = -1, DECORATION_NONE = -1,
DECORATION_GROUPBAR, DECORATION_GROUPBAR,
DECORATION_SHADOW, DECORATION_SHADOW,
DECORATION_CUSTOM DECORATION_CUSTOM
}; };
enum eDecorationLayer enum eDecorationLayer {
{
DECORATION_LAYER_BOTTOM = 0, /* lowest. */ DECORATION_LAYER_BOTTOM = 0, /* lowest. */
DECORATION_LAYER_UNDER, /* under the window, but above BOTTOM */ DECORATION_LAYER_UNDER, /* under the window, but above BOTTOM */
DECORATION_LAYER_OVER, /* above the window, but below its popups */ DECORATION_LAYER_OVER, /* above the window, but below its popups */
DECORATION_LAYER_OVERLAY /* above everything of the window, including popups */ DECORATION_LAYER_OVERLAY /* above everything of the window, including popups */
}; };
enum eDecorationFlags enum eDecorationFlags {
{
DECORATION_ALLOWS_MOUSE_INPUT = 1 << 0, /* this decoration accepts mouse input */ DECORATION_ALLOWS_MOUSE_INPUT = 1 << 0, /* this decoration accepts mouse input */
DECORATION_PART_OF_MAIN_WINDOW = 1 << 1, /* this decoration is a *seamless* part of the main window, so stuff like shadows will include it */ DECORATION_PART_OF_MAIN_WINDOW = 1 << 1, /* this decoration is a *seamless* part of the main window, so stuff like shadows will include it */
DECORATION_NON_SOLID = 1 << 2, /* this decoration is not solid. Other decorations should draw on top of it. Example: shadow */ DECORATION_NON_SOLID = 1 << 2, /* this decoration is not solid. Other decorations should draw on top of it. Example: shadow */