formated files

This commit is contained in:
Micovec 2024-01-08 16:49:24 +01:00
parent e9a4a69fd8
commit 91e1fc978d
7 changed files with 19 additions and 18 deletions

View file

@ -994,7 +994,7 @@ bool CWindow::opaque() {
CCornerRadiiData CWindow::getCornerRadii() { CCornerRadiiData CWindow::getCornerRadii() {
static auto* const PRADII = (CCornerRadiiData*)g_pConfigManager->getConfigValuePtr("decoration:rounding")->data.get(); 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; return m_sSpecialRenderData.rounding ? radii : 0;
} }

View file

@ -716,16 +716,16 @@ int64_t configStringToInt(const std::string& VALUE) {
} }
CCornerRadiiData configStringToRadii(const std::string& VALUE) { CCornerRadiiData configStringToRadii(const std::string& VALUE) {
CVarList vars(VALUE); CVarList vars(VALUE);
CCornerRadiiData radii; CCornerRadiiData radii;
if (vars.size() == 1) { if (vars.size() == 1) {
radii.reset(std::stoi(vars[0])); radii.reset(std::stoi(vars[0]));
} else if (vars.size() == 4) { } else if (vars.size() == 4) {
radii.topLeft = std::stoi(vars[0]); radii.topLeft = std::stoi(vars[0]);
radii.topRight = std::stoi(vars[1]); radii.topRight = std::stoi(vars[1]);
radii.bottomRight = std::stoi(vars[2]); radii.bottomRight = std::stoi(vars[2]);
radii.bottomLeft = std::stoi(vars[3]); radii.bottomLeft = std::stoi(vars[3]);
} else { } else {
throw std::invalid_argument("not enough or too many values (1 or 4 separated by comma)"); throw std::invalid_argument("not enough or too many values (1 or 4 separated by comma)");
} }

View file

@ -447,9 +447,9 @@ void CHyprOpenGLImpl::initShaders() {
m_RenderData.pCurrentMonData->m_shSHADOW.posAttrib = glGetAttribLocation(prog, "pos"); m_RenderData.pCurrentMonData->m_shSHADOW.posAttrib = glGetAttribLocation(prog, "pos");
m_RenderData.pCurrentMonData->m_shSHADOW.texAttrib = glGetAttribLocation(prog, "texcoord"); m_RenderData.pCurrentMonData->m_shSHADOW.texAttrib = glGetAttribLocation(prog, "texcoord");
m_RenderData.pCurrentMonData->m_shSHADOW.topLeft = glGetUniformLocation(prog, "topLeft"); 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.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.fullSize = glGetUniformLocation(prog, "fullSize");
m_RenderData.pCurrentMonData->m_shSHADOW.cornerRadii = glGetUniformLocation(prog, "cornerRadii"); m_RenderData.pCurrentMonData->m_shSHADOW.cornerRadii = glGetUniformLocation(prog, "cornerRadii");
m_RenderData.pCurrentMonData->m_shSHADOW.range = glGetUniformLocation(prog, "range"); 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); scissor((CBox*)nullptr);
} }
void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, CBox* pBox, float alpha, CRegion* damage, CCornerRadiiData radii, bool discardActive, bool noAA, bool allowCustomUV, void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, CBox* pBox, float alpha, CRegion* damage, CCornerRadiiData radii, bool discardActive, bool noAA,
bool allowDim) { bool allowCustomUV, bool allowDim) {
RASSERT(m_RenderData.pMonitor, "Tried to render texture without begin()!"); 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 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); glUniform4f(m_RenderData.pCurrentMonData->m_shBORDER1.cornerRadii, radii.topLeft, radii.topRight, radii.bottomRight, radii.bottomLeft);
CCornerRadiiData actualOuterRadii = outerRadii == -1 ? radii : outerRadii; 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); glUniform1f(m_RenderData.pCurrentMonData->m_shBORDER1.thick, scaledBorderSize);
glVertexAttribPointer(m_RenderData.pCurrentMonData->m_shBORDER1.posAttrib, 2, GL_FLOAT, GL_FALSE, 0, fullVerts); glVertexAttribPointer(m_RenderData.pCurrentMonData->m_shBORDER1.posAttrib, 2, GL_FLOAT, GL_FALSE, 0, fullVerts);

View file

@ -2256,8 +2256,8 @@ void CHyprRenderer::setOccludedForMainWorkspace(CRegion& region, CWorkspace* pWo
const auto RADII = w->getCornerRadii() * PMONITOR->scale; 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 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 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 SIZE = w->m_vRealSize.vec() - Vector2D{MINRADIUS * 2, MINRADIUS * 2};
CBox box = {POS.x, POS.y, SIZE.x, SIZE.y}; 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 auto RADII = w->getCornerRadii() * PMONITOR->scale;
const int MINRADIUS = std::min(std::min(RADII.topLeft, RADII.topRight), std::min(RADII.bottomLeft, RADII.bottomRight)); 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 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 SIZE = w->m_vRealSize.vec() - Vector2D{MINRADIUS * 2, MINRADIUS * 2};
CBox box = {POS.x, POS.y, SIZE.x, SIZE.y}; CBox box = {POS.x, POS.y, SIZE.x, SIZE.y};

View file

@ -66,7 +66,7 @@ void CHyprBorderDecoration::draw(CMonitor* pMonitor, float a, const Vector2D& of
} }
int borderSize = m_pWindow->getRealBorderSize(); 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); g_pHyprOpenGL->renderBorder(&windowBox, grad, RADII, borderSize, a1);

View file

@ -79,8 +79,8 @@ void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a, const Vector2D
if (*PSHADOWS != 1) if (*PSHADOWS != 1)
return; // disabled return; // disabled
const auto RADIIBASE = m_pWindow->getCornerRadii(); 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 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 PWORKSPACE = g_pCompositor->getWorkspaceByID(m_pWindow->m_iWorkspaceID);
const auto WORKSPACEOFFSET = PWORKSPACE && !m_pWindow->m_bPinned ? PWORKSPACE->m_vRenderOffset.vec() : Vector2D(); const auto WORKSPACEOFFSET = PWORKSPACE && !m_pWindow->m_bPinned ? PWORKSPACE->m_vRenderOffset.vec() : Vector2D();