mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-24 22:25:59 +01:00
formated files
This commit is contained in:
parent
e9a4a69fd8
commit
91e1fc978d
7 changed files with 19 additions and 18 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -547,7 +547,7 @@ void CConfigManager::configSetValueSafe(const std::string& COMMAND, const std::s
|
||||||
}
|
}
|
||||||
case CVD_TYPE_CORNER_RADII: {
|
case CVD_TYPE_CORNER_RADII: {
|
||||||
CCornerRadiiData* data = static_cast<CCornerRadiiData*>(CONFIGENTRY->data.get());
|
CCornerRadiiData* data = static_cast<CCornerRadiiData*>(CONFIGENTRY->data.get());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
*data = configStringToRadii(VALUE);
|
*data = configStringToRadii(VALUE);
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
|
|
|
@ -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)");
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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};
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue