helpers: refactor class member vars (#10218)

This commit is contained in:
davc0n 2025-04-30 23:45:20 +02:00 committed by GitHub
parent b8a204c21d
commit 50e1bec85f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
63 changed files with 1770 additions and 1769 deletions

View file

@ -52,7 +52,7 @@ void CHyprBorderDecoration::draw(PHLMONITOR pMonitor, float const& a) {
if (m_bAssignedGeometry.width < m_seExtents.topLeft.x + 1 || m_bAssignedGeometry.height < m_seExtents.topLeft.y + 1)
return;
CBox windowBox = assignedBoxGlobal().translate(-pMonitor->vecPosition + m_pWindow->m_floatingOffset).expand(-m_pWindow->getRealBorderSize()).scale(pMonitor->scale).round();
CBox windowBox = assignedBoxGlobal().translate(-pMonitor->m_position + m_pWindow->m_floatingOffset).expand(-m_pWindow->getRealBorderSize()).scale(pMonitor->m_scale).round();
if (windowBox.width < 1 || windowBox.height < 1)
return;
@ -71,7 +71,7 @@ void CHyprBorderDecoration::draw(PHLMONITOR pMonitor, float const& a) {
}
int borderSize = m_pWindow->getRealBorderSize();
const auto ROUNDING = m_pWindow->rounding() * pMonitor->scale;
const auto ROUNDING = m_pWindow->rounding() * pMonitor->m_scale;
const auto ROUNDINGPOWER = m_pWindow->roundingPower();
CBorderPassElement::SBorderData data;
@ -134,7 +134,7 @@ void CHyprBorderDecoration::damageEntire() {
for (auto const& m : g_pCompositor->m_monitors) {
if (!g_pHyprRenderer->shouldRenderWindow(m_pWindow.lock(), m)) {
const CRegion monitorRegion({m->vecPosition, m->vecSize});
const CRegion monitorRegion({m->m_position, m->m_size});
borderRegion.subtract(monitorRegion);
}
}

View file

@ -68,7 +68,7 @@ void CHyprDropShadowDecoration::damageEntire() {
for (auto const& m : g_pCompositor->m_monitors) {
if (!g_pHyprRenderer->shouldRenderWindow(PWINDOW, m)) {
const CRegion monitorRegion({m->vecPosition, m->vecSize});
const CRegion monitorRegion({m->m_position, m->m_size});
shadowRegion.subtract(monitorRegion);
}
}
@ -125,7 +125,7 @@ void CHyprDropShadowDecoration::render(PHLMONITOR pMonitor, float const& a) {
// draw the shadow
CBox fullBox = m_bLastWindowBoxWithDecos;
fullBox.translate(-pMonitor->vecPosition + WORKSPACEOFFSET);
fullBox.translate(-pMonitor->m_position + WORKSPACEOFFSET);
fullBox.x -= *PSHADOWSIZE;
fullBox.y -= *PSHADOWSIZE;
fullBox.w += 2 * *PSHADOWSIZE;
@ -138,9 +138,9 @@ void CHyprDropShadowDecoration::render(PHLMONITOR pMonitor, float const& a) {
updateWindow(PWINDOW);
m_vLastWindowPos += WORKSPACEOFFSET;
m_seExtents = {{m_vLastWindowPos.x - fullBox.x - pMonitor->vecPosition.x + 2, m_vLastWindowPos.y - fullBox.y - pMonitor->vecPosition.y + 2},
{fullBox.x + fullBox.width + pMonitor->vecPosition.x - m_vLastWindowPos.x - m_vLastWindowSize.x + 2,
fullBox.y + fullBox.height + pMonitor->vecPosition.y - m_vLastWindowPos.y - m_vLastWindowSize.y + 2}};
m_seExtents = {{m_vLastWindowPos.x - fullBox.x - pMonitor->m_position.x + 2, m_vLastWindowPos.y - fullBox.y - pMonitor->m_position.y + 2},
{fullBox.x + fullBox.width + pMonitor->m_position.x - m_vLastWindowPos.x - m_vLastWindowSize.x + 2,
fullBox.y + fullBox.height + pMonitor->m_position.y - m_vLastWindowPos.y - m_vLastWindowSize.y + 2}};
fullBox.translate(PWINDOW->m_floatingOffset);
@ -155,25 +155,25 @@ void CHyprDropShadowDecoration::render(PHLMONITOR pMonitor, float const& a) {
CFramebuffer& alphaSwapFB = g_pHyprOpenGL->m_RenderData.pCurrentMonData->mirrorSwapFB;
auto* LASTFB = g_pHyprOpenGL->m_RenderData.currentFB;
fullBox.scale(pMonitor->scale).round();
fullBox.scale(pMonitor->m_scale).round();
if (*PSHADOWIGNOREWINDOW) {
CBox windowBox = m_bLastWindowBox;
CBox withDecos = m_bLastWindowBoxWithDecos;
// get window box
windowBox.translate(-pMonitor->vecPosition + WORKSPACEOFFSET);
withDecos.translate(-pMonitor->vecPosition + WORKSPACEOFFSET);
windowBox.translate(-pMonitor->m_position + WORKSPACEOFFSET);
withDecos.translate(-pMonitor->m_position + WORKSPACEOFFSET);
windowBox.translate(PWINDOW->m_floatingOffset);
withDecos.translate(PWINDOW->m_floatingOffset);
auto scaledExtentss = withDecos.extentsFrom(windowBox);
scaledExtentss = scaledExtentss * pMonitor->scale;
scaledExtentss = scaledExtentss * pMonitor->m_scale;
scaledExtentss = scaledExtentss.round();
// add extents
windowBox.scale(pMonitor->scale).round().addExtents(scaledExtentss);
windowBox.scale(pMonitor->m_scale).round().addExtents(scaledExtentss);
if (windowBox.width < 1 || windowBox.height < 1)
return; // prevent assert failed
@ -181,7 +181,7 @@ void CHyprDropShadowDecoration::render(PHLMONITOR pMonitor, float const& a) {
CRegion saveDamage = g_pHyprOpenGL->m_RenderData.damage;
g_pHyprOpenGL->m_RenderData.damage = fullBox;
g_pHyprOpenGL->m_RenderData.damage.subtract(windowBox.copy().expand(-ROUNDING * pMonitor->scale)).intersect(saveDamage);
g_pHyprOpenGL->m_RenderData.damage.subtract(windowBox.copy().expand(-ROUNDING * pMonitor->m_scale)).intersect(saveDamage);
g_pHyprOpenGL->m_RenderData.renderModif.applyToRegion(g_pHyprOpenGL->m_RenderData.damage);
alphaFB.bind();
@ -192,10 +192,10 @@ void CHyprDropShadowDecoration::render(PHLMONITOR pMonitor, float const& a) {
g_pHyprOpenGL->renderRect(fullBox, CHyprColor(0, 0, 0, 1), 0);
// render white shadow with the alpha of the shadow color (otherwise we clear with alpha later and shit it to 2 bit)
drawShadowInternal(fullBox, ROUNDING * pMonitor->scale, ROUNDINGPOWER, *PSHADOWSIZE * pMonitor->scale, CHyprColor(1, 1, 1, PWINDOW->m_realShadowColor->value().a), a);
drawShadowInternal(fullBox, ROUNDING * pMonitor->m_scale, ROUNDINGPOWER, *PSHADOWSIZE * pMonitor->m_scale, CHyprColor(1, 1, 1, PWINDOW->m_realShadowColor->value().a), a);
// render black window box ("clip")
g_pHyprOpenGL->renderRect(windowBox, CHyprColor(0, 0, 0, 1.0), (ROUNDING + 1 /* This fixes small pixel gaps. */) * pMonitor->scale, ROUNDINGPOWER);
g_pHyprOpenGL->renderRect(windowBox, CHyprColor(0, 0, 0, 1.0), (ROUNDING + 1 /* This fixes small pixel gaps. */) * pMonitor->m_scale, ROUNDINGPOWER);
alphaSwapFB.bind();
@ -204,7 +204,7 @@ void CHyprDropShadowDecoration::render(PHLMONITOR pMonitor, float const& a) {
LASTFB->bind();
CBox monbox = {0, 0, pMonitor->vecTransformedSize.x, pMonitor->vecTransformedSize.y};
CBox monbox = {0, 0, pMonitor->m_transformedSize.x, pMonitor->m_transformedSize.y};
g_pHyprOpenGL->setMonitorTransformEnabled(true);
g_pHyprOpenGL->setRenderModifEnabled(false);
@ -214,7 +214,7 @@ void CHyprDropShadowDecoration::render(PHLMONITOR pMonitor, float const& a) {
g_pHyprOpenGL->m_RenderData.damage = saveDamage;
} else
drawShadowInternal(fullBox, ROUNDING * pMonitor->scale, ROUNDINGPOWER, *PSHADOWSIZE * pMonitor->scale, PWINDOW->m_realShadowColor->value(), a);
drawShadowInternal(fullBox, ROUNDING * pMonitor->m_scale, ROUNDINGPOWER, *PSHADOWSIZE * pMonitor->m_scale, PWINDOW->m_realShadowColor->value(), a);
if (m_seExtents != m_seReportedExtents)
g_pDecorationPositioner->repositionDeco(this);

View file

@ -143,11 +143,11 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) {
for (int i = 0; i < barsToDraw; ++i) {
const auto WINDOWINDEX = *PSTACKED ? m_dwGroupMembers.size() - i - 1 : i;
CBox rect = {ASSIGNEDBOX.x + xoff - pMonitor->vecPosition.x + m_pWindow->m_floatingOffset.x,
ASSIGNEDBOX.y + ASSIGNEDBOX.h - floor(yoff) - *PINDICATORHEIGHT - *POUTERGAP - pMonitor->vecPosition.y + m_pWindow->m_floatingOffset.y, m_fBarWidth,
CBox rect = {ASSIGNEDBOX.x + xoff - pMonitor->m_position.x + m_pWindow->m_floatingOffset.x,
ASSIGNEDBOX.y + ASSIGNEDBOX.h - floor(yoff) - *PINDICATORHEIGHT - *POUTERGAP - pMonitor->m_position.y + m_pWindow->m_floatingOffset.y, m_fBarWidth,
*PINDICATORHEIGHT};
rect.scale(pMonitor->scale).round();
rect.scale(pMonitor->m_scale).round();
const bool GROUPLOCKED = m_pWindow->getGroupHead()->m_groupData.locked || g_pKeybindManager->m_bGroupsLocked;
const auto* const PCOLACTIVE = GROUPLOCKED ? GROUPCOLACTIVELOCKED : GROUPCOLACTIVE;
@ -187,10 +187,10 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) {
g_pHyprRenderer->m_sRenderPass.add(makeShared<CRectPassElement>(rectdata));
}
rect = {ASSIGNEDBOX.x + xoff - pMonitor->vecPosition.x + m_pWindow->m_floatingOffset.x,
ASSIGNEDBOX.y + ASSIGNEDBOX.h - floor(yoff) - ONEBARHEIGHT - pMonitor->vecPosition.y + m_pWindow->m_floatingOffset.y, m_fBarWidth,
rect = {ASSIGNEDBOX.x + xoff - pMonitor->m_position.x + m_pWindow->m_floatingOffset.x,
ASSIGNEDBOX.y + ASSIGNEDBOX.h - floor(yoff) - ONEBARHEIGHT - pMonitor->m_position.y + m_pWindow->m_floatingOffset.y, m_fBarWidth,
(*PGRADIENTS || *PRENDERTITLES ? *PHEIGHT : 0)};
rect.scale(pMonitor->scale);
rect.scale(pMonitor->m_scale);
if (!rect.empty()) {
if (*PGRADIENTS) {
@ -232,17 +232,17 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) {
CTitleTex* pTitleTex = textureFromTitle(m_dwGroupMembers[WINDOWINDEX]->m_title);
if (!pTitleTex)
pTitleTex =
m_sTitleTexs.titleTexs
.emplace_back(makeUnique<CTitleTex>(m_dwGroupMembers[WINDOWINDEX].lock(),
Vector2D{m_fBarWidth * pMonitor->scale, (*PTITLEFONTSIZE + 2L * BAR_TEXT_PAD) * pMonitor->scale}, pMonitor->scale))
.get();
pTitleTex = m_sTitleTexs.titleTexs
.emplace_back(makeUnique<CTitleTex>(m_dwGroupMembers[WINDOWINDEX].lock(),
Vector2D{m_fBarWidth * pMonitor->m_scale, (*PTITLEFONTSIZE + 2L * BAR_TEXT_PAD) * pMonitor->m_scale},
pMonitor->m_scale))
.get();
const auto titleTex = m_dwGroupMembers[WINDOWINDEX] == g_pCompositor->m_lastWindow ? pTitleTex->texActive : pTitleTex->texInactive;
rect.y += std::ceil(((rect.height - titleTex->m_vSize.y) / 2.0) - (*PTEXTOFFSET * pMonitor->scale));
rect.y += std::ceil(((rect.height - titleTex->m_vSize.y) / 2.0) - (*PTEXTOFFSET * pMonitor->m_scale));
rect.height = titleTex->m_vSize.y;
rect.width = titleTex->m_vSize.x;
rect.x += std::round(((m_fBarWidth * pMonitor->scale) / 2.0) - (titleTex->m_vSize.x / 2.0));
rect.x += std::round(((m_fBarWidth * pMonitor->m_scale) / 2.0) - (titleTex->m_vSize.x / 2.0));
rect.round();
CTexPassElement::SRenderData data;
@ -300,7 +300,7 @@ static void renderGradientTo(SP<CTexture> tex, CGradientValueData* grad) {
if (!g_pCompositor->m_lastMonitor)
return;
const Vector2D& bufferSize = g_pCompositor->m_lastMonitor->vecPixelSize;
const Vector2D& bufferSize = g_pCompositor->m_lastMonitor->m_pixelSize;
const auto CAIROSURFACE = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, bufferSize.x, bufferSize.y);
const auto CAIRO = cairo_create(CAIROSURFACE);