render: refactor class member vars (#10292)

* render: refactor class member vars

* render: fix clang format
This commit is contained in:
davc0n 2025-05-05 23:44:49 +02:00 committed by GitHub
parent c7eb141098
commit 997fefbc11
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
63 changed files with 1307 additions and 1321 deletions

View file

@ -6,42 +6,42 @@
#include "../Renderer.hpp"
#include "../../managers/HookSystemManager.hpp"
CHyprBorderDecoration::CHyprBorderDecoration(PHLWINDOW pWindow) : IHyprWindowDecoration(pWindow), m_pWindow(pWindow) {
CHyprBorderDecoration::CHyprBorderDecoration(PHLWINDOW pWindow) : IHyprWindowDecoration(pWindow), m_window(pWindow) {
;
}
SDecorationPositioningInfo CHyprBorderDecoration::getPositioningInfo() {
const auto BORDERSIZE = m_pWindow->getRealBorderSize();
m_seExtents = {{BORDERSIZE, BORDERSIZE}, {BORDERSIZE, BORDERSIZE}};
const auto BORDERSIZE = m_window->getRealBorderSize();
m_extents = {{BORDERSIZE, BORDERSIZE}, {BORDERSIZE, BORDERSIZE}};
if (doesntWantBorders())
m_seExtents = {{}, {}};
m_extents = {{}, {}};
SDecorationPositioningInfo info;
info.priority = 10000;
info.policy = DECORATION_POSITION_STICKY;
info.desiredExtents = m_seExtents;
info.desiredExtents = m_extents;
info.reserved = true;
info.edges = DECORATION_EDGE_BOTTOM | DECORATION_EDGE_LEFT | DECORATION_EDGE_RIGHT | DECORATION_EDGE_TOP;
m_seReportedExtents = m_seExtents;
m_reportedExtents = m_extents;
return info;
}
void CHyprBorderDecoration::onPositioningReply(const SDecorationPositioningReply& reply) {
m_bAssignedGeometry = reply.assignedGeometry;
m_assignedGeometry = reply.assignedGeometry;
}
CBox CHyprBorderDecoration::assignedBoxGlobal() {
CBox box = m_bAssignedGeometry;
box.translate(g_pDecorationPositioner->getEdgeDefinedPoint(DECORATION_EDGE_BOTTOM | DECORATION_EDGE_LEFT | DECORATION_EDGE_RIGHT | DECORATION_EDGE_TOP, m_pWindow.lock()));
CBox box = m_assignedGeometry;
box.translate(g_pDecorationPositioner->getEdgeDefinedPoint(DECORATION_EDGE_BOTTOM | DECORATION_EDGE_LEFT | DECORATION_EDGE_RIGHT | DECORATION_EDGE_TOP, m_window.lock()));
const auto PWORKSPACE = m_pWindow->m_workspace;
const auto PWORKSPACE = m_window->m_workspace;
if (!PWORKSPACE)
return box;
const auto WORKSPACEOFFSET = PWORKSPACE && !m_pWindow->m_pinned ? PWORKSPACE->m_renderOffset->value() : Vector2D();
const auto WORKSPACEOFFSET = PWORKSPACE && !m_window->m_pinned ? PWORKSPACE->m_renderOffset->value() : Vector2D();
return box.translate(WORKSPACEOFFSET);
}
@ -49,30 +49,30 @@ void CHyprBorderDecoration::draw(PHLMONITOR pMonitor, float const& a) {
if (doesntWantBorders())
return;
if (m_bAssignedGeometry.width < m_seExtents.topLeft.x + 1 || m_bAssignedGeometry.height < m_seExtents.topLeft.y + 1)
if (m_assignedGeometry.width < m_extents.topLeft.x + 1 || m_assignedGeometry.height < m_extents.topLeft.y + 1)
return;
CBox windowBox = assignedBoxGlobal().translate(-pMonitor->m_position + m_pWindow->m_floatingOffset).expand(-m_pWindow->getRealBorderSize()).scale(pMonitor->m_scale).round();
CBox windowBox = assignedBoxGlobal().translate(-pMonitor->m_position + m_window->m_floatingOffset).expand(-m_window->getRealBorderSize()).scale(pMonitor->m_scale).round();
if (windowBox.width < 1 || windowBox.height < 1)
return;
auto grad = m_pWindow->m_realBorderColor;
const bool ANIMATED = m_pWindow->m_borderFadeAnimationProgress->isBeingAnimated();
auto grad = m_window->m_realBorderColor;
const bool ANIMATED = m_window->m_borderFadeAnimationProgress->isBeingAnimated();
if (m_pWindow->m_borderAngleAnimationProgress->enabled()) {
grad.m_angle += m_pWindow->m_borderAngleAnimationProgress->value() * M_PI * 2;
if (m_window->m_borderAngleAnimationProgress->enabled()) {
grad.m_angle += m_window->m_borderAngleAnimationProgress->value() * M_PI * 2;
grad.m_angle = normalizeAngleRad(grad.m_angle);
// When borderangle is animated, it is counterintuitive to fade between inactive/active gradient angles.
// Instead we sync the angles to avoid fading between them and additionally rotating the border angle.
if (ANIMATED)
m_pWindow->m_realBorderColorPrevious.m_angle = grad.m_angle;
m_window->m_realBorderColorPrevious.m_angle = grad.m_angle;
}
int borderSize = m_pWindow->getRealBorderSize();
const auto ROUNDING = m_pWindow->rounding() * pMonitor->m_scale;
const auto ROUNDINGPOWER = m_pWindow->roundingPower();
int borderSize = m_window->getRealBorderSize();
const auto ROUNDING = m_window->rounding() * pMonitor->m_scale;
const auto ROUNDINGPOWER = m_window->roundingPower();
CBorderPassElement::SBorderData data;
data.box = windowBox;
@ -84,12 +84,12 @@ void CHyprBorderDecoration::draw(PHLMONITOR pMonitor, float const& a) {
if (ANIMATED) {
data.hasGrad2 = true;
data.grad1 = m_pWindow->m_realBorderColorPrevious;
data.grad1 = m_window->m_realBorderColorPrevious;
data.grad2 = grad;
data.lerp = m_pWindow->m_borderFadeAnimationProgress->value();
data.lerp = m_window->m_borderFadeAnimationProgress->value();
}
g_pHyprRenderer->m_sRenderPass.add(makeShared<CBorderPassElement>(data));
g_pHyprRenderer->m_renderPass.add(makeShared<CBorderPassElement>(data));
}
eDecorationType CHyprBorderDecoration::getDecorationType() {
@ -97,32 +97,32 @@ eDecorationType CHyprBorderDecoration::getDecorationType() {
}
void CHyprBorderDecoration::updateWindow(PHLWINDOW) {
auto borderSize = m_pWindow->getRealBorderSize();
auto borderSize = m_window->getRealBorderSize();
if (borderSize == m_iLastBorderSize)
if (borderSize == m_lastBorderSize)
return;
if (borderSize <= 0 && m_iLastBorderSize <= 0)
if (borderSize <= 0 && m_lastBorderSize <= 0)
return;
m_iLastBorderSize = borderSize;
m_lastBorderSize = borderSize;
g_pDecorationPositioner->repositionDeco(this);
}
void CHyprBorderDecoration::damageEntire() {
if (!validMapped(m_pWindow))
if (!validMapped(m_window))
return;
auto surfaceBox = m_pWindow->getWindowMainSurfaceBox();
const auto ROUNDING = m_pWindow->rounding();
auto surfaceBox = m_window->getWindowMainSurfaceBox();
const auto ROUNDING = m_window->rounding();
const auto ROUNDINGSIZE = ROUNDING - M_SQRT1_2 * ROUNDING + 2;
const auto BORDERSIZE = m_pWindow->getRealBorderSize() + 1;
const auto BORDERSIZE = m_window->getRealBorderSize() + 1;
const auto PWINDOWWORKSPACE = m_pWindow->m_workspace;
if (PWINDOWWORKSPACE && PWINDOWWORKSPACE->m_renderOffset->isBeingAnimated() && !m_pWindow->m_pinned)
const auto PWINDOWWORKSPACE = m_window->m_workspace;
if (PWINDOWWORKSPACE && PWINDOWWORKSPACE->m_renderOffset->isBeingAnimated() && !m_window->m_pinned)
surfaceBox.translate(PWINDOWWORKSPACE->m_renderOffset->value());
surfaceBox.translate(m_pWindow->m_floatingOffset);
surfaceBox.translate(m_window->m_floatingOffset);
CBox surfaceBoxExpandedBorder = surfaceBox;
surfaceBoxExpandedBorder.expand(BORDERSIZE);
@ -133,7 +133,7 @@ void CHyprBorderDecoration::damageEntire() {
borderRegion.subtract(surfaceBoxShrunkRounding);
for (auto const& m : g_pCompositor->m_monitors) {
if (!g_pHyprRenderer->shouldRenderWindow(m_pWindow.lock(), m)) {
if (!g_pHyprRenderer->shouldRenderWindow(m_window.lock(), m)) {
const CRegion monitorRegion({m->m_position, m->m_size});
borderRegion.subtract(monitorRegion);
}
@ -157,5 +157,5 @@ std::string CHyprBorderDecoration::getDisplayName() {
}
bool CHyprBorderDecoration::doesntWantBorders() {
return m_pWindow->m_windowData.noBorder.valueOrDefault() || m_pWindow->m_X11DoesntWantBorders || m_pWindow->getRealBorderSize() == 0;
return m_window->m_windowData.noBorder.valueOrDefault() || m_window->m_X11DoesntWantBorders || m_window->getRealBorderSize() == 0;
}

View file

@ -26,17 +26,14 @@ class CHyprBorderDecoration : public IHyprWindowDecoration {
virtual std::string getDisplayName();
private:
SBoxExtents m_seExtents;
SBoxExtents m_seReportedExtents;
SBoxExtents m_extents;
SBoxExtents m_reportedExtents;
PHLWINDOWREF m_pWindow;
PHLWINDOWREF m_window;
Vector2D m_vLastWindowPos;
Vector2D m_vLastWindowSize;
CBox m_assignedGeometry = {0};
CBox m_bAssignedGeometry = {0};
int m_iLastBorderSize = -1;
int m_lastBorderSize = -1;
CBox assignedBoxGlobal();
bool doesntWantBorders();

View file

@ -5,7 +5,7 @@
#include "../pass/ShadowPassElement.hpp"
#include "../Renderer.hpp"
CHyprDropShadowDecoration::CHyprDropShadowDecoration(PHLWINDOW pWindow) : IHyprWindowDecoration(pWindow), m_pWindow(pWindow) {
CHyprDropShadowDecoration::CHyprDropShadowDecoration(PHLWINDOW pWindow) : IHyprWindowDecoration(pWindow), m_window(pWindow) {
;
}
@ -16,15 +16,15 @@ eDecorationType CHyprDropShadowDecoration::getDecorationType() {
SDecorationPositioningInfo CHyprDropShadowDecoration::getPositioningInfo() {
SDecorationPositioningInfo info;
info.policy = DECORATION_POSITION_ABSOLUTE;
info.desiredExtents = m_seExtents;
info.desiredExtents = m_extents;
info.edges = DECORATION_EDGE_BOTTOM | DECORATION_EDGE_LEFT | DECORATION_EDGE_RIGHT | DECORATION_EDGE_TOP;
m_seReportedExtents = m_seExtents;
m_reportedExtents = m_extents;
return info;
}
void CHyprDropShadowDecoration::onPositioningReply(const SDecorationPositioningReply& reply) {
updateWindow(m_pWindow.lock());
updateWindow(m_window.lock());
}
uint64_t CHyprDropShadowDecoration::getDecorationFlags() {
@ -41,11 +41,11 @@ void CHyprDropShadowDecoration::damageEntire() {
if (*PSHADOWS != 1)
return; // disabled
const auto PWINDOW = m_pWindow.lock();
const auto PWINDOW = m_window.lock();
CBox shadowBox = {PWINDOW->m_realPosition->value().x - m_seExtents.topLeft.x, PWINDOW->m_realPosition->value().y - m_seExtents.topLeft.y,
PWINDOW->m_realSize->value().x + m_seExtents.topLeft.x + m_seExtents.bottomRight.x,
PWINDOW->m_realSize->value().y + m_seExtents.topLeft.y + m_seExtents.bottomRight.y};
CBox shadowBox = {PWINDOW->m_realPosition->value().x - m_extents.topLeft.x, PWINDOW->m_realPosition->value().y - m_extents.topLeft.y,
PWINDOW->m_realSize->value().x + m_extents.topLeft.x + m_extents.bottomRight.x,
PWINDOW->m_realSize->value().y + m_extents.topLeft.y + m_extents.bottomRight.y};
const auto PWORKSPACE = PWINDOW->m_workspace;
if (PWORKSPACE && PWORKSPACE->m_renderOffset->isBeingAnimated() && !PWINDOW->m_pinned)
@ -77,24 +77,24 @@ void CHyprDropShadowDecoration::damageEntire() {
}
void CHyprDropShadowDecoration::updateWindow(PHLWINDOW pWindow) {
const auto PWINDOW = m_pWindow.lock();
const auto PWINDOW = m_window.lock();
m_vLastWindowPos = PWINDOW->m_realPosition->value();
m_vLastWindowSize = PWINDOW->m_realSize->value();
m_lastWindowPos = PWINDOW->m_realPosition->value();
m_lastWindowSize = PWINDOW->m_realSize->value();
m_bLastWindowBox = {m_vLastWindowPos.x, m_vLastWindowPos.y, m_vLastWindowSize.x, m_vLastWindowSize.y};
m_bLastWindowBoxWithDecos = g_pDecorationPositioner->getBoxWithIncludedDecos(pWindow);
m_lastWindowBox = {m_lastWindowPos.x, m_lastWindowPos.y, m_lastWindowSize.x, m_lastWindowSize.y};
m_lastWindowBoxWithDecos = g_pDecorationPositioner->getBoxWithIncludedDecos(pWindow);
}
void CHyprDropShadowDecoration::draw(PHLMONITOR pMonitor, float const& a) {
CShadowPassElement::SShadowData data;
data.deco = this;
data.a = a;
g_pHyprRenderer->m_sRenderPass.add(makeShared<CShadowPassElement>(data));
g_pHyprRenderer->m_renderPass.add(makeShared<CShadowPassElement>(data));
}
void CHyprDropShadowDecoration::render(PHLMONITOR pMonitor, float const& a) {
const auto PWINDOW = m_pWindow.lock();
const auto PWINDOW = m_window.lock();
if (!validMapped(PWINDOW))
return;
@ -124,7 +124,7 @@ void CHyprDropShadowDecoration::render(PHLMONITOR pMonitor, float const& a) {
const auto WORKSPACEOFFSET = PWORKSPACE && !PWINDOW->m_pinned ? PWORKSPACE->m_renderOffset->value() : Vector2D();
// draw the shadow
CBox fullBox = m_bLastWindowBoxWithDecos;
CBox fullBox = m_lastWindowBoxWithDecos;
fullBox.translate(-pMonitor->m_position + WORKSPACEOFFSET);
fullBox.x -= *PSHADOWSIZE;
fullBox.y -= *PSHADOWSIZE;
@ -137,10 +137,10 @@ void CHyprDropShadowDecoration::render(PHLMONITOR pMonitor, float const& a) {
fullBox.scaleFromCenter(SHADOWSCALE).translate({(*PSHADOWOFFSET).x, (*PSHADOWOFFSET).y});
updateWindow(PWINDOW);
m_vLastWindowPos += WORKSPACEOFFSET;
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}};
m_lastWindowPos += WORKSPACEOFFSET;
m_extents = {{m_lastWindowPos.x - fullBox.x - pMonitor->m_position.x + 2, m_lastWindowPos.y - fullBox.y - pMonitor->m_position.y + 2},
{fullBox.x + fullBox.width + pMonitor->m_position.x - m_lastWindowPos.x - m_lastWindowSize.x + 2,
fullBox.y + fullBox.height + pMonitor->m_position.y - m_lastWindowPos.y - m_lastWindowSize.y + 2}};
fullBox.translate(PWINDOW->m_floatingOffset);
@ -148,18 +148,18 @@ void CHyprDropShadowDecoration::render(PHLMONITOR pMonitor, float const& a) {
return; // don't draw invisible shadows
g_pHyprOpenGL->scissor(nullptr);
g_pHyprOpenGL->m_RenderData.currentWindow = m_pWindow;
g_pHyprOpenGL->m_renderData.currentWindow = m_window;
// we'll take the liberty of using this as it should not be used rn
CFramebuffer& alphaFB = g_pHyprOpenGL->m_RenderData.pCurrentMonData->mirrorFB;
CFramebuffer& alphaSwapFB = g_pHyprOpenGL->m_RenderData.pCurrentMonData->mirrorSwapFB;
auto* LASTFB = g_pHyprOpenGL->m_RenderData.currentFB;
CFramebuffer& alphaFB = g_pHyprOpenGL->m_renderData.pCurrentMonData->mirrorFB;
CFramebuffer& alphaSwapFB = g_pHyprOpenGL->m_renderData.pCurrentMonData->mirrorSwapFB;
auto* LASTFB = g_pHyprOpenGL->m_renderData.currentFB;
fullBox.scale(pMonitor->m_scale).round();
if (*PSHADOWIGNOREWINDOW) {
CBox windowBox = m_bLastWindowBox;
CBox withDecos = m_bLastWindowBoxWithDecos;
CBox windowBox = m_lastWindowBox;
CBox withDecos = m_lastWindowBoxWithDecos;
// get window box
windowBox.translate(-pMonitor->m_position + WORKSPACEOFFSET);
@ -178,11 +178,11 @@ void CHyprDropShadowDecoration::render(PHLMONITOR pMonitor, float const& a) {
if (windowBox.width < 1 || windowBox.height < 1)
return; // prevent assert failed
CRegion saveDamage = g_pHyprOpenGL->m_RenderData.damage;
CRegion saveDamage = g_pHyprOpenGL->m_renderData.damage;
g_pHyprOpenGL->m_RenderData.damage = fullBox;
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);
g_pHyprOpenGL->m_renderData.damage = fullBox;
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();
@ -212,14 +212,14 @@ void CHyprDropShadowDecoration::render(PHLMONITOR pMonitor, float const& a) {
g_pHyprOpenGL->setRenderModifEnabled(true);
g_pHyprOpenGL->setMonitorTransformEnabled(false);
g_pHyprOpenGL->m_RenderData.damage = saveDamage;
g_pHyprOpenGL->m_renderData.damage = saveDamage;
} else
drawShadowInternal(fullBox, ROUNDING * pMonitor->m_scale, ROUNDINGPOWER, *PSHADOWSIZE * pMonitor->m_scale, PWINDOW->m_realShadowColor->value(), a);
if (m_seExtents != m_seReportedExtents)
if (m_extents != m_reportedExtents)
g_pDecorationPositioner->repositionDeco(this);
g_pHyprOpenGL->m_RenderData.currentWindow.reset();
g_pHyprOpenGL->m_renderData.currentWindow.reset();
}
eDecorationLayer CHyprDropShadowDecoration::getDecorationLayer() {

View file

@ -28,16 +28,16 @@ class CHyprDropShadowDecoration : public IHyprWindowDecoration {
void render(PHLMONITOR, float const& a);
private:
SBoxExtents m_seExtents;
SBoxExtents m_seReportedExtents;
SBoxExtents m_extents;
SBoxExtents m_reportedExtents;
PHLWINDOWREF m_pWindow;
PHLWINDOWREF m_window;
Vector2D m_vLastWindowPos;
Vector2D m_vLastWindowSize;
Vector2D m_lastWindowPos;
Vector2D m_lastWindowSize;
void drawShadowInternal(const CBox& box, int round, float roundingPower, int range, CHyprColor color, float a);
CBox m_bLastWindowBox = {0};
CBox m_bLastWindowBoxWithDecos = {0};
CBox m_lastWindowBox = {0};
CBox m_lastWindowBoxWithDecos = {0};
};

View file

@ -17,11 +17,11 @@ static SP<CTexture> m_tGradientLockedInactive = makeShared<CTexture>();
constexpr int BAR_TEXT_PAD = 2;
CHyprGroupBarDecoration::CHyprGroupBarDecoration(PHLWINDOW pWindow) : IHyprWindowDecoration(pWindow), m_pWindow(pWindow) {
CHyprGroupBarDecoration::CHyprGroupBarDecoration(PHLWINDOW pWindow) : IHyprWindowDecoration(pWindow), m_window(pWindow) {
static auto PGRADIENTS = CConfigValue<Hyprlang::INT>("group:groupbar:enabled");
static auto PENABLED = CConfigValue<Hyprlang::INT>("group:groupbar:gradients");
if (m_tGradientActive->m_iTexID == 0 && *PENABLED && *PGRADIENTS)
if (m_tGradientActive->m_texID == 0 && *PENABLED && *PGRADIENTS)
refreshGroupBarGradients();
}
@ -43,7 +43,7 @@ SDecorationPositioningInfo CHyprGroupBarDecoration::getPositioningInfo() {
info.priority = *PPRIORITY;
info.reserved = true;
if (*PENABLED && m_pWindow->m_windowData.decorate.valueOrDefault()) {
if (*PENABLED && m_window->m_windowData.decorate.valueOrDefault()) {
if (*PSTACKED) {
const auto ONEBARHEIGHT = *POUTERGAP + *PINDICATORHEIGHT + *PINDICATORGAP + (*PGRADIENTS || *PRENDERTITLES ? *PHEIGHT : 0);
info.desiredExtents = {{0, (ONEBARHEIGHT * m_dwGroupMembers.size()) + (*PKEEPUPPERGAP * *POUTERGAP)}, {0, 0}};
@ -55,7 +55,7 @@ SDecorationPositioningInfo CHyprGroupBarDecoration::getPositioningInfo() {
}
void CHyprGroupBarDecoration::onPositioningReply(const SDecorationPositioningReply& reply) {
m_bAssignedBox = reply.assignedGeometry;
m_assignedBox = reply.assignedGeometry;
}
eDecorationType CHyprGroupBarDecoration::getDecorationType() {
@ -65,8 +65,8 @@ eDecorationType CHyprGroupBarDecoration::getDecorationType() {
//
void CHyprGroupBarDecoration::updateWindow(PHLWINDOW pWindow) {
if (m_pWindow->m_groupData.pNextWindow.expired()) {
m_pWindow->removeWindowDeco(this);
if (m_window->m_groupData.pNextWindow.expired()) {
m_window->removeWindowDeco(this);
return;
}
@ -83,14 +83,14 @@ void CHyprGroupBarDecoration::updateWindow(PHLWINDOW pWindow) {
damageEntire();
if (m_dwGroupMembers.size() == 0) {
m_pWindow->removeWindowDeco(this);
m_window->removeWindowDeco(this);
return;
}
}
void CHyprGroupBarDecoration::damageEntire() {
auto box = assignedBoxGlobal();
box.translate(m_pWindow->m_floatingOffset);
box.translate(m_window->m_floatingOffset);
g_pHyprRenderer->damageBox(box);
}
@ -100,7 +100,7 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) {
static auto PENABLED = CConfigValue<Hyprlang::INT>("group:groupbar:enabled");
if (!*PENABLED || !m_pWindow->m_windowData.decorate.valueOrDefault())
if (!*PENABLED || !m_window->m_windowData.decorate.valueOrDefault())
return;
static auto PRENDERTITLES = CConfigValue<Hyprlang::INT>("group:groupbar:render_titles");
@ -130,8 +130,8 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) {
const auto ASSIGNEDBOX = assignedBoxGlobal();
const auto ONEBARHEIGHT = *POUTERGAP + *PINDICATORHEIGHT + *PINDICATORGAP + (*PGRADIENTS || *PRENDERTITLES ? *PHEIGHT : 0);
m_fBarWidth = *PSTACKED ? ASSIGNEDBOX.w : (ASSIGNEDBOX.w - *PINNERGAP * (barsToDraw - 1)) / barsToDraw;
m_fBarHeight = *PSTACKED ? ((ASSIGNEDBOX.h - *POUTERGAP * *PKEEPUPPERGAP) - *POUTERGAP * (barsToDraw)) / barsToDraw : ASSIGNEDBOX.h - *POUTERGAP * *PKEEPUPPERGAP;
m_barWidth = *PSTACKED ? ASSIGNEDBOX.w : (ASSIGNEDBOX.w - *PINNERGAP * (barsToDraw - 1)) / barsToDraw;
m_barHeight = *PSTACKED ? ((ASSIGNEDBOX.h - *POUTERGAP * *PKEEPUPPERGAP) - *POUTERGAP * (barsToDraw)) / barsToDraw : ASSIGNEDBOX.h - *POUTERGAP * *PKEEPUPPERGAP;
const auto DESIREDHEIGHT = *PSTACKED ? (ONEBARHEIGHT * m_dwGroupMembers.size()) + *POUTERGAP * *PKEEPUPPERGAP : *POUTERGAP * (1 + *PKEEPUPPERGAP) + ONEBARHEIGHT;
if (DESIREDHEIGHT != ASSIGNEDBOX.h)
@ -143,13 +143,13 @@ 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->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,
CBox rect = {ASSIGNEDBOX.x + xoff - pMonitor->m_position.x + m_window->m_floatingOffset.x,
ASSIGNEDBOX.y + ASSIGNEDBOX.h - floor(yoff) - *PINDICATORHEIGHT - *POUTERGAP - pMonitor->m_position.y + m_window->m_floatingOffset.y, m_barWidth,
*PINDICATORHEIGHT};
rect.scale(pMonitor->m_scale).round();
const bool GROUPLOCKED = m_pWindow->getGroupHead()->m_groupData.locked || g_pKeybindManager->m_groupsLocked;
const bool GROUPLOCKED = m_window->getGroupHead()->m_groupData.locked || g_pKeybindManager->m_groupsLocked;
const auto* const PCOLACTIVE = GROUPLOCKED ? GROUPCOLACTIVELOCKED : GROUPCOLACTIVE;
const auto* const PCOLINACTIVE = GROUPLOCKED ? GROUPCOLINACTIVELOCKED : GROUPCOLINACTIVE;
@ -170,25 +170,25 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) {
double first = rect.w - (*PROUNDING * 2);
rectdata.round = *PROUNDING;
rectdata.clipBox = CBox{rect.pos() - Vector2D{PADDING, 0.F}, Vector2D{first + PADDING, rect.h}};
g_pHyprRenderer->m_sRenderPass.add(makeShared<CRectPassElement>(rectdata));
g_pHyprRenderer->m_renderPass.add(makeShared<CRectPassElement>(rectdata));
rectdata.round = 0;
rectdata.clipBox = CBox{rect.pos() + Vector2D{first, 0.F}, Vector2D{rect.w - first + PADDING, rect.h}};
} else if (i == barsToDraw - 1) {
double first = *PROUNDING * 2;
rectdata.round = 0;
rectdata.clipBox = CBox{rect.pos() - Vector2D{PADDING, 0.F}, Vector2D{first + PADDING, rect.h}};
g_pHyprRenderer->m_sRenderPass.add(makeShared<CRectPassElement>(rectdata));
g_pHyprRenderer->m_renderPass.add(makeShared<CRectPassElement>(rectdata));
rectdata.round = *PROUNDING;
rectdata.clipBox = CBox{rect.pos() + Vector2D{first, 0.F}, Vector2D{rect.w - first + PADDING, rect.h}};
}
} else
rectdata.round = *PROUNDING;
}
g_pHyprRenderer->m_sRenderPass.add(makeShared<CRectPassElement>(rectdata));
g_pHyprRenderer->m_renderPass.add(makeShared<CRectPassElement>(rectdata));
}
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,
rect = {ASSIGNEDBOX.x + xoff - pMonitor->m_position.x + m_window->m_floatingOffset.x,
ASSIGNEDBOX.y + ASSIGNEDBOX.h - floor(yoff) - ONEBARHEIGHT - pMonitor->m_position.y + m_window->m_floatingOffset.y, m_barWidth,
(*PGRADIENTS || *PRENDERTITLES ? *PHEIGHT : 0)};
rect.scale(pMonitor->m_scale);
@ -196,7 +196,7 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) {
if (*PGRADIENTS) {
const auto GRADIENTTEX = (m_dwGroupMembers[WINDOWINDEX] == g_pCompositor->m_lastWindow ? (GROUPLOCKED ? m_tGradientLockedActive : m_tGradientActive) :
(GROUPLOCKED ? m_tGradientLockedInactive : m_tGradientInactive));
if (GRADIENTTEX->m_iTexID) {
if (GRADIENTTEX->m_texID) {
CTexPassElement::SRenderData data;
data.tex = GRADIENTTEX;
data.box = rect;
@ -210,21 +210,21 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) {
double first = rect.w - (*PGRADIENTROUNDING * 2);
data.round = *PGRADIENTROUNDING;
data.clipBox = CBox{rect.pos() - Vector2D{PADDING, 0.F}, Vector2D{first + PADDING, rect.h}};
g_pHyprRenderer->m_sRenderPass.add(makeShared<CTexPassElement>(data));
g_pHyprRenderer->m_renderPass.add(makeShared<CTexPassElement>(data));
data.round = 0;
data.clipBox = CBox{rect.pos() + Vector2D{first, 0.F}, Vector2D{rect.w - first + PADDING, rect.h}};
} else if (i == barsToDraw - 1) {
double first = *PGRADIENTROUNDING * 2;
data.round = 0;
data.clipBox = CBox{rect.pos() - Vector2D{PADDING, 0.F}, Vector2D{first + PADDING, rect.h}};
g_pHyprRenderer->m_sRenderPass.add(makeShared<CTexPassElement>(data));
g_pHyprRenderer->m_renderPass.add(makeShared<CTexPassElement>(data));
data.round = *PGRADIENTROUNDING;
data.clipBox = CBox{rect.pos() + Vector2D{first, 0.F}, Vector2D{rect.w - first + PADDING, rect.h}};
}
} else
data.round = *PGRADIENTROUNDING;
}
g_pHyprRenderer->m_sRenderPass.add(makeShared<CTexPassElement>(data));
g_pHyprRenderer->m_renderPass.add(makeShared<CTexPassElement>(data));
}
}
@ -232,31 +232,31 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) {
CTitleTex* pTitleTex = textureFromTitle(m_dwGroupMembers[WINDOWINDEX]->m_title);
if (!pTitleTex)
pTitleTex = m_sTitleTexs.titleTexs
pTitleTex = m_titleTexs.titleTexs
.emplace_back(makeUnique<CTitleTex>(m_dwGroupMembers[WINDOWINDEX].lock(),
Vector2D{m_fBarWidth * pMonitor->m_scale, (*PTITLEFONTSIZE + 2L * BAR_TEXT_PAD) * pMonitor->m_scale},
Vector2D{m_barWidth * 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->m_scale));
rect.height = titleTex->m_vSize.y;
rect.width = titleTex->m_vSize.x;
rect.x += std::round(((m_fBarWidth * pMonitor->m_scale) / 2.0) - (titleTex->m_vSize.x / 2.0));
const auto titleTex = m_dwGroupMembers[WINDOWINDEX] == g_pCompositor->m_lastWindow ? pTitleTex->m_texActive : pTitleTex->m_texInactive;
rect.y += std::ceil(((rect.height - titleTex->m_size.y) / 2.0) - (*PTEXTOFFSET * pMonitor->m_scale));
rect.height = titleTex->m_size.y;
rect.width = titleTex->m_size.x;
rect.x += std::round(((m_barWidth * pMonitor->m_scale) / 2.0) - (titleTex->m_size.x / 2.0));
rect.round();
CTexPassElement::SRenderData data;
data.tex = titleTex;
data.box = rect;
data.a = a;
g_pHyprRenderer->m_sRenderPass.add(makeShared<CTexPassElement>(data));
g_pHyprRenderer->m_renderPass.add(makeShared<CTexPassElement>(data));
}
}
if (*PSTACKED)
yoff += ONEBARHEIGHT;
else
xoff += *PINNERGAP + m_fBarWidth;
xoff += *PINNERGAP + m_barWidth;
}
if (*PRENDERTITLES)
@ -264,8 +264,8 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) {
}
CTitleTex* CHyprGroupBarDecoration::textureFromTitle(const std::string& title) {
for (auto const& tex : m_sTitleTexs.titleTexs) {
if (tex->szContent == title)
for (auto const& tex : m_titleTexs.titleTexs) {
if (tex->m_content == title)
return tex.get();
}
@ -273,10 +273,10 @@ CTitleTex* CHyprGroupBarDecoration::textureFromTitle(const std::string& title) {
}
void CHyprGroupBarDecoration::invalidateTextures() {
m_sTitleTexs.titleTexs.clear();
m_titleTexs.titleTexs.clear();
}
CTitleTex::CTitleTex(PHLWINDOW pWindow, const Vector2D& bufferSize, const float monitorScale) : szContent(pWindow->m_title), pWindowOwner(pWindow) {
CTitleTex::CTitleTex(PHLWINDOW pWindow, const Vector2D& bufferSize, const float monitorScale) : m_content(pWindow->m_title), m_windowOwner(pWindow) {
static auto FALLBACKFONT = CConfigValue<std::string>("misc:font_family");
static auto PTITLEFONTFAMILY = CConfigValue<std::string>("group:groupbar:font_family");
static auto PTITLEFONTSIZE = CConfigValue<Hyprlang::INT>("group:groupbar:font_size");
@ -291,8 +291,8 @@ CTitleTex::CTitleTex(PHLWINDOW pWindow, const Vector2D& bufferSize, const float
const CHyprColor COLOR = CHyprColor(*PTEXTCOLOR);
const auto FONTFAMILY = *PTITLEFONTFAMILY != STRVAL_EMPTY ? *PTITLEFONTFAMILY : *FALLBACKFONT;
texActive = g_pHyprOpenGL->renderText(pWindow->m_title, COLOR, *PTITLEFONTSIZE * monitorScale, false, FONTFAMILY, bufferSize.x - 2, FONTWEIGHTACTIVE->m_value);
texInactive = g_pHyprOpenGL->renderText(pWindow->m_title, COLOR, *PTITLEFONTSIZE * monitorScale, false, FONTFAMILY, bufferSize.x - 2, FONTWEIGHTINACTIVE->m_value);
m_texActive = g_pHyprOpenGL->renderText(pWindow->m_title, COLOR, *PTITLEFONTSIZE * monitorScale, false, FONTFAMILY, bufferSize.x - 2, FONTWEIGHTACTIVE->m_value);
m_texInactive = g_pHyprOpenGL->renderText(pWindow->m_title, COLOR, *PTITLEFONTSIZE * monitorScale, false, FONTFAMILY, bufferSize.x - 2, FONTWEIGHTINACTIVE->m_value);
}
static void renderGradientTo(SP<CTexture> tex, CGradientValueData* grad) {
@ -329,7 +329,7 @@ static void renderGradientTo(SP<CTexture> tex, CGradientValueData* grad) {
// copy the data to an OpenGL texture we have
const auto DATA = cairo_image_surface_get_data(CAIROSURFACE);
tex->allocate();
glBindTexture(GL_TEXTURE_2D, tex->m_iTexID);
glBindTexture(GL_TEXTURE_2D, tex->m_texID);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
@ -360,7 +360,7 @@ void refreshGroupBarGradients() {
g_pHyprRenderer->makeEGLCurrent();
if (m_tGradientActive->m_iTexID != 0) {
if (m_tGradientActive->m_texID != 0) {
m_tGradientActive->destroyTexture();
m_tGradientInactive->destroyTexture();
m_tGradientLockedActive->destroyTexture();
@ -380,20 +380,20 @@ bool CHyprGroupBarDecoration::onBeginWindowDragOnDeco(const Vector2D& pos) {
static auto PSTACKED = CConfigValue<Hyprlang::INT>("group:groupbar:stacked");
static auto POUTERGAP = CConfigValue<Hyprlang::INT>("group:groupbar:gaps_out");
static auto PINNERGAP = CConfigValue<Hyprlang::INT>("group:groupbar:gaps_in");
if (m_pWindow.lock() == m_pWindow->m_groupData.pNextWindow.lock())
if (m_window.lock() == m_window->m_groupData.pNextWindow.lock())
return false;
const float BARRELATIVEX = pos.x - assignedBoxGlobal().x;
const float BARRELATIVEY = pos.y - assignedBoxGlobal().y;
const int WINDOWINDEX = *PSTACKED ? (BARRELATIVEY / (m_fBarHeight + *POUTERGAP)) : (BARRELATIVEX) / (m_fBarWidth + *PINNERGAP);
const int WINDOWINDEX = *PSTACKED ? (BARRELATIVEY / (m_barHeight + *POUTERGAP)) : (BARRELATIVEX) / (m_barWidth + *PINNERGAP);
if (!*PSTACKED && (BARRELATIVEX - (m_fBarWidth + *PINNERGAP) * WINDOWINDEX > m_fBarWidth))
if (!*PSTACKED && (BARRELATIVEX - (m_barWidth + *PINNERGAP) * WINDOWINDEX > m_barWidth))
return false;
if (*PSTACKED && (BARRELATIVEY - (m_fBarHeight + *POUTERGAP) * WINDOWINDEX < *POUTERGAP))
if (*PSTACKED && (BARRELATIVEY - (m_barHeight + *POUTERGAP) * WINDOWINDEX < *POUTERGAP))
return false;
PHLWINDOW pWindow = m_pWindow->getGroupWindowByIndex(WINDOWINDEX);
PHLWINDOW pWindow = m_window->getGroupWindowByIndex(WINDOWINDEX);
// hack
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(pWindow);
@ -419,21 +419,21 @@ bool CHyprGroupBarDecoration::onEndWindowDragOnDeco(const Vector2D& pos, PHLWIND
static auto PMERGEGROUPSONGROUPBAR = CConfigValue<Hyprlang::INT>("group:merge_groups_on_groupbar");
static auto POUTERGAP = CConfigValue<Hyprlang::INT>("group:groupbar:gaps_out");
static auto PINNERGAP = CConfigValue<Hyprlang::INT>("group:groupbar:gaps_in");
const bool FLOATEDINTOTILED = !m_pWindow->m_isFloating && !pDraggedWindow->m_draggingTiled;
const bool FLOATEDINTOTILED = !m_window->m_isFloating && !pDraggedWindow->m_draggingTiled;
g_pInputManager->m_wasDraggingWindow = false;
if (!pDraggedWindow->canBeGroupedInto(m_pWindow.lock()) || (*PDRAGINTOGROUP != 1 && *PDRAGINTOGROUP != 2) || (FLOATEDINTOTILED && !*PMERGEFLOATEDINTOTILEDONGROUPBAR) ||
(!*PMERGEGROUPSONGROUPBAR && pDraggedWindow->m_groupData.pNextWindow.lock() && m_pWindow->m_groupData.pNextWindow.lock())) {
if (!pDraggedWindow->canBeGroupedInto(m_window.lock()) || (*PDRAGINTOGROUP != 1 && *PDRAGINTOGROUP != 2) || (FLOATEDINTOTILED && !*PMERGEFLOATEDINTOTILEDONGROUPBAR) ||
(!*PMERGEGROUPSONGROUPBAR && pDraggedWindow->m_groupData.pNextWindow.lock() && m_window->m_groupData.pNextWindow.lock())) {
g_pInputManager->m_wasDraggingWindow = true;
return false;
}
const float BARRELATIVE = *PSTACKED ? pos.y - assignedBoxGlobal().y - (m_fBarHeight + *POUTERGAP) / 2 : pos.x - assignedBoxGlobal().x - m_fBarWidth / 2;
const float BARSIZE = *PSTACKED ? m_fBarHeight + *POUTERGAP : m_fBarWidth + *PINNERGAP;
const float BARRELATIVE = *PSTACKED ? pos.y - assignedBoxGlobal().y - (m_barHeight + *POUTERGAP) / 2 : pos.x - assignedBoxGlobal().x - m_barWidth / 2;
const float BARSIZE = *PSTACKED ? m_barHeight + *POUTERGAP : m_barWidth + *PINNERGAP;
const int WINDOWINDEX = BARRELATIVE < 0 ? -1 : BARRELATIVE / BARSIZE;
PHLWINDOW pWindowInsertAfter = m_pWindow->getGroupWindowByIndex(WINDOWINDEX);
PHLWINDOW pWindowInsertAfter = m_window->getGroupWindowByIndex(WINDOWINDEX);
PHLWINDOW pWindowInsertEnd = pWindowInsertAfter->m_groupData.pNextWindow.lock();
PHLWINDOW pDraggedHead = pDraggedWindow->m_groupData.pNextWindow.lock() ? pDraggedWindow->getGroupHead() : pDraggedWindow;
@ -478,7 +478,7 @@ bool CHyprGroupBarDecoration::onEndWindowDragOnDeco(const Vector2D& pos, PHLWIND
if (WINDOWINDEX == -1)
std::swap(pDraggedHead->m_groupData.head, pWindowInsertEnd->m_groupData.head);
m_pWindow->setGroupCurrent(pDraggedWindow);
m_window->setGroupCurrent(pDraggedWindow);
pDraggedWindow->applyGroupRules();
pDraggedWindow->updateWindowDecos();
g_pLayoutManager->getCurrentLayout()->recalculateWindow(pDraggedWindow);
@ -493,12 +493,12 @@ bool CHyprGroupBarDecoration::onMouseButtonOnDeco(const Vector2D& pos, const IPo
static auto PSTACKED = CConfigValue<Hyprlang::INT>("group:groupbar:stacked");
static auto POUTERGAP = CConfigValue<Hyprlang::INT>("group:groupbar:gaps_out");
static auto PINNERGAP = CConfigValue<Hyprlang::INT>("group:groupbar:gaps_in");
if (m_pWindow->isEffectiveInternalFSMode(FSMODE_FULLSCREEN))
if (m_window->isEffectiveInternalFSMode(FSMODE_FULLSCREEN))
return true;
const float BARRELATIVEX = pos.x - assignedBoxGlobal().x;
const float BARRELATIVEY = pos.y - assignedBoxGlobal().y;
const int WINDOWINDEX = *PSTACKED ? (BARRELATIVEY / (m_fBarHeight + *POUTERGAP)) : (BARRELATIVEX) / (m_fBarWidth + *PINNERGAP);
const int WINDOWINDEX = *PSTACKED ? (BARRELATIVEY / (m_barHeight + *POUTERGAP)) : (BARRELATIVEX) / (m_barWidth + *PINNERGAP);
static auto PFOLLOWMOUSE = CConfigValue<Hyprlang::INT>("input:follow_mouse");
// close window on middle click
@ -508,7 +508,7 @@ bool CHyprGroupBarDecoration::onMouseButtonOnDeco(const Vector2D& pos, const IPo
if (e.state == WL_POINTER_BUTTON_STATE_PRESSED)
pressedCursorPos = pos;
else if (e.state == WL_POINTER_BUTTON_STATE_RELEASED && pressedCursorPos == pos)
g_pXWaylandManager->sendCloseWindow(m_pWindow->getGroupWindowByIndex(WINDOWINDEX));
g_pXWaylandManager->sendCloseWindow(m_window->getGroupWindowByIndex(WINDOWINDEX));
return true;
}
@ -517,17 +517,17 @@ bool CHyprGroupBarDecoration::onMouseButtonOnDeco(const Vector2D& pos, const IPo
return true;
// click on padding
const auto TABPAD = !*PSTACKED && (BARRELATIVEX - (m_fBarWidth + *PINNERGAP) * WINDOWINDEX > m_fBarWidth);
const auto STACKPAD = *PSTACKED && (BARRELATIVEY - (m_fBarHeight + *POUTERGAP) * WINDOWINDEX < *POUTERGAP);
const auto TABPAD = !*PSTACKED && (BARRELATIVEX - (m_barWidth + *PINNERGAP) * WINDOWINDEX > m_barWidth);
const auto STACKPAD = *PSTACKED && (BARRELATIVEY - (m_barHeight + *POUTERGAP) * WINDOWINDEX < *POUTERGAP);
if (TABPAD || STACKPAD) {
if (!g_pCompositor->isWindowActive(m_pWindow.lock()))
g_pCompositor->focusWindow(m_pWindow.lock());
if (!g_pCompositor->isWindowActive(m_window.lock()))
g_pCompositor->focusWindow(m_window.lock());
return true;
}
PHLWINDOW pWindow = m_pWindow->getGroupWindowByIndex(WINDOWINDEX);
PHLWINDOW pWindow = m_window->getGroupWindowByIndex(WINDOWINDEX);
if (pWindow != m_pWindow)
if (pWindow != m_window)
pWindow->setGroupCurrent(pWindow);
if (!g_pCompositor->isWindowActive(pWindow) && *PFOLLOWMOUSE != 3)
@ -542,13 +542,13 @@ bool CHyprGroupBarDecoration::onMouseButtonOnDeco(const Vector2D& pos, const IPo
bool CHyprGroupBarDecoration::onScrollOnDeco(const Vector2D& pos, const IPointer::SAxisEvent e) {
static auto PGROUPBARSCROLLING = CConfigValue<Hyprlang::INT>("group:groupbar:scrolling");
if (!*PGROUPBARSCROLLING || m_pWindow->m_groupData.pNextWindow.expired())
if (!*PGROUPBARSCROLLING || m_window->m_groupData.pNextWindow.expired())
return false;
if (e.delta > 0)
m_pWindow->setGroupCurrent(m_pWindow->m_groupData.pNextWindow.lock());
m_window->setGroupCurrent(m_window->m_groupData.pNextWindow.lock());
else
m_pWindow->setGroupCurrent(m_pWindow->getGroupPrevious());
m_window->setGroupCurrent(m_window->getGroupPrevious());
return true;
}
@ -576,12 +576,12 @@ std::string CHyprGroupBarDecoration::getDisplayName() {
}
CBox CHyprGroupBarDecoration::assignedBoxGlobal() {
CBox box = m_bAssignedBox;
box.translate(g_pDecorationPositioner->getEdgeDefinedPoint(DECORATION_EDGE_TOP, m_pWindow.lock()));
CBox box = m_assignedBox;
box.translate(g_pDecorationPositioner->getEdgeDefinedPoint(DECORATION_EDGE_TOP, m_window.lock()));
const auto PWORKSPACE = m_pWindow->m_workspace;
const auto PWORKSPACE = m_window->m_workspace;
if (PWORKSPACE && !m_pWindow->m_pinned)
if (PWORKSPACE && !m_window->m_pinned)
box.translate(PWORKSPACE->m_renderOffset->value());
return box.round();

View file

@ -12,11 +12,11 @@ class CTitleTex {
CTitleTex(PHLWINDOW pWindow, const Vector2D& bufferSize, const float monitorScale);
~CTitleTex() = default;
SP<CTexture> texActive;
SP<CTexture> texInactive;
std::string szContent;
SP<CTexture> m_texActive;
SP<CTexture> m_texInactive;
std::string m_content;
PHLWINDOWREF pWindowOwner;
PHLWINDOWREF m_windowOwner;
};
void refreshGroupBarGradients();
@ -47,16 +47,14 @@ class CHyprGroupBarDecoration : public IHyprWindowDecoration {
virtual std::string getDisplayName();
private:
SBoxExtents m_seExtents;
CBox m_assignedBox = {0};
CBox m_bAssignedBox = {0};
PHLWINDOWREF m_pWindow;
PHLWINDOWREF m_window;
std::vector<PHLWINDOWREF> m_dwGroupMembers;
float m_fBarWidth;
float m_fBarHeight;
float m_barWidth;
float m_barHeight;
CTitleTex* textureFromTitle(const std::string&);
void invalidateTextures();
@ -71,5 +69,5 @@ class CHyprGroupBarDecoration : public IHyprWindowDecoration {
struct STitleTexs {
// STitleTexs* overriden = nullptr; // TODO: make shit shared in-group to decrease VRAM usage.
std::vector<UP<CTitleTex>> titleTexs;
} m_sTitleTexs;
} m_titleTexs;
};

View file

@ -59,10 +59,10 @@ Vector2D CDecorationPositioner::getEdgeDefinedPoint(uint32_t edges, PHLWINDOW pW
}
void CDecorationPositioner::uncacheDecoration(IHyprWindowDecoration* deco) {
std::erase_if(m_vWindowPositioningDatas, [&](const auto& data) { return !data->pWindow.lock() || data->pDecoration == deco; });
std::erase_if(m_windowPositioningDatas, [&](const auto& data) { return !data->pWindow.lock() || data->pDecoration == deco; });
const auto WIT = std::find_if(m_mWindowDatas.begin(), m_mWindowDatas.end(), [&](const auto& other) { return other.first.lock() == deco->m_pWindow.lock(); });
if (WIT == m_mWindowDatas.end())
const auto WIT = std::find_if(m_windowDatas.begin(), m_windowDatas.end(), [&](const auto& other) { return other.first.lock() == deco->m_window.lock(); });
if (WIT == m_windowDatas.end())
return;
WIT->second.needsRecalc = true;
@ -70,16 +70,16 @@ void CDecorationPositioner::uncacheDecoration(IHyprWindowDecoration* deco) {
void CDecorationPositioner::repositionDeco(IHyprWindowDecoration* deco) {
uncacheDecoration(deco);
onWindowUpdate(deco->m_pWindow.lock());
onWindowUpdate(deco->m_window.lock());
}
CDecorationPositioner::SWindowPositioningData* CDecorationPositioner::getDataFor(IHyprWindowDecoration* pDecoration, PHLWINDOW pWindow) {
auto it = std::find_if(m_vWindowPositioningDatas.begin(), m_vWindowPositioningDatas.end(), [&](const auto& el) { return el->pDecoration == pDecoration; });
auto it = std::find_if(m_windowPositioningDatas.begin(), m_windowPositioningDatas.end(), [&](const auto& el) { return el->pDecoration == pDecoration; });
if (it != m_vWindowPositioningDatas.end())
if (it != m_windowPositioningDatas.end())
return it->get();
const auto DATA = m_vWindowPositioningDatas.emplace_back(makeUnique<CDecorationPositioner::SWindowPositioningData>(pWindow, pDecoration)).get();
const auto DATA = m_windowPositioningDatas.emplace_back(makeUnique<CDecorationPositioner::SWindowPositioningData>(pWindow, pDecoration)).get();
DATA->positioningInfo = pDecoration->getPositioningInfo();
@ -87,8 +87,8 @@ CDecorationPositioner::SWindowPositioningData* CDecorationPositioner::getDataFor
}
void CDecorationPositioner::sanitizeDatas() {
std::erase_if(m_mWindowDatas, [](const auto& other) { return !valid(other.first); });
std::erase_if(m_vWindowPositioningDatas, [](const auto& other) {
std::erase_if(m_windowDatas, [](const auto& other) { return !valid(other.first); });
std::erase_if(m_windowPositioningDatas, [](const auto& other) {
if (!validMapped(other->pWindow))
return true;
if (std::find_if(other->pWindow->m_windowDecorations.begin(), other->pWindow->m_windowDecorations.end(), [&](const auto& el) { return el.get() == other->pDecoration; }) ==
@ -99,8 +99,8 @@ void CDecorationPositioner::sanitizeDatas() {
}
void CDecorationPositioner::forceRecalcFor(PHLWINDOW pWindow) {
const auto WIT = std::find_if(m_mWindowDatas.begin(), m_mWindowDatas.end(), [&](const auto& other) { return other.first.lock() == pWindow; });
if (WIT == m_mWindowDatas.end())
const auto WIT = std::find_if(m_windowDatas.begin(), m_windowDatas.end(), [&](const auto& other) { return other.first.lock() == pWindow; });
if (WIT == m_windowDatas.end())
return;
const auto WINDOWDATA = &WIT->second;
@ -112,8 +112,8 @@ void CDecorationPositioner::onWindowUpdate(PHLWINDOW pWindow) {
if (!validMapped(pWindow))
return;
const auto WIT = std::find_if(m_mWindowDatas.begin(), m_mWindowDatas.end(), [&](const auto& other) { return other.first.lock() == pWindow; });
if (WIT == m_mWindowDatas.end())
const auto WIT = std::find_if(m_windowDatas.begin(), m_windowDatas.end(), [&](const auto& other) { return other.first.lock() == pWindow; });
if (WIT == m_windowDatas.end())
return;
const auto WINDOWDATA = &WIT->second;
@ -130,7 +130,7 @@ void CDecorationPositioner::onWindowUpdate(PHLWINDOW pWindow) {
}
if (WINDOWDATA->lastWindowSize == pWindow->m_realSize->value() /* position not changed */
&& std::all_of(m_vWindowPositioningDatas.begin(), m_vWindowPositioningDatas.end(),
&& std::all_of(m_windowPositioningDatas.begin(), m_windowPositioningDatas.end(),
[pWindow](const auto& data) { return pWindow != data->pWindow.lock() || !data->needsReposition; })
/* all window datas are either not for this window or don't need a reposition */
&& !WINDOWDATA->needsRecalc /* window doesn't need recalc */
@ -282,17 +282,17 @@ void CDecorationPositioner::onWindowUpdate(PHLWINDOW pWindow) {
}
void CDecorationPositioner::onWindowUnmap(PHLWINDOW pWindow) {
std::erase_if(m_vWindowPositioningDatas, [&](const auto& data) { return data->pWindow.lock() == pWindow; });
m_mWindowDatas.erase(pWindow);
std::erase_if(m_windowPositioningDatas, [&](const auto& data) { return data->pWindow.lock() == pWindow; });
m_windowDatas.erase(pWindow);
}
void CDecorationPositioner::onWindowMap(PHLWINDOW pWindow) {
m_mWindowDatas[pWindow] = {};
m_windowDatas[pWindow] = {};
}
SBoxExtents CDecorationPositioner::getWindowDecorationReserved(PHLWINDOW pWindow) {
try {
const auto E = m_mWindowDatas.at(pWindow);
const auto E = m_windowDatas.at(pWindow);
return E.reserved;
} catch (std::out_of_range& e) { return {}; }
}
@ -301,7 +301,7 @@ SBoxExtents CDecorationPositioner::getWindowDecorationExtents(PHLWINDOW pWindow,
CBox const mainSurfaceBox = pWindow->getWindowMainSurfaceBox();
CBox accum = mainSurfaceBox;
for (auto const& data : m_vWindowPositioningDatas) {
for (auto const& data : m_windowPositioningDatas) {
if (!data->pDecoration || (inputOnly && !(data->pDecoration->getDecorationFlags() & DECORATION_ALLOWS_MOUSE_INPUT)))
continue;
@ -349,7 +349,7 @@ SBoxExtents CDecorationPositioner::getWindowDecorationExtents(PHLWINDOW pWindow,
CBox CDecorationPositioner::getBoxWithIncludedDecos(PHLWINDOW pWindow) {
CBox accum = pWindow->getWindowMainSurfaceBox();
for (auto const& data : m_vWindowPositioningDatas) {
for (auto const& data : m_windowPositioningDatas) {
if (data->pWindow.lock() != pWindow)
continue;
@ -385,7 +385,7 @@ CBox CDecorationPositioner::getBoxWithIncludedDecos(PHLWINDOW pWindow) {
}
CBox CDecorationPositioner::getWindowDecorationBox(IHyprWindowDecoration* deco) {
auto const window = deco->m_pWindow.lock();
auto const window = deco->m_window.lock();
const auto DATA = getDataFor(deco, window);
CBox box = DATA->lastReply.assignedGeometry;

View file

@ -87,8 +87,8 @@ class CDecorationPositioner {
bool needsRecalc = false;
};
std::map<PHLWINDOWREF, SWindowData> m_mWindowDatas;
std::vector<UP<SWindowPositioningData>> m_vWindowPositioningDatas;
std::map<PHLWINDOWREF, SWindowData> m_windowDatas;
std::vector<UP<SWindowPositioningData>> m_windowPositioningDatas;
SWindowPositioningData* getDataFor(IHyprWindowDecoration* pDecoration, PHLWINDOW pWindow);
void onWindowUnmap(PHLWINDOW pWindow);

View file

@ -2,7 +2,7 @@
class CWindow;
IHyprWindowDecoration::IHyprWindowDecoration(PHLWINDOW pWindow) : m_pWindow(pWindow) {
IHyprWindowDecoration::IHyprWindowDecoration(PHLWINDOW pWindow) : m_window(pWindow) {
;
}

View file

@ -56,7 +56,7 @@ class IHyprWindowDecoration {
virtual std::string getDisplayName();
private:
PHLWINDOWREF m_pWindow;
PHLWINDOWREF m_window;
friend class CDecorationPositioner;
};