From 91e1fc978d67f5ff8b62f26b4e96aa43c946a8c2 Mon Sep 17 00:00:00 2001 From: Micovec Date: Mon, 8 Jan 2024 16:49:24 +0100 Subject: [PATCH] formated files --- src/Window.cpp | 2 +- src/config/ConfigManager.cpp | 2 +- src/helpers/MiscFunctions.cpp | 8 ++++---- src/render/OpenGL.cpp | 11 ++++++----- src/render/Renderer.cpp | 8 ++++---- src/render/decorations/CHyprBorderDecoration.cpp | 2 +- src/render/decorations/CHyprDropShadowDecoration.cpp | 4 ++-- 7 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/Window.cpp b/src/Window.cpp index 53dd0c8d..13885409 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -994,7 +994,7 @@ bool CWindow::opaque() { CCornerRadiiData CWindow::getCornerRadii() { static auto* const PRADII = (CCornerRadiiData*)g_pConfigManager->getConfigValuePtr("decoration:rounding")->data.get(); - CCornerRadiiData radii = m_sAdditionalConfigData.cornerRadii.toUnderlying() == -1 ? *PRADII : m_sAdditionalConfigData.cornerRadii.toUnderlying(); + CCornerRadiiData radii = m_sAdditionalConfigData.cornerRadii.toUnderlying() == -1 ? *PRADII : m_sAdditionalConfigData.cornerRadii.toUnderlying(); return m_sSpecialRenderData.rounding ? radii : 0; } diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index dc5a035b..075c64ca 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -547,7 +547,7 @@ void CConfigManager::configSetValueSafe(const std::string& COMMAND, const std::s } case CVD_TYPE_CORNER_RADII: { CCornerRadiiData* data = static_cast(CONFIGENTRY->data.get()); - + try { *data = configStringToRadii(VALUE); } catch (std::exception& e) { diff --git a/src/helpers/MiscFunctions.cpp b/src/helpers/MiscFunctions.cpp index 21a022dc..812b6bc6 100644 --- a/src/helpers/MiscFunctions.cpp +++ b/src/helpers/MiscFunctions.cpp @@ -716,16 +716,16 @@ int64_t configStringToInt(const std::string& VALUE) { } CCornerRadiiData configStringToRadii(const std::string& VALUE) { - CVarList vars(VALUE); + CVarList vars(VALUE); CCornerRadiiData radii; if (vars.size() == 1) { radii.reset(std::stoi(vars[0])); } else if (vars.size() == 4) { - radii.topLeft = std::stoi(vars[0]); - radii.topRight = std::stoi(vars[1]); + radii.topLeft = std::stoi(vars[0]); + radii.topRight = std::stoi(vars[1]); radii.bottomRight = std::stoi(vars[2]); - radii.bottomLeft = std::stoi(vars[3]); + radii.bottomLeft = std::stoi(vars[3]); } else { throw std::invalid_argument("not enough or too many values (1 or 4 separated by comma)"); } diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index aeea76c3..b4d2b0e9 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -447,9 +447,9 @@ void CHyprOpenGLImpl::initShaders() { m_RenderData.pCurrentMonData->m_shSHADOW.posAttrib = glGetAttribLocation(prog, "pos"); m_RenderData.pCurrentMonData->m_shSHADOW.texAttrib = glGetAttribLocation(prog, "texcoord"); m_RenderData.pCurrentMonData->m_shSHADOW.topLeft = glGetUniformLocation(prog, "topLeft"); - m_RenderData.pCurrentMonData->m_shSHADOW.topRight = glGetUniformLocation(prog, "topRight"); + m_RenderData.pCurrentMonData->m_shSHADOW.topRight = glGetUniformLocation(prog, "topRight"); m_RenderData.pCurrentMonData->m_shSHADOW.bottomRight = glGetUniformLocation(prog, "bottomRight"); - m_RenderData.pCurrentMonData->m_shSHADOW.bottomLeft = glGetUniformLocation(prog, "bottomLeft"); + m_RenderData.pCurrentMonData->m_shSHADOW.bottomLeft = glGetUniformLocation(prog, "bottomLeft"); m_RenderData.pCurrentMonData->m_shSHADOW.fullSize = glGetUniformLocation(prog, "fullSize"); m_RenderData.pCurrentMonData->m_shSHADOW.cornerRadii = glGetUniformLocation(prog, "cornerRadii"); m_RenderData.pCurrentMonData->m_shSHADOW.range = glGetUniformLocation(prog, "range"); @@ -714,8 +714,8 @@ void CHyprOpenGLImpl::renderTexture(const CTexture& tex, CBox* pBox, float alpha scissor((CBox*)nullptr); } -void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, CBox* pBox, float alpha, CRegion* damage, CCornerRadiiData radii, bool discardActive, bool noAA, bool allowCustomUV, - bool allowDim) { +void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, CBox* pBox, float alpha, CRegion* damage, CCornerRadiiData radii, bool discardActive, bool noAA, + bool allowCustomUV, bool allowDim) { RASSERT(m_RenderData.pMonitor, "Tried to render texture without begin()!"); RASSERT((tex.m_iTexID > 0), "Attempted to draw NULL texture!"); @@ -1535,7 +1535,8 @@ void CHyprOpenGLImpl::renderBorder(CBox* box, const CGradientValueData& grad, CC glUniform4f(m_RenderData.pCurrentMonData->m_shBORDER1.cornerRadii, radii.topLeft, radii.topRight, radii.bottomRight, radii.bottomLeft); CCornerRadiiData actualOuterRadii = outerRadii == -1 ? radii : outerRadii; - glUniform4f(m_RenderData.pCurrentMonData->m_shBORDER1.cornerRadiiOuter, actualOuterRadii.topLeft, actualOuterRadii.topRight, actualOuterRadii.bottomRight, actualOuterRadii.bottomLeft); + glUniform4f(m_RenderData.pCurrentMonData->m_shBORDER1.cornerRadiiOuter, actualOuterRadii.topLeft, actualOuterRadii.topRight, actualOuterRadii.bottomRight, + actualOuterRadii.bottomLeft); glUniform1f(m_RenderData.pCurrentMonData->m_shBORDER1.thick, scaledBorderSize); glVertexAttribPointer(m_RenderData.pCurrentMonData->m_shBORDER1.posAttrib, 2, GL_FLOAT, GL_FALSE, 0, fullVerts); diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 351a181d..6c2d0d72 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -2256,8 +2256,8 @@ void CHyprRenderer::setOccludedForMainWorkspace(CRegion& region, CWorkspace* pWo const auto RADII = w->getCornerRadii() * PMONITOR->scale; const int MINRADIUS = std::min(std::min(RADII.topLeft, RADII.topRight), std::min(RADII.bottomLeft, RADII.bottomRight)); - const Vector2D POS = w->m_vRealPosition.vec() + Vector2D{MINRADIUS, MINRADIUS} - PMONITOR->vecPosition + (w->m_bPinned ? Vector2D{} : pWorkspace->m_vRenderOffset.vec()); - const Vector2D SIZE = w->m_vRealSize.vec() - Vector2D{MINRADIUS * 2, MINRADIUS * 2}; + const Vector2D POS = w->m_vRealPosition.vec() + Vector2D{MINRADIUS, MINRADIUS} - PMONITOR->vecPosition + (w->m_bPinned ? Vector2D{} : pWorkspace->m_vRenderOffset.vec()); + const Vector2D SIZE = w->m_vRealSize.vec() - Vector2D{MINRADIUS * 2, MINRADIUS * 2}; CBox box = {POS.x, POS.y, SIZE.x, SIZE.y}; @@ -2283,8 +2283,8 @@ void CHyprRenderer::setOccludedForBackLayers(CRegion& region, CWorkspace* pWorks const auto RADII = w->getCornerRadii() * PMONITOR->scale; const int MINRADIUS = std::min(std::min(RADII.topLeft, RADII.topRight), std::min(RADII.bottomLeft, RADII.bottomRight)); - const Vector2D POS = w->m_vRealPosition.vec() + Vector2D{MINRADIUS, MINRADIUS} - PMONITOR->vecPosition + (w->m_bPinned ? Vector2D{} : pWorkspace->m_vRenderOffset.vec()); - const Vector2D SIZE = w->m_vRealSize.vec() - Vector2D{MINRADIUS * 2, MINRADIUS * 2}; + const Vector2D POS = w->m_vRealPosition.vec() + Vector2D{MINRADIUS, MINRADIUS} - PMONITOR->vecPosition + (w->m_bPinned ? Vector2D{} : pWorkspace->m_vRenderOffset.vec()); + const Vector2D SIZE = w->m_vRealSize.vec() - Vector2D{MINRADIUS * 2, MINRADIUS * 2}; CBox box = {POS.x, POS.y, SIZE.x, SIZE.y}; diff --git a/src/render/decorations/CHyprBorderDecoration.cpp b/src/render/decorations/CHyprBorderDecoration.cpp index 2f4d8529..5ece230c 100644 --- a/src/render/decorations/CHyprBorderDecoration.cpp +++ b/src/render/decorations/CHyprBorderDecoration.cpp @@ -66,7 +66,7 @@ void CHyprBorderDecoration::draw(CMonitor* pMonitor, float a, const Vector2D& of } int borderSize = m_pWindow->getRealBorderSize(); - const auto RADII = m_pWindow->getCornerRadii() * pMonitor->scale; + const auto RADII = m_pWindow->getCornerRadii() * pMonitor->scale; g_pHyprOpenGL->renderBorder(&windowBox, grad, RADII, borderSize, a1); diff --git a/src/render/decorations/CHyprDropShadowDecoration.cpp b/src/render/decorations/CHyprDropShadowDecoration.cpp index e8e42ac7..95ec62ca 100644 --- a/src/render/decorations/CHyprDropShadowDecoration.cpp +++ b/src/render/decorations/CHyprDropShadowDecoration.cpp @@ -79,8 +79,8 @@ void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a, const Vector2D if (*PSHADOWS != 1) return; // disabled - const auto RADIIBASE = m_pWindow->getCornerRadii(); - const auto RADII = RADIIBASE.topLeft > 0|| RADIIBASE.topRight > 0 || RADIIBASE.bottomRight > 0 || RADIIBASE.bottomLeft > 0 ? RADIIBASE + m_pWindow->getRealBorderSize() : 0; + const auto RADIIBASE = m_pWindow->getCornerRadii(); + const auto RADII = RADIIBASE.topLeft > 0 || RADIIBASE.topRight > 0 || RADIIBASE.bottomRight > 0 || RADIIBASE.bottomLeft > 0 ? RADIIBASE + m_pWindow->getRealBorderSize() : 0; const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(m_pWindow->m_iWorkspaceID); const auto WORKSPACEOFFSET = PWORKSPACE && !m_pWindow->m_bPinned ? PWORKSPACE->m_vRenderOffset.vec() : Vector2D();