windows: refactor class member vars (#10168)
This commit is contained in:
parent
c505eb55ff
commit
2118440488
43 changed files with 2124 additions and 2134 deletions
|
|
@ -36,12 +36,12 @@ 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()));
|
||||
|
||||
const auto PWORKSPACE = m_pWindow->m_pWorkspace;
|
||||
const auto PWORKSPACE = m_pWindow->m_workspace;
|
||||
|
||||
if (!PWORKSPACE)
|
||||
return box;
|
||||
|
||||
const auto WORKSPACEOFFSET = PWORKSPACE && !m_pWindow->m_bPinned ? PWORKSPACE->m_renderOffset->value() : Vector2D();
|
||||
const auto WORKSPACEOFFSET = PWORKSPACE && !m_pWindow->m_pinned ? PWORKSPACE->m_renderOffset->value() : Vector2D();
|
||||
return box.translate(WORKSPACEOFFSET);
|
||||
}
|
||||
|
||||
|
|
@ -52,22 +52,22 @@ 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_vFloatingOffset).expand(-m_pWindow->getRealBorderSize()).scale(pMonitor->scale).round();
|
||||
CBox windowBox = assignedBoxGlobal().translate(-pMonitor->vecPosition + m_pWindow->m_floatingOffset).expand(-m_pWindow->getRealBorderSize()).scale(pMonitor->scale).round();
|
||||
|
||||
if (windowBox.width < 1 || windowBox.height < 1)
|
||||
return;
|
||||
|
||||
auto grad = m_pWindow->m_cRealBorderColor;
|
||||
const bool ANIMATED = m_pWindow->m_fBorderFadeAnimationProgress->isBeingAnimated();
|
||||
auto grad = m_pWindow->m_realBorderColor;
|
||||
const bool ANIMATED = m_pWindow->m_borderFadeAnimationProgress->isBeingAnimated();
|
||||
|
||||
if (m_pWindow->m_fBorderAngleAnimationProgress->enabled()) {
|
||||
grad.m_angle += m_pWindow->m_fBorderAngleAnimationProgress->value() * M_PI * 2;
|
||||
if (m_pWindow->m_borderAngleAnimationProgress->enabled()) {
|
||||
grad.m_angle += m_pWindow->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_cRealBorderColorPrevious.m_angle = grad.m_angle;
|
||||
m_pWindow->m_realBorderColorPrevious.m_angle = grad.m_angle;
|
||||
}
|
||||
|
||||
int borderSize = m_pWindow->getRealBorderSize();
|
||||
|
|
@ -84,9 +84,9 @@ void CHyprBorderDecoration::draw(PHLMONITOR pMonitor, float const& a) {
|
|||
|
||||
if (ANIMATED) {
|
||||
data.hasGrad2 = true;
|
||||
data.grad1 = m_pWindow->m_cRealBorderColorPrevious;
|
||||
data.grad1 = m_pWindow->m_realBorderColorPrevious;
|
||||
data.grad2 = grad;
|
||||
data.lerp = m_pWindow->m_fBorderFadeAnimationProgress->value();
|
||||
data.lerp = m_pWindow->m_borderFadeAnimationProgress->value();
|
||||
}
|
||||
|
||||
g_pHyprRenderer->m_sRenderPass.add(makeShared<CBorderPassElement>(data));
|
||||
|
|
@ -119,10 +119,10 @@ void CHyprBorderDecoration::damageEntire() {
|
|||
const auto ROUNDINGSIZE = ROUNDING - M_SQRT1_2 * ROUNDING + 2;
|
||||
const auto BORDERSIZE = m_pWindow->getRealBorderSize() + 1;
|
||||
|
||||
const auto PWINDOWWORKSPACE = m_pWindow->m_pWorkspace;
|
||||
if (PWINDOWWORKSPACE && PWINDOWWORKSPACE->m_renderOffset->isBeingAnimated() && !m_pWindow->m_bPinned)
|
||||
const auto PWINDOWWORKSPACE = m_pWindow->m_workspace;
|
||||
if (PWINDOWWORKSPACE && PWINDOWWORKSPACE->m_renderOffset->isBeingAnimated() && !m_pWindow->m_pinned)
|
||||
surfaceBox.translate(PWINDOWWORKSPACE->m_renderOffset->value());
|
||||
surfaceBox.translate(m_pWindow->m_vFloatingOffset);
|
||||
surfaceBox.translate(m_pWindow->m_floatingOffset);
|
||||
|
||||
CBox surfaceBoxExpandedBorder = surfaceBox;
|
||||
surfaceBoxExpandedBorder.expand(BORDERSIZE);
|
||||
|
|
@ -157,5 +157,5 @@ std::string CHyprBorderDecoration::getDisplayName() {
|
|||
}
|
||||
|
||||
bool CHyprBorderDecoration::doesntWantBorders() {
|
||||
return m_pWindow->m_sWindowData.noBorder.valueOrDefault() || m_pWindow->m_bX11DoesntWantBorders || m_pWindow->getRealBorderSize() == 0;
|
||||
return m_pWindow->m_windowData.noBorder.valueOrDefault() || m_pWindow->m_X11DoesntWantBorders || m_pWindow->getRealBorderSize() == 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,14 +43,14 @@ void CHyprDropShadowDecoration::damageEntire() {
|
|||
|
||||
const auto PWINDOW = m_pWindow.lock();
|
||||
|
||||
CBox shadowBox = {PWINDOW->m_vRealPosition->value().x - m_seExtents.topLeft.x, PWINDOW->m_vRealPosition->value().y - m_seExtents.topLeft.y,
|
||||
PWINDOW->m_vRealSize->value().x + m_seExtents.topLeft.x + m_seExtents.bottomRight.x,
|
||||
PWINDOW->m_vRealSize->value().y + m_seExtents.topLeft.y + m_seExtents.bottomRight.y};
|
||||
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};
|
||||
|
||||
const auto PWORKSPACE = PWINDOW->m_pWorkspace;
|
||||
if (PWORKSPACE && PWORKSPACE->m_renderOffset->isBeingAnimated() && !PWINDOW->m_bPinned)
|
||||
const auto PWORKSPACE = PWINDOW->m_workspace;
|
||||
if (PWORKSPACE && PWORKSPACE->m_renderOffset->isBeingAnimated() && !PWINDOW->m_pinned)
|
||||
shadowBox.translate(PWORKSPACE->m_renderOffset->value());
|
||||
shadowBox.translate(PWINDOW->m_vFloatingOffset);
|
||||
shadowBox.translate(PWINDOW->m_floatingOffset);
|
||||
|
||||
static auto PSHADOWIGNOREWINDOW = CConfigValue<Hyprlang::INT>("decoration:shadow:ignore_window");
|
||||
const auto ROUNDING = PWINDOW->rounding();
|
||||
|
|
@ -59,9 +59,9 @@ void CHyprDropShadowDecoration::damageEntire() {
|
|||
CRegion shadowRegion(shadowBox);
|
||||
if (*PSHADOWIGNOREWINDOW) {
|
||||
CBox surfaceBox = PWINDOW->getWindowMainSurfaceBox();
|
||||
if (PWORKSPACE && PWORKSPACE->m_renderOffset->isBeingAnimated() && !PWINDOW->m_bPinned)
|
||||
if (PWORKSPACE && PWORKSPACE->m_renderOffset->isBeingAnimated() && !PWINDOW->m_pinned)
|
||||
surfaceBox.translate(PWORKSPACE->m_renderOffset->value());
|
||||
surfaceBox.translate(PWINDOW->m_vFloatingOffset);
|
||||
surfaceBox.translate(PWINDOW->m_floatingOffset);
|
||||
surfaceBox.expand(-ROUNDINGSIZE);
|
||||
shadowRegion.subtract(CRegion(surfaceBox));
|
||||
}
|
||||
|
|
@ -79,8 +79,8 @@ void CHyprDropShadowDecoration::damageEntire() {
|
|||
void CHyprDropShadowDecoration::updateWindow(PHLWINDOW pWindow) {
|
||||
const auto PWINDOW = m_pWindow.lock();
|
||||
|
||||
m_vLastWindowPos = PWINDOW->m_vRealPosition->value();
|
||||
m_vLastWindowSize = PWINDOW->m_vRealSize->value();
|
||||
m_vLastWindowPos = PWINDOW->m_realPosition->value();
|
||||
m_vLastWindowSize = PWINDOW->m_realSize->value();
|
||||
|
||||
m_bLastWindowBox = {m_vLastWindowPos.x, m_vLastWindowPos.y, m_vLastWindowSize.x, m_vLastWindowSize.y};
|
||||
m_bLastWindowBoxWithDecos = g_pDecorationPositioner->getBoxWithIncludedDecos(pWindow);
|
||||
|
|
@ -99,13 +99,13 @@ void CHyprDropShadowDecoration::render(PHLMONITOR pMonitor, float const& a) {
|
|||
if (!validMapped(PWINDOW))
|
||||
return;
|
||||
|
||||
if (PWINDOW->m_cRealShadowColor->value() == CHyprColor(0, 0, 0, 0))
|
||||
if (PWINDOW->m_realShadowColor->value() == CHyprColor(0, 0, 0, 0))
|
||||
return; // don't draw invisible shadows
|
||||
|
||||
if (!PWINDOW->m_sWindowData.decorate.valueOrDefault())
|
||||
if (!PWINDOW->m_windowData.decorate.valueOrDefault())
|
||||
return;
|
||||
|
||||
if (PWINDOW->m_sWindowData.noShadow.valueOrDefault())
|
||||
if (PWINDOW->m_windowData.noShadow.valueOrDefault())
|
||||
return;
|
||||
|
||||
static auto PSHADOWS = CConfigValue<Hyprlang::INT>("decoration:shadow:enabled");
|
||||
|
|
@ -120,8 +120,8 @@ void CHyprDropShadowDecoration::render(PHLMONITOR pMonitor, float const& a) {
|
|||
const auto ROUNDINGBASE = PWINDOW->rounding();
|
||||
const auto ROUNDINGPOWER = PWINDOW->roundingPower();
|
||||
const auto ROUNDING = ROUNDINGBASE > 0 ? ROUNDINGBASE + PWINDOW->getRealBorderSize() : 0;
|
||||
const auto PWORKSPACE = PWINDOW->m_pWorkspace;
|
||||
const auto WORKSPACEOFFSET = PWORKSPACE && !PWINDOW->m_bPinned ? PWORKSPACE->m_renderOffset->value() : Vector2D();
|
||||
const auto PWORKSPACE = PWINDOW->m_workspace;
|
||||
const auto WORKSPACEOFFSET = PWORKSPACE && !PWINDOW->m_pinned ? PWORKSPACE->m_renderOffset->value() : Vector2D();
|
||||
|
||||
// draw the shadow
|
||||
CBox fullBox = m_bLastWindowBoxWithDecos;
|
||||
|
|
@ -142,7 +142,7 @@ void CHyprDropShadowDecoration::render(PHLMONITOR pMonitor, float const& a) {
|
|||
{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}};
|
||||
|
||||
fullBox.translate(PWINDOW->m_vFloatingOffset);
|
||||
fullBox.translate(PWINDOW->m_floatingOffset);
|
||||
|
||||
if (fullBox.width < 1 || fullBox.height < 1)
|
||||
return; // don't draw invisible shadows
|
||||
|
|
@ -165,8 +165,8 @@ void CHyprDropShadowDecoration::render(PHLMONITOR pMonitor, float const& a) {
|
|||
windowBox.translate(-pMonitor->vecPosition + WORKSPACEOFFSET);
|
||||
withDecos.translate(-pMonitor->vecPosition + WORKSPACEOFFSET);
|
||||
|
||||
windowBox.translate(PWINDOW->m_vFloatingOffset);
|
||||
withDecos.translate(PWINDOW->m_vFloatingOffset);
|
||||
windowBox.translate(PWINDOW->m_floatingOffset);
|
||||
withDecos.translate(PWINDOW->m_floatingOffset);
|
||||
|
||||
auto scaledExtentss = withDecos.extentsFrom(windowBox);
|
||||
scaledExtentss = scaledExtentss * pMonitor->scale;
|
||||
|
|
@ -192,7 +192,7 @@ 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_cRealShadowColor->value().a), a);
|
||||
drawShadowInternal(fullBox, ROUNDING * pMonitor->scale, ROUNDINGPOWER, *PSHADOWSIZE * pMonitor->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);
|
||||
|
|
@ -200,7 +200,7 @@ void CHyprDropShadowDecoration::render(PHLMONITOR pMonitor, float const& a) {
|
|||
alphaSwapFB.bind();
|
||||
|
||||
// alpha swap just has the shadow color. It will be the "texture" to render.
|
||||
g_pHyprOpenGL->renderRect(fullBox, PWINDOW->m_cRealShadowColor->value().stripA(), 0);
|
||||
g_pHyprOpenGL->renderRect(fullBox, PWINDOW->m_realShadowColor->value().stripA(), 0);
|
||||
|
||||
LASTFB->bind();
|
||||
|
||||
|
|
@ -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_cRealShadowColor->value(), a);
|
||||
drawShadowInternal(fullBox, ROUNDING * pMonitor->scale, ROUNDINGPOWER, *PSHADOWSIZE * pMonitor->scale, PWINDOW->m_realShadowColor->value(), a);
|
||||
|
||||
if (m_seExtents != m_seReportedExtents)
|
||||
g_pDecorationPositioner->repositionDeco(this);
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ SDecorationPositioningInfo CHyprGroupBarDecoration::getPositioningInfo() {
|
|||
info.priority = *PPRIORITY;
|
||||
info.reserved = true;
|
||||
|
||||
if (*PENABLED && m_pWindow->m_sWindowData.decorate.valueOrDefault()) {
|
||||
if (*PENABLED && m_pWindow->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}};
|
||||
|
|
@ -65,7 +65,7 @@ eDecorationType CHyprGroupBarDecoration::getDecorationType() {
|
|||
//
|
||||
|
||||
void CHyprGroupBarDecoration::updateWindow(PHLWINDOW pWindow) {
|
||||
if (m_pWindow->m_sGroupData.pNextWindow.expired()) {
|
||||
if (m_pWindow->m_groupData.pNextWindow.expired()) {
|
||||
m_pWindow->removeWindowDeco(this);
|
||||
return;
|
||||
}
|
||||
|
|
@ -74,10 +74,10 @@ void CHyprGroupBarDecoration::updateWindow(PHLWINDOW pWindow) {
|
|||
PHLWINDOW head = pWindow->getGroupHead();
|
||||
m_dwGroupMembers.emplace_back(head);
|
||||
|
||||
PHLWINDOW curr = head->m_sGroupData.pNextWindow.lock();
|
||||
PHLWINDOW curr = head->m_groupData.pNextWindow.lock();
|
||||
while (curr != head) {
|
||||
m_dwGroupMembers.emplace_back(curr);
|
||||
curr = curr->m_sGroupData.pNextWindow.lock();
|
||||
curr = curr->m_groupData.pNextWindow.lock();
|
||||
}
|
||||
|
||||
damageEntire();
|
||||
|
|
@ -90,7 +90,7 @@ void CHyprGroupBarDecoration::updateWindow(PHLWINDOW pWindow) {
|
|||
|
||||
void CHyprGroupBarDecoration::damageEntire() {
|
||||
auto box = assignedBoxGlobal();
|
||||
box.translate(m_pWindow->m_vFloatingOffset);
|
||||
box.translate(m_pWindow->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_sWindowData.decorate.valueOrDefault())
|
||||
if (!*PENABLED || !m_pWindow->m_windowData.decorate.valueOrDefault())
|
||||
return;
|
||||
|
||||
static auto PRENDERTITLES = CConfigValue<Hyprlang::INT>("group:groupbar:render_titles");
|
||||
|
|
@ -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->vecPosition.x + m_pWindow->m_vFloatingOffset.x,
|
||||
ASSIGNEDBOX.y + ASSIGNEDBOX.h - floor(yoff) - *PINDICATORHEIGHT - *POUTERGAP - pMonitor->vecPosition.y + m_pWindow->m_vFloatingOffset.y, m_fBarWidth,
|
||||
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,
|
||||
*PINDICATORHEIGHT};
|
||||
|
||||
rect.scale(pMonitor->scale).round();
|
||||
|
||||
const bool GROUPLOCKED = m_pWindow->getGroupHead()->m_sGroupData.locked || g_pKeybindManager->m_bGroupsLocked;
|
||||
const bool GROUPLOCKED = m_pWindow->getGroupHead()->m_groupData.locked || g_pKeybindManager->m_bGroupsLocked;
|
||||
const auto* const PCOLACTIVE = GROUPLOCKED ? GROUPCOLACTIVELOCKED : GROUPCOLACTIVE;
|
||||
const auto* const PCOLINACTIVE = GROUPLOCKED ? GROUPCOLINACTIVELOCKED : GROUPCOLINACTIVE;
|
||||
|
||||
|
|
@ -187,8 +187,8 @@ 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_vFloatingOffset.x,
|
||||
ASSIGNEDBOX.y + ASSIGNEDBOX.h - floor(yoff) - ONEBARHEIGHT - pMonitor->vecPosition.y + m_pWindow->m_vFloatingOffset.y, m_fBarWidth,
|
||||
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,
|
||||
(*PGRADIENTS || *PRENDERTITLES ? *PHEIGHT : 0)};
|
||||
rect.scale(pMonitor->scale);
|
||||
|
||||
|
|
@ -229,7 +229,7 @@ void CHyprGroupBarDecoration::draw(PHLMONITOR pMonitor, float const& a) {
|
|||
}
|
||||
|
||||
if (*PRENDERTITLES) {
|
||||
CTitleTex* pTitleTex = textureFromTitle(m_dwGroupMembers[WINDOWINDEX]->m_szTitle);
|
||||
CTitleTex* pTitleTex = textureFromTitle(m_dwGroupMembers[WINDOWINDEX]->m_title);
|
||||
|
||||
if (!pTitleTex)
|
||||
pTitleTex =
|
||||
|
|
@ -276,7 +276,7 @@ void CHyprGroupBarDecoration::invalidateTextures() {
|
|||
m_sTitleTexs.titleTexs.clear();
|
||||
}
|
||||
|
||||
CTitleTex::CTitleTex(PHLWINDOW pWindow, const Vector2D& bufferSize, const float monitorScale) : szContent(pWindow->m_szTitle), pWindowOwner(pWindow) {
|
||||
CTitleTex::CTitleTex(PHLWINDOW pWindow, const Vector2D& bufferSize, const float monitorScale) : szContent(pWindow->m_title), pWindowOwner(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_szTitle, COLOR, *PTITLEFONTSIZE * monitorScale, false, FONTFAMILY, bufferSize.x - 2, FONTWEIGHTACTIVE->m_value);
|
||||
texInactive = g_pHyprOpenGL->renderText(pWindow->m_szTitle, COLOR, *PTITLEFONTSIZE * monitorScale, false, FONTFAMILY, bufferSize.x - 2, FONTWEIGHTINACTIVE->m_value);
|
||||
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);
|
||||
}
|
||||
|
||||
static void renderGradientTo(SP<CTexture> tex, CGradientValueData* grad) {
|
||||
|
|
@ -380,7 +380,7 @@ 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_sGroupData.pNextWindow.lock())
|
||||
if (m_pWindow.lock() == m_pWindow->m_groupData.pNextWindow.lock())
|
||||
return false;
|
||||
|
||||
const float BARRELATIVEX = pos.x - assignedBoxGlobal().x;
|
||||
|
|
@ -397,7 +397,7 @@ bool CHyprGroupBarDecoration::onBeginWindowDragOnDeco(const Vector2D& pos) {
|
|||
|
||||
// hack
|
||||
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(pWindow);
|
||||
if (!pWindow->m_bIsFloating) {
|
||||
if (!pWindow->m_isFloating) {
|
||||
const bool GROUPSLOCKEDPREV = g_pKeybindManager->m_bGroupsLocked;
|
||||
g_pKeybindManager->m_bGroupsLocked = true;
|
||||
g_pLayoutManager->getCurrentLayout()->onWindowCreated(pWindow);
|
||||
|
|
@ -419,12 +419,12 @@ 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_bIsFloating && !pDraggedWindow->m_bDraggingTiled;
|
||||
const bool FLOATEDINTOTILED = !m_pWindow->m_isFloating && !pDraggedWindow->m_draggingTiled;
|
||||
|
||||
g_pInputManager->m_bWasDraggingWindow = false;
|
||||
|
||||
if (!pDraggedWindow->canBeGroupedInto(m_pWindow.lock()) || (*PDRAGINTOGROUP != 1 && *PDRAGINTOGROUP != 2) || (FLOATEDINTOTILED && !*PMERGEFLOATEDINTOTILEDONGROUPBAR) ||
|
||||
(!*PMERGEGROUPSONGROUPBAR && pDraggedWindow->m_sGroupData.pNextWindow.lock() && m_pWindow->m_sGroupData.pNextWindow.lock())) {
|
||||
(!*PMERGEGROUPSONGROUPBAR && pDraggedWindow->m_groupData.pNextWindow.lock() && m_pWindow->m_groupData.pNextWindow.lock())) {
|
||||
g_pInputManager->m_bWasDraggingWindow = true;
|
||||
return false;
|
||||
}
|
||||
|
|
@ -434,49 +434,49 @@ bool CHyprGroupBarDecoration::onEndWindowDragOnDeco(const Vector2D& pos, PHLWIND
|
|||
const int WINDOWINDEX = BARRELATIVE < 0 ? -1 : BARRELATIVE / BARSIZE;
|
||||
|
||||
PHLWINDOW pWindowInsertAfter = m_pWindow->getGroupWindowByIndex(WINDOWINDEX);
|
||||
PHLWINDOW pWindowInsertEnd = pWindowInsertAfter->m_sGroupData.pNextWindow.lock();
|
||||
PHLWINDOW pDraggedHead = pDraggedWindow->m_sGroupData.pNextWindow.lock() ? pDraggedWindow->getGroupHead() : pDraggedWindow;
|
||||
PHLWINDOW pWindowInsertEnd = pWindowInsertAfter->m_groupData.pNextWindow.lock();
|
||||
PHLWINDOW pDraggedHead = pDraggedWindow->m_groupData.pNextWindow.lock() ? pDraggedWindow->getGroupHead() : pDraggedWindow;
|
||||
|
||||
if (!pDraggedWindow->m_sGroupData.pNextWindow.expired()) {
|
||||
if (!pDraggedWindow->m_groupData.pNextWindow.expired()) {
|
||||
|
||||
// stores group data
|
||||
std::vector<PHLWINDOW> members;
|
||||
PHLWINDOW curr = pDraggedHead;
|
||||
const bool WASLOCKED = pDraggedHead->m_sGroupData.locked;
|
||||
const bool WASLOCKED = pDraggedHead->m_groupData.locked;
|
||||
do {
|
||||
members.push_back(curr);
|
||||
curr = curr->m_sGroupData.pNextWindow.lock();
|
||||
curr = curr->m_groupData.pNextWindow.lock();
|
||||
} while (curr != members[0]);
|
||||
|
||||
// removes all windows
|
||||
for (const PHLWINDOW& w : members) {
|
||||
w->m_sGroupData.pNextWindow.reset();
|
||||
w->m_sGroupData.head = false;
|
||||
w->m_sGroupData.locked = false;
|
||||
w->m_groupData.pNextWindow.reset();
|
||||
w->m_groupData.head = false;
|
||||
w->m_groupData.locked = false;
|
||||
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(w);
|
||||
}
|
||||
|
||||
// restores the group
|
||||
for (auto it = members.begin(); it != members.end(); ++it) {
|
||||
(*it)->m_bIsFloating = pWindowInsertAfter->m_bIsFloating; // match the floating state of group members
|
||||
*(*it)->m_vRealSize = pWindowInsertAfter->m_vRealSize->goal(); // match the size of group members
|
||||
*(*it)->m_vRealPosition = pWindowInsertAfter->m_vRealPosition->goal(); // match the position of group members
|
||||
(*it)->m_isFloating = pWindowInsertAfter->m_isFloating; // match the floating state of group members
|
||||
*(*it)->m_realSize = pWindowInsertAfter->m_realSize->goal(); // match the size of group members
|
||||
*(*it)->m_realPosition = pWindowInsertAfter->m_realPosition->goal(); // match the position of group members
|
||||
if (std::next(it) != members.end())
|
||||
(*it)->m_sGroupData.pNextWindow = *std::next(it);
|
||||
(*it)->m_groupData.pNextWindow = *std::next(it);
|
||||
else
|
||||
(*it)->m_sGroupData.pNextWindow = members[0];
|
||||
(*it)->m_groupData.pNextWindow = members[0];
|
||||
}
|
||||
members[0]->m_sGroupData.head = true;
|
||||
members[0]->m_sGroupData.locked = WASLOCKED;
|
||||
members[0]->m_groupData.head = true;
|
||||
members[0]->m_groupData.locked = WASLOCKED;
|
||||
} else
|
||||
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(pDraggedWindow);
|
||||
|
||||
pDraggedWindow->m_bIsFloating = pWindowInsertAfter->m_bIsFloating; // match the floating state of the window
|
||||
pDraggedWindow->m_isFloating = pWindowInsertAfter->m_isFloating; // match the floating state of the window
|
||||
|
||||
pWindowInsertAfter->insertWindowToGroup(pDraggedWindow);
|
||||
|
||||
if (WINDOWINDEX == -1)
|
||||
std::swap(pDraggedHead->m_sGroupData.head, pWindowInsertEnd->m_sGroupData.head);
|
||||
std::swap(pDraggedHead->m_groupData.head, pWindowInsertEnd->m_groupData.head);
|
||||
|
||||
m_pWindow->setGroupCurrent(pDraggedWindow);
|
||||
pDraggedWindow->applyGroupRules();
|
||||
|
|
@ -533,7 +533,7 @@ bool CHyprGroupBarDecoration::onMouseButtonOnDeco(const Vector2D& pos, const IPo
|
|||
if (!g_pCompositor->isWindowActive(pWindow) && *PFOLLOWMOUSE != 3)
|
||||
g_pCompositor->focusWindow(pWindow);
|
||||
|
||||
if (pWindow->m_bIsFloating)
|
||||
if (pWindow->m_isFloating)
|
||||
g_pCompositor->changeWindowZOrder(pWindow, true);
|
||||
|
||||
return true;
|
||||
|
|
@ -542,11 +542,11 @@ 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_sGroupData.pNextWindow.expired())
|
||||
if (!*PGROUPBARSCROLLING || m_pWindow->m_groupData.pNextWindow.expired())
|
||||
return false;
|
||||
|
||||
if (e.delta > 0)
|
||||
m_pWindow->setGroupCurrent(m_pWindow->m_sGroupData.pNextWindow.lock());
|
||||
m_pWindow->setGroupCurrent(m_pWindow->m_groupData.pNextWindow.lock());
|
||||
else
|
||||
m_pWindow->setGroupCurrent(m_pWindow->getGroupPrevious());
|
||||
|
||||
|
|
@ -579,9 +579,9 @@ CBox CHyprGroupBarDecoration::assignedBoxGlobal() {
|
|||
CBox box = m_bAssignedBox;
|
||||
box.translate(g_pDecorationPositioner->getEdgeDefinedPoint(DECORATION_EDGE_TOP, m_pWindow.lock()));
|
||||
|
||||
const auto PWORKSPACE = m_pWindow->m_pWorkspace;
|
||||
const auto PWORKSPACE = m_pWindow->m_workspace;
|
||||
|
||||
if (PWORKSPACE && !m_pWindow->m_bPinned)
|
||||
if (PWORKSPACE && !m_pWindow->m_pinned)
|
||||
box.translate(PWORKSPACE->m_renderOffset->value());
|
||||
|
||||
return box.round();
|
||||
|
|
|
|||
|
|
@ -91,8 +91,8 @@ void CDecorationPositioner::sanitizeDatas() {
|
|||
std::erase_if(m_vWindowPositioningDatas, [](const auto& other) {
|
||||
if (!validMapped(other->pWindow))
|
||||
return true;
|
||||
if (std::find_if(other->pWindow->m_dWindowDecorations.begin(), other->pWindow->m_dWindowDecorations.end(),
|
||||
[&](const auto& el) { return el.get() == other->pDecoration; }) == other->pWindow->m_dWindowDecorations.end())
|
||||
if (std::find_if(other->pWindow->m_windowDecorations.begin(), other->pWindow->m_windowDecorations.end(), [&](const auto& el) { return el.get() == other->pDecoration; }) ==
|
||||
other->pWindow->m_windowDecorations.end())
|
||||
return true;
|
||||
return false;
|
||||
});
|
||||
|
|
@ -123,13 +123,13 @@ void CDecorationPositioner::onWindowUpdate(PHLWINDOW pWindow) {
|
|||
//
|
||||
std::vector<CDecorationPositioner::SWindowPositioningData*> datas;
|
||||
// reserve to avoid reallocations
|
||||
datas.reserve(pWindow->m_dWindowDecorations.size());
|
||||
datas.reserve(pWindow->m_windowDecorations.size());
|
||||
|
||||
for (auto const& wd : pWindow->m_dWindowDecorations) {
|
||||
for (auto const& wd : pWindow->m_windowDecorations) {
|
||||
datas.push_back(getDataFor(wd.get(), pWindow));
|
||||
}
|
||||
|
||||
if (WINDOWDATA->lastWindowSize == pWindow->m_vRealSize->value() /* position not changed */
|
||||
if (WINDOWDATA->lastWindowSize == pWindow->m_realSize->value() /* position not changed */
|
||||
&& std::all_of(m_vWindowPositioningDatas.begin(), m_vWindowPositioningDatas.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 */
|
||||
|
|
@ -141,9 +141,9 @@ void CDecorationPositioner::onWindowUpdate(PHLWINDOW pWindow) {
|
|||
wd->positioningInfo = wd->pDecoration->getPositioningInfo();
|
||||
}
|
||||
|
||||
WINDOWDATA->lastWindowSize = pWindow->m_vRealSize->value();
|
||||
WINDOWDATA->lastWindowSize = pWindow->m_realSize->value();
|
||||
WINDOWDATA->needsRecalc = false;
|
||||
const bool EPHEMERAL = pWindow->m_vRealSize->isBeingAnimated();
|
||||
const bool EPHEMERAL = pWindow->m_realSize->isBeingAnimated();
|
||||
|
||||
std::sort(datas.begin(), datas.end(), [](const auto& a, const auto& b) { return a->positioningInfo.priority > b->positioningInfo.priority; });
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue