diff --git a/.clang-format-ignore b/.clang-format-ignore new file mode 100644 index 00000000..c6bf34ed --- /dev/null +++ b/.clang-format-ignore @@ -0,0 +1 @@ +subprojects/**/* diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a78b7522..54248e3a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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 - name: Compile 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 diff --git a/src/Compositor.hpp b/src/Compositor.hpp index 8ca43d84..65550154 100644 --- a/src/Compositor.hpp +++ b/src/Compositor.hpp @@ -29,8 +29,7 @@ #include "plugins/PluginSystem.hpp" #include "helpers/Watchdog.hpp" -enum eManagersInitStage -{ +enum eManagersInitStage { STAGE_PRIORITY = 0, STAGE_LATE }; diff --git a/src/SharedDefs.hpp b/src/SharedDefs.hpp index 19d26b61..4b1524b3 100644 --- a/src/SharedDefs.hpp +++ b/src/SharedDefs.hpp @@ -2,8 +2,7 @@ #include "helpers/Vector2D.hpp" -enum eIcons -{ +enum eIcons { ICON_WARNING = 0, ICON_INFO, ICON_HINT, @@ -13,8 +12,7 @@ enum eIcons ICON_NONE }; -enum eRenderStage -{ +enum eRenderStage { 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_PRE_WINDOWS, /* Pre windows, post bottom and overlay layers */ diff --git a/src/Window.hpp b/src/Window.hpp index 4e1ab9c1..f9873ead 100644 --- a/src/Window.hpp +++ b/src/Window.hpp @@ -11,16 +11,14 @@ #include "macros.hpp" #include "managers/XWaylandManager.hpp" -enum eIdleInhibitMode -{ +enum eIdleInhibitMode { IDLEINHIBIT_NONE = 0, IDLEINHIBIT_ALWAYS, IDLEINHIBIT_FULLSCREEN, IDLEINHIBIT_FOCUS }; -enum eGroupRules -{ +enum eGroupRules { // effective only during first map, except for _ALWAYS variant GROUP_NONE = 0, GROUP_SET = 1 << 0, // Open as new group or add to focused group diff --git a/src/debug/CrashReporter.cpp b/src/debug/CrashReporter.cpp index 14aa5c5b..dac96fb3 100644 --- a/src/debug/CrashReporter.cpp +++ b/src/debug/CrashReporter.cpp @@ -13,19 +13,19 @@ std::string getRandomMessage() { const std::vector MESSAGES = {"Sorry, didn't mean to...", - "This was an accident, I swear!", - "Calm down, it was a misinput! MISINPUT!", - "Oops", - "Vaxry is going to be upset.", - "Who tried dividing by zero?!", - "Maybe you should try dusting your PC in the meantime?", - "I tried so hard, and got so far...", - "I don't feel so good...", - "*thud*", - "Well this is awkward.", - "\"stable\"", - "I hope you didn't have any unsaved progress.", - "All these computers..."}; + "This was an accident, I swear!", + "Calm down, it was a misinput! MISINPUT!", + "Oops", + "Vaxry is going to be upset.", + "Who tried dividing by zero?!", + "Maybe you should try dusting your PC in the meantime?", + "I tried so hard, and got so far...", + "I don't feel so good...", + "*thud*", + "Well this is awkward.", + "\"stable\"", + "I hope you didn't have any unsaved progress.", + "All these computers..."}; std::random_device dev; std::mt19937 engine(dev()); diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp index 91bbe264..98526ef4 100644 --- a/src/debug/HyprCtl.cpp +++ b/src/debug/HyprCtl.cpp @@ -75,10 +75,9 @@ std::string monitorsRequest(std::string request, HyprCtl::eHyprCtlOutputFormat f "vrr": {}, "activelyTearing": {} }},)#", - m->ID, escapeJSONStrings(m->szName), escapeJSONStrings(m->szDescription), (m->output->make ? m->output->make : ""), - (m->output->model ? m->output->model : ""), (m->output->serial ? m->output->serial : ""), (int)m->vecPixelSize.x, (int)m->vecPixelSize.y, m->refreshRate, - (int)m->vecPosition.x, (int)m->vecPosition.y, m->activeWorkspace, - (m->activeWorkspace == -1 ? "" : escapeJSONStrings(g_pCompositor->getWorkspaceByID(m->activeWorkspace)->m_szName)), m->specialWorkspaceID, + m->ID, escapeJSONStrings(m->szName), escapeJSONStrings(m->szDescription), (m->output->make ? m->output->make : ""), (m->output->model ? m->output->model : ""), + (m->output->serial ? m->output->serial : ""), (int)m->vecPixelSize.x, (int)m->vecPixelSize.y, m->refreshRate, (int)m->vecPosition.x, (int)m->vecPosition.y, + m->activeWorkspace, (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, (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"), @@ -93,17 +92,17 @@ std::string monitorsRequest(std::string request, HyprCtl::eHyprCtlOutputFormat f if (!m->output || m->ID == -1ull) continue; - result += 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: {} " - "{} {} {}\n\tscale: {:.2f}\n\ttransform: " - "{}\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->szDescription, (m->output->make ? m->output->make : ""), (m->output->model ? m->output->model : ""), - (m->output->serial ? m->output->serial : ""), m->activeWorkspace, (m->activeWorkspace == -1 ? "" : g_pCompositor->getWorkspaceByID(m->activeWorkspace)->m_szName), - m->specialWorkspaceID, 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 ? "yes" : "no"), - (int)m->dpmsStatus, (int)(m->output->adaptive_sync_status == WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED), m->tearingState.activelyTearing); + result += + 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: {} " + "{} {} {}\n\tscale: {:.2f}\n\ttransform: " + "{}\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->szDescription, + (m->output->make ? m->output->make : ""), (m->output->model ? m->output->model : ""), (m->output->serial ? m->output->serial : ""), m->activeWorkspace, + (m->activeWorkspace == -1 ? "" : g_pCompositor->getWorkspaceByID(m->activeWorkspace)->m_szName), m->specialWorkspaceID, + 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 ? "yes" : "no"), (int)m->dpmsStatus, + (int)(m->output->adaptive_sync_status == WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED), m->tearingState.activelyTearing); } } diff --git a/src/debug/HyprCtl.hpp b/src/debug/HyprCtl.hpp index 4816c63c..00cf7c5b 100644 --- a/src/debug/HyprCtl.hpp +++ b/src/debug/HyprCtl.hpp @@ -19,8 +19,7 @@ namespace HyprCtl { inline int iSocketFD = -1; - enum eHyprCtlOutputFormat - { + enum eHyprCtlOutputFormat { FORMAT_NORMAL = 0, FORMAT_JSON }; diff --git a/src/debug/HyprNotificationOverlay.hpp b/src/debug/HyprNotificationOverlay.hpp index 46a9a3d0..84e61f80 100644 --- a/src/debug/HyprNotificationOverlay.hpp +++ b/src/debug/HyprNotificationOverlay.hpp @@ -10,16 +10,15 @@ #include -enum eIconBackend -{ +enum eIconBackend { ICONS_BACKEND_NONE = 0, ICONS_BACKEND_NF, ICONS_BACKEND_FA }; static const std::array, 3 /* backends */> ICONS_ARRAY = { - std::array{"[!]", "[i]", "[Hint]", "[Err]", "[?]", "[ok]", ""}, std::array{"", "", "", "", "", "󰸞", ""}, - std::array{"", "", "", "", "", ""}}; + std::array{"[!]", "[i]", "[Hint]", "[Err]", "[?]", "[ok]", ""}, + std::array{"", "", "", "", "", "󰸞", ""}, std::array{"", "", "", "", "", ""}}; static const std::array 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{179 / 255.0, 255 / 255.0, 204 / 255.0, 1.0}, diff --git a/src/debug/Log.hpp b/src/debug/Log.hpp index d9a7f6aa..3d2ed48c 100644 --- a/src/debug/Log.hpp +++ b/src/debug/Log.hpp @@ -10,8 +10,7 @@ #define LOGMESSAGESIZE 1024 #define ROLLING_LOG_SIZE 4096 -enum LogLevel -{ +enum LogLevel { NONE = -1, LOG = 0, WARN, diff --git a/src/events/Popups.cpp b/src/events/Popups.cpp index c8898c3b..bcdb1808 100644 --- a/src/events/Popups.cpp +++ b/src/events/Popups.cpp @@ -191,7 +191,7 @@ void Events::listener_repositionPopupXDG(void* owner, void* data) { 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, - PMONITOR->vecSize.y}; + PMONITOR->vecSize.y}; wlr_xdg_popup_unconstrain_from_box(PPOPUP->popup, box.pWlr()); } diff --git a/src/helpers/AnimatedVariable.hpp b/src/helpers/AnimatedVariable.hpp index 059e892d..d87273b3 100644 --- a/src/helpers/AnimatedVariable.hpp +++ b/src/helpers/AnimatedVariable.hpp @@ -8,16 +8,14 @@ #include "../macros.hpp" #include "../debug/Log.hpp" -enum ANIMATEDVARTYPE -{ +enum ANIMATEDVARTYPE { AVARTYPE_INVALID = -1, AVARTYPE_FLOAT, AVARTYPE_VECTOR, AVARTYPE_COLOR }; -enum AVARDAMAGEPOLICY -{ +enum AVARDAMAGEPOLICY { AVARDAMAGE_NONE = -1, AVARDAMAGE_ENTIRE = 0, AVARDAMAGE_BORDER, @@ -37,10 +35,10 @@ class CAnimatedVariable { void create(ANIMATEDVARTYPE, SAnimationPropertyConfig*, void* pWindow, AVARDAMAGEPOLICY); void create(ANIMATEDVARTYPE, std::any val, SAnimationPropertyConfig*, void* pWindow, AVARDAMAGEPOLICY); - CAnimatedVariable(const CAnimatedVariable&) = delete; - CAnimatedVariable(CAnimatedVariable&&) = delete; + CAnimatedVariable(const CAnimatedVariable&) = delete; + CAnimatedVariable(CAnimatedVariable&&) = delete; CAnimatedVariable& operator=(const CAnimatedVariable&) = delete; - CAnimatedVariable& operator=(CAnimatedVariable&&) = delete; + CAnimatedVariable& operator=(CAnimatedVariable&&) = delete; ~CAnimatedVariable(); diff --git a/src/helpers/Monitor.hpp b/src/helpers/Monitor.hpp index 7621ac17..f44e2c16 100644 --- a/src/helpers/Monitor.hpp +++ b/src/helpers/Monitor.hpp @@ -42,7 +42,7 @@ class CMonitor { int activeWorkspace = -1; float scale = 1; - std::string szName = ""; + std::string szName = ""; std::string szDescription = ""; Vector2D vecReservedTopLeft = Vector2D(0, 0); diff --git a/src/helpers/WLSurface.hpp b/src/helpers/WLSurface.hpp index 8b4ef835..faef4353 100644 --- a/src/helpers/WLSurface.hpp +++ b/src/helpers/WLSurface.hpp @@ -13,10 +13,10 @@ class CWLSurface { void assign(wlr_surface* pSurface); void unassign(); - CWLSurface(const CWLSurface&) = delete; - CWLSurface(CWLSurface&&) = delete; + CWLSurface(const CWLSurface&) = delete; + CWLSurface(CWLSurface&&) = delete; CWLSurface& operator=(const CWLSurface&) = delete; - CWLSurface& operator=(CWLSurface&&) = delete; + CWLSurface& operator=(CWLSurface&&) = delete; wlr_surface* wlr() const; bool exists() const; diff --git a/src/helpers/Workspace.cpp b/src/helpers/Workspace.cpp index c027688e..213607d0 100644 --- a/src/helpers/Workspace.cpp +++ b/src/helpers/Workspace.cpp @@ -90,7 +90,7 @@ void CWorkspace::startAnim(bool in, bool left, bool instant) { } } else if (ANIMSTYLE == "slidevert") { // 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; 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 { // 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; m_fAlpha.setValueAndWarp(1.f); // fix a bug, if switching from fade -> slide. diff --git a/src/helpers/XWaylandStubs.hpp b/src/helpers/XWaylandStubs.hpp index 904867cf..89e0b41f 100644 --- a/src/helpers/XWaylandStubs.hpp +++ b/src/helpers/XWaylandStubs.hpp @@ -28,8 +28,7 @@ typedef struct { } xcb_size_hints_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_BELOW = 1, XCB_STACK_MODE_TOP_IF = 2, diff --git a/src/includes.hpp b/src/includes.hpp index 611e4a5c..961729ad 100644 --- a/src/includes.hpp +++ b/src/includes.hpp @@ -27,7 +27,7 @@ // pthread first because it uses class in a C++ way and XWayland includes that... #include -#define class _class +#define class _class #define namespace _namespace #define static #define delete delete_ diff --git a/src/init/initHelpers.cpp b/src/init/initHelpers.cpp index 2a296d2e..2cc491d0 100644 --- a/src/init/initHelpers.cpp +++ b/src/init/initHelpers.cpp @@ -5,8 +5,8 @@ bool Init::isSudo() { } void Init::gainRealTime() { - const int minPrio = sched_get_priority_min(SCHED_RR); - int old_policy; + const int minPrio = sched_get_priority_min(SCHED_RR); + int old_policy; struct sched_param param; if (pthread_getschedparam(pthread_self(), &old_policy, ¶m)) { diff --git a/src/layout/IHyprLayout.hpp b/src/layout/IHyprLayout.hpp index 32f95a22..5c74078e 100644 --- a/src/layout/IHyprLayout.hpp +++ b/src/layout/IHyprLayout.hpp @@ -15,8 +15,7 @@ struct SLayoutMessageHeader { enum eFullscreenMode : int8_t; -enum eRectCorner -{ +enum eRectCorner { CORNER_NONE = 0, CORNER_TOPLEFT, CORNER_TOPRIGHT, @@ -24,8 +23,7 @@ enum eRectCorner CORNER_BOTTOMLEFT }; -enum eDirection -{ +enum eDirection { DIRECTION_DEFAULT = -1, DIRECTION_UP = 0, DIRECTION_RIGHT, diff --git a/src/macros.hpp b/src/macros.hpp index c2eb98db..19b4cbc6 100644 --- a/src/macros.hpp +++ b/src/macros.hpp @@ -44,7 +44,7 @@ if (!(expr)) { \ Debug::log(CRIT, "\n==========================================================================================\nASSERTION FAILED! \n\n{}\n\nat: line {} in {}", \ 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."); \ raise(SIGABRT); \ } @@ -63,9 +63,7 @@ } #define FORMAT_FLAG(spec__, flag__) \ - case spec__: \ - (flag__) = true; \ - break; + case spec__: (flag__) = true; break; #define FORMAT_NUMBER(buf__) \ case '0': \ @@ -77,9 +75,7 @@ case '6': \ case '7': \ case '8': \ - case '9': \ - (buf__).push_back(*it); \ - break; + case '9': (buf__).push_back(*it); break; #if ISDEBUG #define UNREACHABLE() \ diff --git a/src/managers/EventManager.hpp b/src/managers/EventManager.hpp index be2bf2d5..68cda1ee 100644 --- a/src/managers/EventManager.hpp +++ b/src/managers/EventManager.hpp @@ -20,6 +20,7 @@ class CEventManager { void startThread(); std::thread m_tThread; + private: void flushEvents(); diff --git a/src/managers/KeybindManager.hpp b/src/managers/KeybindManager.hpp index 8a0b3b89..73997dd6 100644 --- a/src/managers/KeybindManager.hpp +++ b/src/managers/KeybindManager.hpp @@ -29,8 +29,7 @@ struct SKeybind { bool shadowed = false; }; -enum eFocusWindowMode -{ +enum eFocusWindowMode { MODE_CLASS_REGEX = 0, MODE_TITLE_REGEX, MODE_ADDRESS, diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index b3aadeed..9ef1b4a3 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -1657,7 +1657,7 @@ void CInputManager::setCursorIconOnBorder(CWindow* w) { CBox box = w->getWindowMainSurfaceBox(); eBorderIconDirection direction = BORDERICON_NONE; 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)) direction = BORDERICON_NONE; diff --git a/src/managers/input/InputManager.hpp b/src/managers/input/InputManager.hpp index b6d9d89c..5fa5824e 100644 --- a/src/managers/input/InputManager.hpp +++ b/src/managers/input/InputManager.hpp @@ -7,14 +7,12 @@ #include "../../helpers/Timer.hpp" #include "InputMethodRelay.hpp" -enum eClickBehaviorMode -{ +enum eClickBehaviorMode { CLICKMODE_DEFAULT = 0, CLICKMODE_KILL }; -enum eMouseBindMode -{ +enum eMouseBindMode { MBIND_INVALID = -1, MBIND_MOVE = 0, MBIND_RESIZE = 1, @@ -22,8 +20,7 @@ enum eMouseBindMode MBIND_RESIZE_FORCE_RATIO = 3 }; -enum eBorderIconDirection -{ +enum eBorderIconDirection { BORDERICON_NONE, BORDERICON_UP, BORDERICON_DOWN, diff --git a/src/managers/input/Swipe.cpp b/src/managers/input/Swipe.cpp index d093b8c3..f345e4f5 100644 --- a/src/managers/input/Swipe.cpp +++ b/src/managers/input/Swipe.cpp @@ -76,12 +76,12 @@ void CInputManager::onSwipeEnd(wlr_pointer_swipe_end_event* e) { workspaceIDRight = maxWorkspace + 1; } - auto PWORKSPACER = g_pCompositor->getWorkspaceByID(workspaceIDRight); // not guaranteed if PSWIPENEW || PSWIPENUMBER - auto PWORKSPACEL = g_pCompositor->getWorkspaceByID(workspaceIDLeft); // not guaranteed if PSWIPENUMBER + auto PWORKSPACER = g_pCompositor->getWorkspaceByID(workspaceIDRight); // not guaranteed if PSWIPENEW || PSWIPENUMBER + auto PWORKSPACEL = g_pCompositor->getWorkspaceByID(workspaceIDLeft); // not guaranteed if PSWIPENUMBER - const auto RENDEROFFSETMIDDLE = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.vec(); - const auto XDISTANCE = m_sActiveSwipe.pMonitor->vecSize.x + *PWORKSPACEGAP; - const auto YDISTANCE = m_sActiveSwipe.pMonitor->vecSize.y + *PWORKSPACEGAP; + const auto RENDEROFFSETMIDDLE = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.vec(); + const auto XDISTANCE = m_sActiveSwipe.pMonitor->vecSize.x + *PWORKSPACEGAP; + const auto YDISTANCE = m_sActiveSwipe.pMonitor->vecSize.y + *PWORKSPACEGAP; 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 PWORKSPACEGAP = &g_pConfigManager->getConfigValuePtr("general:gaps_workspaces")->intValue; - const auto XDISTANCE = m_sActiveSwipe.pMonitor->vecSize.x + *PWORKSPACEGAP; - const auto YDISTANCE = m_sActiveSwipe.pMonitor->vecSize.y + *PWORKSPACEGAP; - const bool VERTANIMS = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle == "slidevert" || + const auto XDISTANCE = m_sActiveSwipe.pMonitor->vecSize.x + *PWORKSPACEGAP; + const auto YDISTANCE = m_sActiveSwipe.pMonitor->vecSize.y + *PWORKSPACEGAP; + 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.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); if (VERTANIMS) - 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 - 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(m_sActiveSwipe.pWorkspaceBegin->m_iID); return; @@ -277,15 +275,11 @@ void CInputManager::onSwipeUpdate(wlr_pointer_swipe_update_event* e) { } if (VERTANIMS) { - PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D( - 0, ((-m_sActiveSwipe.delta) / *PSWIPEDIST) * YDISTANCE - YDISTANCE)); - m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp( - Vector2D(0, ((-m_sActiveSwipe.delta) / *PSWIPEDIST) * YDISTANCE)); + PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D(0, ((-m_sActiveSwipe.delta) / *PSWIPEDIST) * YDISTANCE - YDISTANCE)); + m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(0, ((-m_sActiveSwipe.delta) / *PSWIPEDIST) * YDISTANCE)); } else { - PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D( - ((-m_sActiveSwipe.delta) / *PSWIPEDIST) * XDISTANCE - XDISTANCE, 0)); - m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp( - Vector2D(((-m_sActiveSwipe.delta) / *PSWIPEDIST) * XDISTANCE, 0)); + PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / *PSWIPEDIST) * XDISTANCE - XDISTANCE, 0)); + m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / *PSWIPEDIST) * XDISTANCE, 0)); } g_pCompositor->updateWorkspaceWindowDecos(workspaceIDLeft); @@ -297,11 +291,9 @@ void CInputManager::onSwipeUpdate(wlr_pointer_swipe_update_event* e) { g_pHyprRenderer->damageMonitor(m_sActiveSwipe.pMonitor); if (VERTANIMS) - 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 - 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(m_sActiveSwipe.pWorkspaceBegin->m_iID); return; @@ -323,15 +315,11 @@ void CInputManager::onSwipeUpdate(wlr_pointer_swipe_update_event* e) { } if (VERTANIMS) { - PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D( - 0, ((-m_sActiveSwipe.delta) / *PSWIPEDIST) * YDISTANCE + YDISTANCE)); - m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp( - Vector2D(0, ((-m_sActiveSwipe.delta) / *PSWIPEDIST) * YDISTANCE)); + PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D(0, ((-m_sActiveSwipe.delta) / *PSWIPEDIST) * YDISTANCE + YDISTANCE)); + m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(0, ((-m_sActiveSwipe.delta) / *PSWIPEDIST) * YDISTANCE)); } else { - PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D( - ((-m_sActiveSwipe.delta) / *PSWIPEDIST) * XDISTANCE + XDISTANCE, 0)); - m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp( - Vector2D(((-m_sActiveSwipe.delta) / *PSWIPEDIST) * XDISTANCE, 0)); + PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / *PSWIPEDIST) * XDISTANCE + XDISTANCE, 0)); + m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / *PSWIPEDIST) * XDISTANCE, 0)); } g_pCompositor->updateWorkspaceWindowDecos(workspaceIDRight); diff --git a/src/plugins/HookSystem.hpp b/src/plugins/HookSystem.hpp index b871a379..00494733 100644 --- a/src/plugins/HookSystem.hpp +++ b/src/plugins/HookSystem.hpp @@ -14,10 +14,10 @@ class CFunctionHook { bool hook(); bool unhook(); - CFunctionHook(const CFunctionHook&) = delete; - CFunctionHook(CFunctionHook&&) = delete; + CFunctionHook(const CFunctionHook&) = delete; + CFunctionHook(CFunctionHook&&) = delete; CFunctionHook& operator=(const CFunctionHook&) = delete; - CFunctionHook& operator=(CFunctionHook&&) = delete; + CFunctionHook& operator=(CFunctionHook&&) = delete; void* m_pOriginal = nullptr; diff --git a/src/protocols/FractionalScale.cpp b/src/protocols/FractionalScale.cpp index f284dd0d..86b5afbc 100644 --- a/src/protocols/FractionalScale.cpp +++ b/src/protocols/FractionalScale.cpp @@ -53,7 +53,9 @@ void CFractionalScaleProtocolManager::bindManager(wl_client* client, void* data, 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) { diff --git a/src/protocols/Screencopy.hpp b/src/protocols/Screencopy.hpp index e3d1e22a..0c709c7b 100644 --- a/src/protocols/Screencopy.hpp +++ b/src/protocols/Screencopy.hpp @@ -10,8 +10,7 @@ class CMonitor; -enum eClientOwners -{ +enum eClientOwners { CLIENT_SCREENCOPY = 0, CLIENT_TOPLEVEL_EXPORT }; diff --git a/src/render/OpenGL.hpp b/src/render/OpenGL.hpp index 01e05af1..cd52fe3e 100644 --- a/src/render/OpenGL.hpp +++ b/src/render/OpenGL.hpp @@ -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}; -enum eDiscardMode -{ +enum eDiscardMode { DISCARD_OPAQUE = 1, DISCARD_ALPHA = 1 << 1 }; diff --git a/src/render/Renderer.hpp b/src/render/Renderer.hpp index aaafa257..a832802e 100644 --- a/src/render/Renderer.hpp +++ b/src/render/Renderer.hpp @@ -13,23 +13,20 @@ struct SMonitorRule; // TODO: add fuller damage tracking for updating only parts of a window -enum DAMAGETRACKINGMODES -{ +enum DAMAGETRACKINGMODES { DAMAGE_TRACKING_INVALID = -1, DAMAGE_TRACKING_NONE = 0, DAMAGE_TRACKING_MONITOR, DAMAGE_TRACKING_FULL }; -enum eRenderPassMode -{ +enum eRenderPassMode { RENDER_PASS_ALL = 0, RENDER_PASS_MAIN, RENDER_PASS_POPUP }; -enum eRenderMode -{ +enum eRenderMode { RENDER_MODE_NORMAL = 0, RENDER_MODE_FULL_FAKE = 1, RENDER_MODE_TO_BUFFER = 2, diff --git a/src/render/Texture.hpp b/src/render/Texture.hpp index f287089b..93a6aa5f 100644 --- a/src/render/Texture.hpp +++ b/src/render/Texture.hpp @@ -2,8 +2,7 @@ #include "../defines.hpp" -enum TEXTURETYPE -{ +enum TEXTURETYPE { TEXTURE_INVALID, // Invalid TEXTURE_RGBA, // 4 channels TEXTURE_RGBX, // discard A diff --git a/src/render/decorations/DecorationPositioner.hpp b/src/render/decorations/DecorationPositioner.hpp index 740b4efe..140ecace 100644 --- a/src/render/decorations/DecorationPositioner.hpp +++ b/src/render/decorations/DecorationPositioner.hpp @@ -9,14 +9,12 @@ class CWindow; class IHyprWindowDecoration; -enum eDecorationPositioningPolicy -{ +enum eDecorationPositioningPolicy { DECORATION_POSITION_ABSOLUTE = 0, /* Decoration wants absolute positioning */ DECORATION_POSITION_STICKY, /* Decoration is stuck to some edge of a window */ }; -enum eDecorationEdges -{ +enum eDecorationEdges { DECORATION_EDGE_TOP = 1 << 0, DECORATION_EDGE_BOTTOM = 1 << 1, DECORATION_EDGE_LEFT = 1 << 2, diff --git a/src/render/decorations/IHyprWindowDecoration.hpp b/src/render/decorations/IHyprWindowDecoration.hpp index c411a4d9..15b00536 100644 --- a/src/render/decorations/IHyprWindowDecoration.hpp +++ b/src/render/decorations/IHyprWindowDecoration.hpp @@ -4,24 +4,21 @@ #include "../../helpers/Region.hpp" #include "DecorationPositioner.hpp" -enum eDecorationType -{ +enum eDecorationType { DECORATION_NONE = -1, DECORATION_GROUPBAR, DECORATION_SHADOW, DECORATION_CUSTOM }; -enum eDecorationLayer -{ +enum eDecorationLayer { DECORATION_LAYER_BOTTOM = 0, /* lowest. */ DECORATION_LAYER_UNDER, /* under the window, but above BOTTOM */ DECORATION_LAYER_OVER, /* above the window, but below its 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_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 */