diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2024-12-07 18:51:18 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-07 18:51:18 +0100 |
| commit | 8bbeee11734d3ba8e2cf15d19cb3c302f8bfdbf2 (patch) | |
| tree | 5b6654818049a0743f62defc090e86d4327cccbb /src/render | |
| parent | b1e5cc66bdb20b002c93479490c3a317552210b3 (diff) | |
core: Add clang-tidy (#8664)
This adds a .clang-tidy file for us.
It's not a strict requirement to be compliant, but I tuned it to be alright.
Diffstat (limited to 'src/render')
| -rw-r--r-- | src/render/Framebuffer.cpp | 10 | ||||
| -rw-r--r-- | src/render/OpenGL.cpp | 21 | ||||
| -rw-r--r-- | src/render/OpenGL.hpp | 4 | ||||
| -rw-r--r-- | src/render/Renderer.cpp | 28 | ||||
| -rw-r--r-- | src/render/Renderer.hpp | 20 | ||||
| -rw-r--r-- | src/render/Texture.cpp | 12 | ||||
| -rw-r--r-- | src/render/Texture.hpp | 13 | ||||
| -rw-r--r-- | src/render/Transformer.hpp | 2 | ||||
| -rw-r--r-- | src/render/decorations/CHyprBorderDecoration.cpp | 4 | ||||
| -rw-r--r-- | src/render/decorations/CHyprDropShadowDecoration.cpp | 6 | ||||
| -rw-r--r-- | src/render/decorations/CHyprGroupBarDecoration.cpp | 5 | ||||
| -rw-r--r-- | src/render/decorations/DecorationPositioner.cpp | 7 | ||||
| -rw-r--r-- | src/render/decorations/DecorationPositioner.hpp | 4 | ||||
| -rw-r--r-- | src/render/decorations/IHyprWindowDecoration.cpp | 6 | ||||
| -rw-r--r-- | src/render/decorations/IHyprWindowDecoration.hpp | 6 |
15 files changed, 61 insertions, 87 deletions
diff --git a/src/render/Framebuffer.cpp b/src/render/Framebuffer.cpp index bf75d414..93f8fe7f 100644 --- a/src/render/Framebuffer.cpp +++ b/src/render/Framebuffer.cpp @@ -9,8 +9,8 @@ bool CFramebuffer::alloc(int w, int h, uint32_t drmFormat) { bool firstAlloc = false; RASSERT((w > 1 && h > 1), "cannot alloc a FB with negative / zero size! (attempted {}x{})", w, h); - uint32_t glFormat = FormatUtils::drmFormatToGL(drmFormat); - uint32_t glType = FormatUtils::glFormatToType(glFormat); + uint32_t glFormat = NFormatUtils::drmFormatToGL(drmFormat); + uint32_t glType = NFormatUtils::glFormatToType(glFormat); if (!m_cTex) m_cTex = makeShared<CTexture>(); @@ -33,7 +33,7 @@ bool CFramebuffer::alloc(int w, int h, uint32_t drmFormat) { if (firstAlloc || m_vSize != Vector2D(w, h)) { glBindTexture(GL_TEXTURE_2D, m_cTex->m_iTexID); - glTexImage2D(GL_TEXTURE_2D, 0, glFormat, w, h, 0, GL_RGBA, glType, 0); + glTexImage2D(GL_TEXTURE_2D, 0, glFormat, w, h, 0, GL_RGBA, glType, nullptr); glBindFramebuffer(GL_FRAMEBUFFER, m_iFb); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_cTex->m_iTexID, 0); @@ -42,7 +42,7 @@ bool CFramebuffer::alloc(int w, int h, uint32_t drmFormat) { #ifndef GLES2 if (m_pStencilTex) { glBindTexture(GL_TEXTURE_2D, m_pStencilTex->m_iTexID); - glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8, w, h, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, 0); + glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8, w, h, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, nullptr); glBindFramebuffer(GL_FRAMEBUFFER, m_iFb); @@ -70,7 +70,7 @@ void CFramebuffer::addStencil(SP<CTexture> tex) { #ifndef GLES2 m_pStencilTex = tex; glBindTexture(GL_TEXTURE_2D, m_pStencilTex->m_iTexID); - glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8, m_vSize.x, m_vSize.y, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, 0); + glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8, m_vSize.x, m_vSize.y, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, nullptr); glBindFramebuffer(GL_FRAMEBUFFER, m_iFb); diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index 9b878317..e70c5c4e 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -23,14 +23,14 @@ const std::vector<const char*> ASSET_PATHS = { inline void loadGLProc(void* pProc, const char* name) { void* proc = (void*)eglGetProcAddress(name); - if (proc == NULL) { + if (proc == nullptr) { Debug::log(CRIT, "[Tracy GPU Profiling] eglGetProcAddress({}) failed", name); abort(); } *(void**)pProc = proc; } -static enum LogLevel eglLogToLevel(EGLint type) { +static enum eLogLevel eglLogToLevel(EGLint type) { switch (type) { case EGL_DEBUG_MSG_CRITICAL_KHR: return CRIT; case EGL_DEBUG_MSG_ERROR_KHR: return ERR; @@ -238,13 +238,11 @@ EGLDeviceEXT CHyprOpenGLImpl::eglDeviceFromDRMFD(int drmFD) { return EGL_NO_DEVICE_EXT; } -CHyprOpenGLImpl::CHyprOpenGLImpl() { +CHyprOpenGLImpl::CHyprOpenGLImpl() : m_iDRMFD(g_pCompositor->m_iDRMFD) { const std::string EGLEXTENSIONS = (const char*)eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS); Debug::log(LOG, "Supported EGL extensions: ({}) {}", std::count(EGLEXTENSIONS.begin(), EGLEXTENSIONS.end(), ' '), EGLEXTENSIONS); - m_iDRMFD = g_pCompositor->m_iDRMFD; - m_sExts.KHR_display_reference = EGLEXTENSIONS.contains("KHR_display_reference"); loadGLProc(&m_sProc.glEGLImageTargetRenderbufferStorageOES, "glEGLImageTargetRenderbufferStorageOES"); @@ -578,16 +576,15 @@ GLuint CHyprOpenGLImpl::createProgram(const std::string& vert, const std::string if (dynamic) { if (vertCompiled == 0) return 0; - } else { - RASSERT(vertCompiled, "Compiling shader failed. VERTEX NULL! Shader source:\n\n{}", vert.c_str()); - } + } else + RASSERT(vertCompiled, "Compiling shader failed. VERTEX nullptr! Shader source:\n\n{}", vert); auto fragCompiled = compileShader(GL_FRAGMENT_SHADER, frag, dynamic); if (dynamic) { if (fragCompiled == 0) return 0; } else { - RASSERT(fragCompiled, "Compiling shader failed. FRAGMENT NULL! Shader source:\n\n{}", frag.c_str()); + RASSERT(fragCompiled, "Compiling shader failed. FRAGMENT nullptr! Shader source:\n\n{}", frag.c_str()); } auto prog = glCreateProgram(); @@ -1380,7 +1377,7 @@ void CHyprOpenGLImpl::renderTextureWithDamage(SP<CTexture> tex, CBox* pBox, CReg void CHyprOpenGLImpl::renderTextureInternalWithDamage(SP<CTexture> tex, CBox* pBox, float alpha, CRegion* damage, int round, bool discardActive, bool noAA, bool allowCustomUV, bool allowDim, SP<CSyncTimeline> waitTimeline, uint64_t waitPoint) { RASSERT(m_RenderData.pMonitor, "Tried to render texture without begin()!"); - RASSERT((tex->m_iTexID > 0), "Attempted to draw NULL texture!"); + RASSERT((tex->m_iTexID > 0), "Attempted to draw nullptr texture!"); TRACY_GPU_ZONE("RenderTextureInternalWithDamage"); @@ -1558,7 +1555,7 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(SP<CTexture> tex, CBox* pB void CHyprOpenGLImpl::renderTexturePrimitive(SP<CTexture> tex, CBox* pBox) { RASSERT(m_RenderData.pMonitor, "Tried to render texture without begin()!"); - RASSERT((tex->m_iTexID > 0), "Attempted to draw NULL texture!"); + RASSERT((tex->m_iTexID > 0), "Attempted to draw nullptr texture!"); TRACY_GPU_ZONE("RenderTexturePrimitive"); @@ -1609,7 +1606,7 @@ void CHyprOpenGLImpl::renderTexturePrimitive(SP<CTexture> tex, CBox* pBox) { void CHyprOpenGLImpl::renderTextureMatte(SP<CTexture> tex, CBox* pBox, CFramebuffer& matte) { RASSERT(m_RenderData.pMonitor, "Tried to render texture without begin()!"); - RASSERT((tex->m_iTexID > 0), "Attempted to draw NULL texture!"); + RASSERT((tex->m_iTexID > 0), "Attempted to draw nullptr texture!"); TRACY_GPU_ZONE("RenderTextureMatte"); diff --git a/src/render/OpenGL.hpp b/src/render/OpenGL.hpp index 6c0632dd..51f38708 100644 --- a/src/render/OpenGL.hpp +++ b/src/render/OpenGL.hpp @@ -38,13 +38,13 @@ 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 : uint8_t { DISCARD_OPAQUE = 1, DISCARD_ALPHA = 1 << 1 }; struct SRenderModifData { - enum eRenderModifType { + enum eRenderModifType : uint8_t { RMOD_TYPE_SCALE, /* scale by a float */ RMOD_TYPE_SCALECENTER, /* scale by a float from the center */ RMOD_TYPE_TRANSLATE, /* translate by a Vector2D */ diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 180d6c99..4edd5a0c 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -896,9 +896,9 @@ void CHyprRenderer::renderAllClientsForWorkspace(PHLMONITOR pMonitor, PHLWORKSPA SRenderModifData RENDERMODIFDATA; if (translate != Vector2D{0, 0}) - RENDERMODIFDATA.modifs.push_back({SRenderModifData::eRenderModifType::RMOD_TYPE_TRANSLATE, translate}); + RENDERMODIFDATA.modifs.emplace_back(std::make_pair<>(SRenderModifData::eRenderModifType::RMOD_TYPE_TRANSLATE, translate)); if (scale != 1.f) - RENDERMODIFDATA.modifs.push_back({SRenderModifData::eRenderModifType::RMOD_TYPE_SCALE, scale}); + RENDERMODIFDATA.modifs.emplace_back(std::make_pair<>(SRenderModifData::eRenderModifType::RMOD_TYPE_SCALE, scale)); if (!pMonitor) return; @@ -1652,7 +1652,7 @@ static void applyExclusive(CBox& usableArea, uint32_t anchor, int32_t exclusive, { .singular_anchor = ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM, .anchor_triplet = ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT | ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM, - .positive_axis = NULL, + .positive_axis = nullptr, .negative_axis = &usableArea.height, .margin = marginBottom, }, @@ -1668,7 +1668,7 @@ static void applyExclusive(CBox& usableArea, uint32_t anchor, int32_t exclusive, { .singular_anchor = ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT, .anchor_triplet = ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT | ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP | ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM, - .positive_axis = NULL, + .positive_axis = nullptr, .negative_axis = &usableArea.width, .margin = marginRight, }, @@ -1948,19 +1948,18 @@ void CHyprRenderer::damageMirrorsWith(PHLMONITOR pMonitor, const CRegion& pRegio for (auto const& mirror : pMonitor->mirrors) { // transform the damage here, so it won't get clipped by the monitor damage ring - auto monitor = mirror; - auto mirrored = pMonitor; + auto monitor = mirror; CRegion transformed{pRegion}; // we want to transform to the same box as in CHyprOpenGLImpl::renderMirrored - double scale = std::min(monitor->vecTransformedSize.x / mirrored->vecTransformedSize.x, monitor->vecTransformedSize.y / mirrored->vecTransformedSize.y); - CBox monbox = {0, 0, mirrored->vecTransformedSize.x * scale, mirrored->vecTransformedSize.y * scale}; + double scale = std::min(monitor->vecTransformedSize.x / pMonitor->vecTransformedSize.x, monitor->vecTransformedSize.y / pMonitor->vecTransformedSize.y); + CBox monbox = {0, 0, pMonitor->vecTransformedSize.x * scale, pMonitor->vecTransformedSize.y * scale}; monbox.x = (monitor->vecTransformedSize.x - monbox.w) / 2; monbox.y = (monitor->vecTransformedSize.y - monbox.h) / 2; transformed.scale(scale); - transformed.transform(wlTransformToHyprutils(mirrored->transform), mirrored->vecPixelSize.x * scale, mirrored->vecPixelSize.y * scale); + transformed.transform(wlTransformToHyprutils(pMonitor->transform), pMonitor->vecPixelSize.x * scale, pMonitor->vecPixelSize.y * scale); transformed.translate(Vector2D(monbox.x, monbox.y)); mirror->addDamage(&transformed); @@ -1973,17 +1972,6 @@ void CHyprRenderer::renderDragIcon(PHLMONITOR pMonitor, timespec* time) { PROTO::data->renderDND(pMonitor, time); } -DAMAGETRACKINGMODES CHyprRenderer::damageTrackingModeFromStr(const std::string& mode) { - if (mode == "full") - return DAMAGE_TRACKING_FULL; - if (mode == "monitor") - return DAMAGE_TRACKING_MONITOR; - if (mode == "none") - return DAMAGE_TRACKING_NONE; - - return DAMAGE_TRACKING_INVALID; -} - bool CHyprRenderer::applyMonitorRule(PHLMONITOR pMonitor, SMonitorRule* pMonitorRule, bool force) { static auto PDISABLESCALECHECKS = CConfigValue<Hyprlang::INT>("debug:disable_scale_checks"); diff --git a/src/render/Renderer.hpp b/src/render/Renderer.hpp index 4524008b..717a3285 100644 --- a/src/render/Renderer.hpp +++ b/src/render/Renderer.hpp @@ -15,21 +15,20 @@ class CInputPopup; class IHLBuffer; class CEventLoopTimer; -// TODO: add fuller damage tracking for updating only parts of a window -enum DAMAGETRACKINGMODES { +enum eDamageTrackingModes : int8_t { DAMAGE_TRACKING_INVALID = -1, DAMAGE_TRACKING_NONE = 0, DAMAGE_TRACKING_MONITOR, - DAMAGE_TRACKING_FULL + DAMAGE_TRACKING_FULL, }; -enum eRenderPassMode { +enum eRenderPassMode : uint8_t { RENDER_PASS_ALL = 0, RENDER_PASS_MAIN, RENDER_PASS_POPUP }; -enum eRenderMode { +enum eRenderMode : uint8_t { RENDER_MODE_NORMAL = 0, RENDER_MODE_FULL_FAKE = 1, RENDER_MODE_TO_BUFFER = 2, @@ -89,11 +88,8 @@ class CHyprRenderer { bool m_bBlockSurfaceFeedback = false; bool m_bRenderingSnapshot = false; - PHLMONITORREF m_pMostHzMonitor; - bool m_bDirectScanoutBlocked = false; - - DAMAGETRACKINGMODES - damageTrackingModeFromStr(const std::string&); + PHLMONITORREF m_pMostHzMonitor; + bool m_bDirectScanoutBlocked = false; void setSurfaceScanoutMode(SP<CWLSurfaceResource> surface, PHLMONITOR monitor); // nullptr monitor resets void initiateManualCrash(); @@ -108,8 +104,8 @@ class CHyprRenderer { std::vector<SP<CWLSurfaceResource>> explicitPresented; struct { - int hotspotX; - int hotspotY; + int hotspotX = 0; + int hotspotY = 0; std::optional<SP<CWLSurface>> surf; std::string name; } m_sLastCursorData; diff --git a/src/render/Texture.cpp b/src/render/Texture.cpp index 633f0212..95efb15e 100644 --- a/src/render/Texture.cpp +++ b/src/render/Texture.cpp @@ -5,9 +5,7 @@ #include "../helpers/Format.hpp" #include <cstring> -CTexture::CTexture() { - // naffin' -} +CTexture::CTexture() = default; CTexture::~CTexture() { if (!g_pCompositor || g_pCompositor->m_bIsShuttingDown || !g_pHyprRenderer) @@ -63,7 +61,7 @@ CTexture::CTexture(const SP<Aquamarine::IBuffer> buffer, bool keepDataCopy) : m_ void CTexture::createFromShm(uint32_t drmFormat, uint8_t* pixels, uint32_t stride, const Vector2D& size_) { g_pHyprRenderer->makeEGLCurrent(); - const auto format = FormatUtils::getPixelFormatFromDRM(drmFormat); + const auto format = NFormatUtils::getPixelFormatFromDRM(drmFormat); ASSERT(format); m_iType = format->withAlpha ? TEXTURE_RGBA : TEXTURE_RGBX; @@ -96,11 +94,11 @@ void CTexture::createFromDma(const Aquamarine::SDMABUFAttrs& attrs, void* image) return; } - m_bOpaque = FormatUtils::isFormatOpaque(attrs.format); + m_bOpaque = NFormatUtils::isFormatOpaque(attrs.format); m_iTarget = GL_TEXTURE_2D; m_iType = TEXTURE_RGBA; m_vSize = attrs.size; - m_iType = FormatUtils::isFormatOpaque(attrs.format) ? TEXTURE_RGBX : TEXTURE_RGBA; + m_iType = NFormatUtils::isFormatOpaque(attrs.format) ? TEXTURE_RGBX : TEXTURE_RGBA; allocate(); m_pEglImage = image; @@ -114,7 +112,7 @@ void CTexture::createFromDma(const Aquamarine::SDMABUFAttrs& attrs, void* image) void CTexture::update(uint32_t drmFormat, uint8_t* pixels, uint32_t stride, const CRegion& damage) { g_pHyprRenderer->makeEGLCurrent(); - const auto format = FormatUtils::getPixelFormatFromDRM(drmFormat); + const auto format = NFormatUtils::getPixelFormatFromDRM(drmFormat); ASSERT(format); glBindTexture(GL_TEXTURE_2D, m_iTexID); diff --git a/src/render/Texture.hpp b/src/render/Texture.hpp index ae949d5f..60134707 100644 --- a/src/render/Texture.hpp +++ b/src/render/Texture.hpp @@ -6,13 +6,12 @@ class IHLBuffer; HYPRUTILS_FORWARD(Math, CRegion); -using namespace Hyprutils::Math; -enum TEXTURETYPE { - TEXTURE_INVALID, // Invalid - TEXTURE_RGBA, // 4 channels - TEXTURE_RGBX, // discard A - TEXTURE_EXTERNAL, // EGLImage +enum eTextureType : int8_t { + TEXTURE_INVALID = -1, // Invalid + TEXTURE_RGBA = 0, // 4 channels + TEXTURE_RGBX, // discard A + TEXTURE_EXTERNAL, // EGLImage }; class CTexture { @@ -36,7 +35,7 @@ class CTexture { void update(uint32_t drmFormat, uint8_t* pixels, uint32_t stride, const CRegion& damage); const std::vector<uint8_t>& dataCopy(); - TEXTURETYPE m_iType = TEXTURE_RGBA; + eTextureType m_iType = TEXTURE_RGBA; GLenum m_iTarget = GL_TEXTURE_2D; GLuint m_iTexID = 0; Vector2D m_vSize = {}; diff --git a/src/render/Transformer.hpp b/src/render/Transformer.hpp index 90fdeba9..c54da4dd 100644 --- a/src/render/Transformer.hpp +++ b/src/render/Transformer.hpp @@ -11,6 +11,8 @@ struct SRenderData; // Worth noting transformers for now only affect the main pass (not popups) class IWindowTransformer { public: + virtual ~IWindowTransformer() = default; + // called by Hyprland. For more data about what is being rendered, inspect render data. // returns the out fb. virtual CFramebuffer* transform(CFramebuffer* in) = 0; diff --git a/src/render/decorations/CHyprBorderDecoration.cpp b/src/render/decorations/CHyprBorderDecoration.cpp index b0de4a64..93490f31 100644 --- a/src/render/decorations/CHyprBorderDecoration.cpp +++ b/src/render/decorations/CHyprBorderDecoration.cpp @@ -3,8 +3,8 @@ #include "../../config/ConfigValue.hpp" #include "../../managers/eventLoop/EventLoopManager.hpp" -CHyprBorderDecoration::CHyprBorderDecoration(PHLWINDOW pWindow) : IHyprWindowDecoration(pWindow) { - m_pWindow = pWindow; +CHyprBorderDecoration::CHyprBorderDecoration(PHLWINDOW pWindow) : IHyprWindowDecoration(pWindow), m_pWindow(pWindow) { + ; } CHyprBorderDecoration::~CHyprBorderDecoration() { diff --git a/src/render/decorations/CHyprDropShadowDecoration.cpp b/src/render/decorations/CHyprDropShadowDecoration.cpp index 39398878..38ced9af 100644 --- a/src/render/decorations/CHyprDropShadowDecoration.cpp +++ b/src/render/decorations/CHyprDropShadowDecoration.cpp @@ -3,11 +3,11 @@ #include "../../Compositor.hpp" #include "../../config/ConfigValue.hpp" -CHyprDropShadowDecoration::CHyprDropShadowDecoration(PHLWINDOW pWindow) : IHyprWindowDecoration(pWindow) { - m_pWindow = pWindow; +CHyprDropShadowDecoration::CHyprDropShadowDecoration(PHLWINDOW pWindow) : IHyprWindowDecoration(pWindow), m_pWindow(pWindow) { + ; } -CHyprDropShadowDecoration::~CHyprDropShadowDecoration() {} +CHyprDropShadowDecoration::~CHyprDropShadowDecoration() = default; eDecorationType CHyprDropShadowDecoration::getDecorationType() { return DECORATION_SHADOW; diff --git a/src/render/decorations/CHyprGroupBarDecoration.cpp b/src/render/decorations/CHyprGroupBarDecoration.cpp index 937c913d..3138c326 100644 --- a/src/render/decorations/CHyprGroupBarDecoration.cpp +++ b/src/render/decorations/CHyprGroupBarDecoration.cpp @@ -17,16 +17,15 @@ constexpr int BAR_PADDING_OUTER_HORZ = 2; constexpr int BAR_TEXT_PAD = 2; constexpr int BAR_HORIZONTAL_PADDING = 2; -CHyprGroupBarDecoration::CHyprGroupBarDecoration(PHLWINDOW pWindow) : IHyprWindowDecoration(pWindow) { +CHyprGroupBarDecoration::CHyprGroupBarDecoration(PHLWINDOW pWindow) : IHyprWindowDecoration(pWindow), m_pWindow(pWindow) { static auto PGRADIENTS = CConfigValue<Hyprlang::INT>("group:groupbar:enabled"); static auto PENABLED = CConfigValue<Hyprlang::INT>("group:groupbar:gradients"); - m_pWindow = pWindow; if (m_tGradientActive->m_iTexID == 0 && *PENABLED && *PGRADIENTS) refreshGroupBarGradients(); } -CHyprGroupBarDecoration::~CHyprGroupBarDecoration() {} +CHyprGroupBarDecoration::~CHyprGroupBarDecoration() = default; SDecorationPositioningInfo CHyprGroupBarDecoration::getPositioningInfo() { static auto PHEIGHT = CConfigValue<Hyprlang::INT>("group:groupbar:height"); diff --git a/src/render/decorations/DecorationPositioner.cpp b/src/render/decorations/DecorationPositioner.cpp index 995283c6..6a41cbdc 100644 --- a/src/render/decorations/DecorationPositioner.cpp +++ b/src/render/decorations/DecorationPositioner.cpp @@ -85,12 +85,7 @@ CDecorationPositioner::SWindowPositioningData* CDecorationPositioner::getDataFor } void CDecorationPositioner::sanitizeDatas() { - std::erase_if(m_mWindowDatas, [](const auto& other) { - if (!valid(other.first)) - return true; - - return false; - }); + std::erase_if(m_mWindowDatas, [](const auto& other) { return !valid(other.first); }); std::erase_if(m_vWindowPositioningDatas, [](const auto& other) { if (!validMapped(other->pWindow)) return true; diff --git a/src/render/decorations/DecorationPositioner.hpp b/src/render/decorations/DecorationPositioner.hpp index 27e56f0b..c2d69881 100644 --- a/src/render/decorations/DecorationPositioner.hpp +++ b/src/render/decorations/DecorationPositioner.hpp @@ -9,12 +9,12 @@ class CWindow; class IHyprWindowDecoration; -enum eDecorationPositioningPolicy { +enum eDecorationPositioningPolicy : uint8_t { DECORATION_POSITION_ABSOLUTE = 0, /* Decoration wants absolute positioning */ DECORATION_POSITION_STICKY, /* Decoration is stuck to some edge of a window */ }; -enum eDecorationEdges { +enum eDecorationEdges : uint8_t { DECORATION_EDGE_TOP = 1 << 0, DECORATION_EDGE_BOTTOM = 1 << 1, DECORATION_EDGE_LEFT = 1 << 2, diff --git a/src/render/decorations/IHyprWindowDecoration.cpp b/src/render/decorations/IHyprWindowDecoration.cpp index f3736b2d..cb9e166b 100644 --- a/src/render/decorations/IHyprWindowDecoration.cpp +++ b/src/render/decorations/IHyprWindowDecoration.cpp @@ -2,11 +2,11 @@ class CWindow; -IHyprWindowDecoration::IHyprWindowDecoration(PHLWINDOW pWindow) { - m_pWindow = pWindow; +IHyprWindowDecoration::IHyprWindowDecoration(PHLWINDOW pWindow) : m_pWindow(pWindow) { + ; } -IHyprWindowDecoration::~IHyprWindowDecoration() {} +IHyprWindowDecoration::~IHyprWindowDecoration() = default; bool IHyprWindowDecoration::onInputOnDeco(const eInputType, const Vector2D&, std::any) { return false; diff --git a/src/render/decorations/IHyprWindowDecoration.hpp b/src/render/decorations/IHyprWindowDecoration.hpp index d6d57902..10145f40 100644 --- a/src/render/decorations/IHyprWindowDecoration.hpp +++ b/src/render/decorations/IHyprWindowDecoration.hpp @@ -5,7 +5,7 @@ #include "../../helpers/math/Math.hpp" #include "DecorationPositioner.hpp" -enum eDecorationType { +enum eDecorationType : int8_t { DECORATION_NONE = -1, DECORATION_GROUPBAR, DECORATION_SHADOW, @@ -13,14 +13,14 @@ enum eDecorationType { DECORATION_CUSTOM }; -enum eDecorationLayer { +enum eDecorationLayer : uint8_t { 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 : uint8_t { 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 */ |
