store multiple values in CWindowOverridableVar

modified:   src/Compositor.cpp
modified:   src/debug/HyprCtl.cpp
modified:   src/desktop/Window.cpp
modified:   src/desktop/Window.hpp
modified:   src/events/Windows.cpp
modified:   src/layout/IHyprLayout.cpp
modified:   src/managers/AnimationManager.cpp
modified:   src/managers/KeybindManager.cpp
modified:   src/managers/XWaylandManager.cpp
modified:   src/render/OpenGL.cpp
modified:   src/render/Renderer.cpp
modified:   src/render/decorations/CHyprBorderDecoration.cpp
modified:   src/render/decorations/CHyprDropShadowDecoration.cpp
modified:   src/render/decorations/CHyprGroupBarDecoration.cpp
This commit is contained in:
MightyPlaza 2024-07-04 18:12:29 +01:00
parent 36d7a05c02
commit 5a492856ee
No known key found for this signature in database
GPG key ID: 284C27FD27A6DC0D
14 changed files with 172 additions and 207 deletions

View file

@ -702,7 +702,7 @@ PHLWINDOW CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t proper
for (auto& w : m_vWindows | std::views::reverse) {
const auto BB = w->getWindowBoxUnified(properties);
CBox box = BB.copy().expand(w->m_iX11Type == 2 ? BORDER_GRAB_AREA : 0);
if (w->m_bIsFloating && w->m_bIsMapped && !w->isHidden() && !w->m_bX11ShouldntFocus && w->m_bPinned && !w->m_sWindowData.noFocus && w != pIgnoreWindow) {
if (w->m_bIsFloating && w->m_bIsMapped && !w->isHidden() && !w->m_bX11ShouldntFocus && w->m_bPinned && !w->m_sWindowData.noFocus.value_or(false) && w != pIgnoreWindow) {
if (box.containsPoint(g_pPointerManager->position()))
return w;
@ -731,7 +731,7 @@ PHLWINDOW CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t proper
continue;
CBox box = BB.copy().expand(w->m_iX11Type == 2 ? BORDER_GRAB_AREA : 0);
if (w->m_bIsFloating && w->m_bIsMapped && isWorkspaceVisible(w->m_pWorkspace) && !w->isHidden() && !w->m_bPinned && !w->m_sWindowData.noFocus &&
if (w->m_bIsFloating && w->m_bIsMapped && isWorkspaceVisible(w->m_pWorkspace) && !w->isHidden() && !w->m_bPinned && !w->m_sWindowData.noFocus.value_or(false) &&
w != pIgnoreWindow && (!aboveFullscreen || w->m_bCreatedOverFullscreen)) {
// OR windows should add focus to parent
if (w->m_bX11ShouldntFocus && w->m_iX11Type != 2)
@ -784,7 +784,7 @@ PHLWINDOW CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t proper
continue;
if (!w->m_bIsX11 && !w->m_bIsFloating && w->m_bIsMapped && w->workspaceID() == WORKSPACEID && !w->isHidden() && !w->m_bX11ShouldntFocus &&
!w->m_sWindowData.noFocus && w != pIgnoreWindow) {
!w->m_sWindowData.noFocus.value_or(false) && w != pIgnoreWindow) {
if (w->hasPopupAt(pos))
return w;
}
@ -796,7 +796,7 @@ PHLWINDOW CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t proper
CBox box = (properties & USE_PROP_TILED) ? w->getWindowBoxUnified(properties) : CBox{w->m_vPosition, w->m_vSize};
if (!w->m_bIsFloating && w->m_bIsMapped && box.containsPoint(pos) && w->workspaceID() == WORKSPACEID && !w->isHidden() && !w->m_bX11ShouldntFocus &&
!w->m_sWindowData.noFocus && w != pIgnoreWindow)
!w->m_sWindowData.noFocus.value_or(false) && w != pIgnoreWindow)
return w;
}
@ -940,7 +940,7 @@ void CCompositor::focusWindow(PHLWINDOW pWindow, SP<CWLSurfaceResource> pSurface
return;
}
if (pWindow->m_sWindowData.noFocus) {
if (pWindow->m_sWindowData.noFocus.value_or(false)) {
Debug::log(LOG, "Ignoring focus to nofocus window!");
return;
}
@ -1579,7 +1579,7 @@ PHLWINDOW CCompositor::getNextWindowOnWorkspace(PHLWINDOW pWindow, bool focusabl
if (floating.has_value() && w->m_bIsFloating != floating.value())
continue;
if (w->m_pWorkspace == pWindow->m_pWorkspace && w->m_bIsMapped && !w->isHidden() && (!focusableOnly || !w->m_sWindowData.noFocus))
if (w->m_pWorkspace == pWindow->m_pWorkspace && w->m_bIsMapped && !w->isHidden() && (!focusableOnly || !w->m_sWindowData.noFocus.value_or(false)))
return w;
}
@ -1587,7 +1587,7 @@ PHLWINDOW CCompositor::getNextWindowOnWorkspace(PHLWINDOW pWindow, bool focusabl
if (floating.has_value() && w->m_bIsFloating != floating.value())
continue;
if (w != pWindow && w->m_pWorkspace == pWindow->m_pWorkspace && w->m_bIsMapped && !w->isHidden() && (!focusableOnly || !w->m_sWindowData.noFocus))
if (w != pWindow && w->m_pWorkspace == pWindow->m_pWorkspace && w->m_bIsMapped && !w->isHidden() && (!focusableOnly || !w->m_sWindowData.noFocus.value_or(false)))
return w;
}
@ -1608,7 +1608,7 @@ PHLWINDOW CCompositor::getPrevWindowOnWorkspace(PHLWINDOW pWindow, bool focusabl
if (floating.has_value() && w->m_bIsFloating != floating.value())
continue;
if (w->m_pWorkspace == pWindow->m_pWorkspace && w->m_bIsMapped && !w->isHidden() && (!focusableOnly || !w->m_sWindowData.noFocus))
if (w->m_pWorkspace == pWindow->m_pWorkspace && w->m_bIsMapped && !w->isHidden() && (!focusableOnly || !w->m_sWindowData.noFocus.value_or(false)))
return w;
}
@ -1616,7 +1616,7 @@ PHLWINDOW CCompositor::getPrevWindowOnWorkspace(PHLWINDOW pWindow, bool focusabl
if (floating.has_value() && w->m_bIsFloating != floating.value())
continue;
if (w != pWindow && w->m_pWorkspace == pWindow->m_pWorkspace && w->m_bIsMapped && !w->isHidden() && (!focusableOnly || !w->m_sWindowData.noFocus))
if (w != pWindow && w->m_pWorkspace == pWindow->m_pWorkspace && w->m_bIsMapped && !w->isHidden() && (!focusableOnly || !w->m_sWindowData.noFocus.value_or(false)))
return w;
}
@ -1804,13 +1804,11 @@ void CCompositor::updateWindowAnimatedDecorationValues(PHLWINDOW pWindow) {
if (pWindow == m_pLastWindow) {
const auto* const ACTIVECOLOR =
!pWindow->m_sGroupData.pNextWindow.lock() ? (!pWindow->m_sGroupData.deny ? ACTIVECOL : NOGROUPACTIVECOL) : (GROUPLOCKED ? GROUPACTIVELOCKEDCOL : GROUPACTIVECOL);
setBorderColor(pWindow->m_sWindowData.activeBorderColor.toUnderlying().m_vColors.empty() ? *ACTIVECOLOR :
pWindow->m_sWindowData.activeBorderColor.toUnderlying());
setBorderColor(pWindow->m_sWindowData.activeBorderColor.value_or(*ACTIVECOLOR));
} else {
const auto* const INACTIVECOLOR = !pWindow->m_sGroupData.pNextWindow.lock() ? (!pWindow->m_sGroupData.deny ? INACTIVECOL : NOGROUPINACTIVECOL) :
(GROUPLOCKED ? GROUPINACTIVELOCKEDCOL : GROUPINACTIVECOL);
setBorderColor(pWindow->m_sWindowData.inactiveBorderColor.toUnderlying().m_vColors.empty() ? *INACTIVECOLOR :
pWindow->m_sWindowData.inactiveBorderColor.toUnderlying());
setBorderColor(pWindow->m_sWindowData.inactiveBorderColor.value_or(*INACTIVECOLOR));
}
}
@ -1821,16 +1819,16 @@ void CCompositor::updateWindowAnimatedDecorationValues(PHLWINDOW pWindow) {
// opacity
const auto PWORKSPACE = pWindow->m_pWorkspace;
if (pWindow->m_bIsFullscreen && PWORKSPACE->m_efFullscreenMode == FULLSCREEN_FULL) {
pWindow->m_fActiveInactiveAlpha = pWindow->m_sWindowData.alphaFullscreen.toUnderlying().applyAlpha(*PFULLSCREENALPHA);
pWindow->m_fActiveInactiveAlpha = pWindow->m_sWindowData.alphaFullscreen.value_or(sAlphaValue{1.f, false}).applyAlpha(*PFULLSCREENALPHA);
} else {
if (pWindow == m_pLastWindow)
pWindow->m_fActiveInactiveAlpha = pWindow->m_sWindowData.alpha.toUnderlying().applyAlpha(*PACTIVEALPHA);
pWindow->m_fActiveInactiveAlpha = pWindow->m_sWindowData.alpha.value_or(sAlphaValue{1.f, false}).applyAlpha(*PACTIVEALPHA);
else
pWindow->m_fActiveInactiveAlpha = pWindow->m_sWindowData.alphaInactive.toUnderlying().applyAlpha(*PINACTIVEALPHA);
pWindow->m_fActiveInactiveAlpha = pWindow->m_sWindowData.alphaInactive.value_or(sAlphaValue{1.f, false}).applyAlpha(*PINACTIVEALPHA);
}
// dim
if (pWindow == m_pLastWindow.lock() || pWindow->m_sWindowData.noDim || !*PDIMENABLED) {
if (pWindow == m_pLastWindow.lock() || pWindow->m_sWindowData.noDim.value_or(false) || !*PDIMENABLED) {
pWindow->m_fDimPercent = 0;
} else {
pWindow->m_fDimPercent = *PDIMSTRENGTH;

View file

@ -1196,52 +1196,45 @@ std::string dispatchSetProp(eHyprCtlOutputFormat format, std::string request) {
const auto PROP = vars[2];
const auto VAL = vars[3];
bool noFocus = PWINDOW->m_sWindowData.noFocus.toUnderlying();
bool lock = false;
if (request.ends_with("lock"))
lock = true;
bool noFocus = PWINDOW->m_sWindowData.noFocus.value_or(false);
try {
if (PROP == "animationstyle") {
PWINDOW->m_sWindowData.animationStyle = CWindowOverridableVar(VAL, PRIORITY_SET_PROP);
} else if (PROP == "maxsize") {
PWINDOW->m_sWindowData.maxSize = CWindowOverridableVar(configStringToVector2D(VAL + " " + vars[4]), PRIORITY_SET_PROP);
if (lock) {
PWINDOW->m_vRealSize = Vector2D(std::min((double)PWINDOW->m_sWindowData.maxSize.toUnderlying().x, PWINDOW->m_vRealSize.goal().x),
std::min((double)PWINDOW->m_sWindowData.maxSize.toUnderlying().y, PWINDOW->m_vRealSize.goal().y));
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goal());
PWINDOW->setHidden(false);
}
PWINDOW->m_vRealSize = Vector2D(std::min((double)PWINDOW->m_sWindowData.maxSize.value().x, PWINDOW->m_vRealSize.goal().x),
std::min((double)PWINDOW->m_sWindowData.maxSize.value().y, PWINDOW->m_vRealSize.goal().y));
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goal());
PWINDOW->setHidden(false);
} else if (PROP == "minsize") {
PWINDOW->m_sWindowData.minSize = CWindowOverridableVar(configStringToVector2D(VAL + " " + vars[4]), PRIORITY_SET_PROP);
if (lock) {
PWINDOW->m_vRealSize = Vector2D(std::max((double)PWINDOW->m_sWindowData.minSize.toUnderlying().x, PWINDOW->m_vRealSize.goal().x),
std::max((double)PWINDOW->m_sWindowData.minSize.toUnderlying().y, PWINDOW->m_vRealSize.goal().y));
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goal());
PWINDOW->setHidden(false);
}
PWINDOW->m_vRealSize = Vector2D(std::max((double)PWINDOW->m_sWindowData.minSize.value().x, PWINDOW->m_vRealSize.goal().x),
std::max((double)PWINDOW->m_sWindowData.minSize.value().y, PWINDOW->m_vRealSize.goal().y));
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goal());
PWINDOW->setHidden(false);
} else if (PROP == "alpha") {
PWINDOW->m_sWindowData.alpha = CWindowOverridableVar(sAlphaValue{std::stof(VAL), PWINDOW->m_sWindowData.alpha.toUnderlying().m_bOverride}, PRIORITY_SET_PROP);
PWINDOW->m_sWindowData.alpha =
CWindowOverridableVar(sAlphaValue{std::stof(VAL), PWINDOW->m_sWindowData.alpha.value_or(sAlphaValue{1.f, false}).m_bOverride}, PRIORITY_SET_PROP);
} else if (PROP == "alphainactive") {
PWINDOW->m_sWindowData.alphaInactive =
CWindowOverridableVar(sAlphaValue{std::stof(VAL), PWINDOW->m_sWindowData.alphaInactive.toUnderlying().m_bOverride}, PRIORITY_SET_PROP);
CWindowOverridableVar(sAlphaValue{std::stof(VAL), PWINDOW->m_sWindowData.alphaInactive.value_or(sAlphaValue{1.f, false}).m_bOverride}, PRIORITY_SET_PROP);
} else if (PROP == "alphafullscreen") {
PWINDOW->m_sWindowData.alphaFullscreen =
CWindowOverridableVar(sAlphaValue{std::stof(VAL), PWINDOW->m_sWindowData.alphaFullscreen.toUnderlying().m_bOverride}, PRIORITY_SET_PROP);
CWindowOverridableVar(sAlphaValue{std::stof(VAL), PWINDOW->m_sWindowData.alphaFullscreen.value_or(sAlphaValue{1.f, false}).m_bOverride}, PRIORITY_SET_PROP);
} else if (PROP == "alphaoverride") {
PWINDOW->m_sWindowData.alpha =
CWindowOverridableVar(sAlphaValue{PWINDOW->m_sWindowData.alpha.toUnderlying().m_fAlpha, (bool)configStringToInt(VAL)}, PRIORITY_SET_PROP);
CWindowOverridableVar(sAlphaValue{PWINDOW->m_sWindowData.alpha.value_or(sAlphaValue{1.f, false}).m_fAlpha, (bool)configStringToInt(VAL)}, PRIORITY_SET_PROP);
} else if (PROP == "alphainactiveoverride") {
PWINDOW->m_sWindowData.alphaInactive =
CWindowOverridableVar(sAlphaValue{PWINDOW->m_sWindowData.alphaInactive.toUnderlying().m_fAlpha, (bool)configStringToInt(VAL)}, PRIORITY_SET_PROP);
PWINDOW->m_sWindowData.alphaInactive = CWindowOverridableVar(
sAlphaValue{PWINDOW->m_sWindowData.alphaInactive.value_or(sAlphaValue{1.f, false}).m_fAlpha, (bool)configStringToInt(VAL)}, PRIORITY_SET_PROP);
} else if (PROP == "alphafullscreenoverride") {
PWINDOW->m_sWindowData.alphaFullscreen =
CWindowOverridableVar(sAlphaValue{PWINDOW->m_sWindowData.alphaFullscreen.toUnderlying().m_fAlpha, (bool)configStringToInt(VAL)}, PRIORITY_SET_PROP);
PWINDOW->m_sWindowData.alphaFullscreen = CWindowOverridableVar(
sAlphaValue{PWINDOW->m_sWindowData.alphaFullscreen.value_or(sAlphaValue{1.f, false}).m_fAlpha, (bool)configStringToInt(VAL)}, PRIORITY_SET_PROP);
} else if (PROP == "activebordercolor" || PROP == "inactivebordercolor") {
CGradientValueData colorData = {};
if (vars.size() > 4) {
for (int i = 3; i < static_cast<int>(lock ? vars.size() - 1 : vars.size()); ++i) {
for (int i = 3; i < static_cast<int>(vars.size()); ++i) {
const auto TOKEN = vars[i];
if (TOKEN.ends_with("deg"))
colorData.m_fAngle = std::stoi(TOKEN.substr(0, TOKEN.size() - 3)) * (PI / 180.0);
@ -1266,7 +1259,7 @@ std::string dispatchSetProp(eHyprCtlOutputFormat format, std::string request) {
g_pCompositor->updateAllWindowsAnimatedDecorationValues();
if (!(PWINDOW->m_sWindowData.noFocus.toUnderlying() == noFocus)) {
if (!(PWINDOW->m_sWindowData.noFocus.value_or(false) == noFocus)) {
g_pCompositor->focusWindow(nullptr);
g_pCompositor->focusWindow(PWINDOW);
g_pCompositor->focusWindow(PLASTWINDOW);

View file

@ -110,7 +110,7 @@ SBoxExtents CWindow::getFullWindowExtents() {
const int BORDERSIZE = getRealBorderSize();
if (m_sWindowData.dimAround) {
if (m_sWindowData.dimAround.value_or(false)) {
if (const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID); PMONITOR)
return {{m_vRealPosition.value().x - PMONITOR->vecPosition.x, m_vRealPosition.value().y - PMONITOR->vecPosition.y},
{PMONITOR->vecSize.x - (m_vRealPosition.value().x - PMONITOR->vecPosition.x), PMONITOR->vecSize.y - (m_vRealPosition.value().y - PMONITOR->vecPosition.y)}};
@ -170,7 +170,7 @@ SBoxExtents CWindow::getFullWindowExtents() {
}
CBox CWindow::getFullWindowBoundingBox() {
if (m_sWindowData.dimAround) {
if (m_sWindowData.dimAround.value_or(false)) {
if (const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID); PMONITOR)
return {PMONITOR->vecPosition.x, PMONITOR->vecPosition.y, PMONITOR->vecSize.x, PMONITOR->vecSize.y};
}
@ -218,7 +218,7 @@ CBox CWindow::getWindowIdealBoundingBoxIgnoreReserved() {
}
CBox CWindow::getWindowBoxUnified(uint64_t properties) {
if (m_sWindowData.dimAround) {
if (m_sWindowData.dimAround.value_or(false)) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
if (PMONITOR)
return {PMONITOR->vecPosition.x, PMONITOR->vecPosition.y, PMONITOR->vecSize.x, PMONITOR->vecSize.y};
@ -650,11 +650,11 @@ void CWindow::applyDynamicRule(const SWindowRule& r) {
if (r == "override") {
if (opacityIDX == 1)
m_sWindowData.alpha = CWindowOverridableVar(sAlphaValue{m_sWindowData.alpha.toUnderlying().m_fAlpha, true}, PRIORITY_WINDOW_RULE);
m_sWindowData.alpha = CWindowOverridableVar(sAlphaValue{m_sWindowData.alpha.value().m_fAlpha, true}, PRIORITY_WINDOW_RULE);
else if (opacityIDX == 2)
m_sWindowData.alphaInactive = CWindowOverridableVar(sAlphaValue{m_sWindowData.alphaInactive.toUnderlying().m_fAlpha, true}, PRIORITY_WINDOW_RULE);
m_sWindowData.alphaInactive = CWindowOverridableVar(sAlphaValue{m_sWindowData.alphaInactive.value().m_fAlpha, true}, PRIORITY_WINDOW_RULE);
else if (opacityIDX == 3)
m_sWindowData.alphaFullscreen = CWindowOverridableVar(sAlphaValue{m_sWindowData.alphaFullscreen.toUnderlying().m_fAlpha, true}, PRIORITY_WINDOW_RULE);
m_sWindowData.alphaFullscreen = CWindowOverridableVar(sAlphaValue{m_sWindowData.alphaFullscreen.value().m_fAlpha, true}, PRIORITY_WINDOW_RULE);
} else {
if (opacityIDX == 0) {
m_sWindowData.alpha = CWindowOverridableVar(sAlphaValue{std::stof(r), false}, PRIORITY_WINDOW_RULE);
@ -722,7 +722,7 @@ void CWindow::applyDynamicRule(const SWindowRule& r) {
CVarList vars(r.szRule, 0, ' ');
try {
m_sWindowData.xray = CWindowOverridableVar((int)configStringToInt(vars[1]), PRIORITY_WINDOW_RULE);
m_sWindowData.xray = CWindowOverridableVar((bool)configStringToInt(vars[1]), PRIORITY_WINDOW_RULE);
} catch (...) {}
} else if (auto search = mbWindowProperties.find(r.szRule); search != mbWindowProperties.end()) {
*(search->second) = CWindowOverridableVar(true, PRIORITY_WINDOW_RULE);
@ -754,8 +754,8 @@ void CWindow::applyDynamicRule(const SWindowRule& r) {
}
m_sWindowData.maxSize = CWindowOverridableVar(VEC, PRIORITY_WINDOW_RULE);
m_vRealSize = Vector2D(std::min((double)m_sWindowData.maxSize.toUnderlying().x, m_vRealSize.goal().x),
std::min((double)m_sWindowData.maxSize.toUnderlying().y, m_vRealSize.goal().y));
m_vRealSize =
Vector2D(std::min((double)m_sWindowData.maxSize.value().x, m_vRealSize.goal().x), std::min((double)m_sWindowData.maxSize.value().y, m_vRealSize.goal().y));
g_pXWaylandManager->setWindowSize(m_pSelf.lock(), m_vRealSize.goal());
} catch (std::exception& e) { Debug::log(ERR, "maxsize rule \"{}\" failed with: {}", r.szRule, e.what()); }
} else if (r.szRule.starts_with("minsize")) {
@ -769,8 +769,8 @@ void CWindow::applyDynamicRule(const SWindowRule& r) {
}
m_sWindowData.minSize = CWindowOverridableVar(VEC, PRIORITY_WINDOW_RULE);
m_vRealSize = Vector2D(std::max((double)m_sWindowData.minSize.toUnderlying().x, m_vRealSize.goal().x),
std::max((double)m_sWindowData.minSize.toUnderlying().y, m_vRealSize.goal().y));
m_vRealSize =
Vector2D(std::max((double)m_sWindowData.minSize.value().x, m_vRealSize.goal().x), std::max((double)m_sWindowData.minSize.value().y, m_vRealSize.goal().y));
g_pXWaylandManager->setWindowSize(m_pSelf.lock(), m_vRealSize.goal());
if (m_sGroupData.pNextWindow.expired())
setHidden(false);
@ -779,33 +779,33 @@ void CWindow::applyDynamicRule(const SWindowRule& r) {
}
void CWindow::updateDynamicRules() {
m_sWindowData.activeBorderColor = CWindowOverridableVar(CGradientValueData(), PRIORITY_NONE);
m_sWindowData.inactiveBorderColor = CWindowOverridableVar(CGradientValueData(), PRIORITY_NONE);
m_sWindowData.alpha = CWindowOverridableVar(sAlphaValue{1.f, false}, PRIORITY_NONE);
m_sWindowData.alphaInactive = CWindowOverridableVar(sAlphaValue{1.f, false}, PRIORITY_NONE);
m_sWindowData.alphaFullscreen = CWindowOverridableVar(sAlphaValue{1.f, false}, PRIORITY_NONE);
m_sWindowData.activeBorderColor.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.inactiveBorderColor.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.alpha.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.alphaInactive.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.alphaFullscreen.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.opaque = CWindowOverridableVar(false, PRIORITY_NONE);
m_sWindowData.opaque.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.animationStyle = CWindowOverridableVar(std::string(""), PRIORITY_NONE);
m_sWindowData.maxSize = CWindowOverridableVar(Vector2D(std::numeric_limits<double>::max(), std::numeric_limits<double>::max()), PRIORITY_NONE);
m_sWindowData.minSize = CWindowOverridableVar(Vector2D(20, 20), PRIORITY_NONE);
m_sWindowData.animationStyle.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.maxSize.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.minSize.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.dimAround = CWindowOverridableVar(false, PRIORITY_NONE);
m_sWindowData.noAnim = CWindowOverridableVar(false, PRIORITY_NONE);
m_sWindowData.noBlur = CWindowOverridableVar(false, PRIORITY_NONE);
m_sWindowData.noDim = CWindowOverridableVar(false, PRIORITY_NONE);
m_sWindowData.noBorder = CWindowOverridableVar(false, PRIORITY_NONE);
m_sWindowData.noShadow = CWindowOverridableVar(false, PRIORITY_NONE);
m_sWindowData.focusOnActivate = CWindowOverridableVar(false, PRIORITY_NONE);
m_sWindowData.RGBX = CWindowOverridableVar(false, PRIORITY_NONE);
m_sWindowData.tearing = CWindowOverridableVar(false, PRIORITY_NONE);
m_sWindowData.keepAspectRatio = CWindowOverridableVar(false, PRIORITY_NONE);
m_sWindowData.nearestNeighbor = CWindowOverridableVar(false, PRIORITY_NONE);
m_sWindowData.dimAround.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.noAnim.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.noBlur.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.noDim.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.noBorder.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.noShadow.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.focusOnActivate.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.RGBX.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.tearing.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.keepAspectRatio.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.nearestNeighbor.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.xray.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.borderSize = CWindowOverridableVar(-1, PRIORITY_NONE);
m_sWindowData.rounding = CWindowOverridableVar(-1, PRIORITY_NONE);
m_sWindowData.xray = CWindowOverridableVar(-1, PRIORITY_NONE);
m_sWindowData.borderSize.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.rounding.unset(PRIORITY_WINDOW_RULE);
m_eIdleInhibitMode = IDLEINHIBIT_NONE;
@ -1156,9 +1156,9 @@ bool CWindow::opaque() {
float CWindow::rounding() {
static auto PROUNDING = CConfigValue<Hyprlang::INT>("decoration:rounding");
float rounding = m_sWindowData.rounding.toUnderlying() == -1 ? *PROUNDING : m_sWindowData.rounding.toUnderlying();
float rounding = m_sWindowData.rounding.value_or(*PROUNDING);
return m_sWindowData.rounding ? rounding : 0;
return m_sWindowData.noRounding.value_or(false) ? 0 : rounding;
}
void CWindow::updateSpecialRenderData() {
@ -1185,19 +1185,16 @@ void CWindow::updateSpecialRenderData(const SWorkspaceRule& workspaceRule) {
}
int CWindow::getRealBorderSize() {
if (m_sWindowData.noBorder || (m_pWorkspace && m_bIsFullscreen && (m_pWorkspace->m_efFullscreenMode == FULLSCREEN_FULL)))
if (m_sWindowData.noBorder.value_or(false) || (m_pWorkspace && m_bIsFullscreen && (m_pWorkspace->m_efFullscreenMode == FULLSCREEN_FULL)))
return 0;
if (m_sWindowData.borderSize.toUnderlying() != -1)
return m_sWindowData.borderSize.toUnderlying();
static auto PBORDERSIZE = CConfigValue<Hyprlang::INT>("general:border_size");
return *PBORDERSIZE;
return m_sWindowData.borderSize.value_or(*PBORDERSIZE);
}
bool CWindow::canBeTorn() {
return (m_sWindowData.tearing.toUnderlying() || m_bTearingHint);
return m_sWindowData.tearing.value_or(m_bTearingHint);
}
bool CWindow::shouldSendFullscreenState() {
@ -1346,7 +1343,7 @@ void CWindow::activate(bool force) {
m_bIsUrgent = true;
if (!force && (!(*PFOCUSONACTIVATE || m_sWindowData.focusOnActivate) || (m_eSuppressedEvents & SUPPRESS_ACTIVATE_FOCUSONLY) || (m_eSuppressedEvents & SUPPRESS_ACTIVATE)))
if (!force && (!m_sWindowData.focusOnActivate.value_or(*PFOCUSONACTIVATE) || (m_eSuppressedEvents & SUPPRESS_ACTIVATE_FOCUSONLY) || (m_eSuppressedEvents & SUPPRESS_ACTIVATE)))
return;
if (m_bIsFloating)
@ -1522,7 +1519,7 @@ void CWindow::onX11Configure(CBox box) {
m_bCreatedOverFullscreen = true;
if (!m_sWindowData.windowDanceCompat)
if (!m_sWindowData.windowDanceCompat.value_or(false))
g_pInputManager->refocus();
g_pHyprRenderer->damageWindow(m_pSelf.lock());

View file

@ -72,7 +72,6 @@ struct sAlphaValue {
};
enum eOverridePriority {
PRIORITY_NONE,
PRIORITY_LAYOUT,
PRIORITY_WORKSPACE_RULE,
PRIORITY_WINDOW_RULE,
@ -82,15 +81,11 @@ enum eOverridePriority {
template <typename T>
class CWindowOverridableVar {
public:
CWindowOverridableVar(T const& val) {
value = val;
}
CWindowOverridableVar(T const& val, eOverridePriority prior) {
value = val;
priority = prior;
CWindowOverridableVar(T const& value, eOverridePriority priority) {
values[priority] = value;
}
CWindowOverridableVar() = default;
~CWindowOverridableVar() = default;
CWindowOverridableVar<T>& operator=(CWindowOverridableVar<T> const& other) {
@ -98,105 +93,80 @@ class CWindowOverridableVar {
if (this == &other)
return *this;
if (priority <= other.priority) {
priority = other.priority;
value = other.value;
for (auto const& value : other.values) {
values[value.first] = value.second;
}
return *this;
}
T operator=(T& other) {
if (priority == PRIORITY_NONE)
return value;
value = other;
return other;
void unset(eOverridePriority priority) {
values.erase(priority);
}
void forceSet(T const& val, eOverridePriority prior = PRIORITY_NONE) {
value = val;
priority = prior;
bool has_value() {
return !values.empty();
}
T operator*(T const& other) {
return value * other;
T value() {
if (!values.empty())
return std::prev(values.end())->second;
else
throw std::bad_optional_access();
}
T operator+(T const& other) {
return value + other;
}
bool operator==(T const& other) {
return other == value;
}
bool operator>=(T const& other) {
return value >= other;
}
bool operator<=(T const& other) {
return value <= other;
}
bool operator>(T const& other) {
return value > other;
}
bool operator<(T const& other) {
return value < other;
}
explicit operator bool() {
return static_cast<bool>(value);
}
T toUnderlying() {
return value;
T value_or(T const& other) {
if (has_value())
return value();
else
return other;
}
eOverridePriority getPriority() {
return priority;
if (!values.empty())
return std::prev(values.end())->first;
else
throw std::bad_optional_access();
}
private:
T value;
eOverridePriority priority = PRIORITY_NONE;
std::map<eOverridePriority, T> values;
};
struct SWindowData {
CWindowOverridableVar<sAlphaValue> alpha = sAlphaValue{1.f, false};
CWindowOverridableVar<sAlphaValue> alphaInactive = sAlphaValue{1.f, false};
CWindowOverridableVar<sAlphaValue> alphaFullscreen = sAlphaValue{1.f, false};
CWindowOverridableVar<sAlphaValue> alpha;
CWindowOverridableVar<sAlphaValue> alphaInactive;
CWindowOverridableVar<sAlphaValue> alphaFullscreen;
CWindowOverridableVar<bool> allowsInput = false;
CWindowOverridableVar<bool> dimAround = false;
CWindowOverridableVar<bool> decorate = false;
CWindowOverridableVar<bool> focusOnActivate = false;
CWindowOverridableVar<bool> keepAspectRatio = false;
CWindowOverridableVar<bool> nearestNeighbor = false;
CWindowOverridableVar<bool> noAnim = false;
CWindowOverridableVar<bool> noBorder = false;
CWindowOverridableVar<bool> noBlur = false;
CWindowOverridableVar<bool> noDim = false;
CWindowOverridableVar<bool> noFocus = false;
CWindowOverridableVar<bool> noMaxSize = false;
CWindowOverridableVar<bool> noRounding = false;
CWindowOverridableVar<bool> noShadow = false;
CWindowOverridableVar<bool> opaque = false;
CWindowOverridableVar<bool> RGBX = false;
CWindowOverridableVar<bool> tearing = false;
CWindowOverridableVar<bool> windowDanceCompat = false;
CWindowOverridableVar<bool> allowsInput;
CWindowOverridableVar<bool> dimAround;
CWindowOverridableVar<bool> decorate;
CWindowOverridableVar<bool> focusOnActivate;
CWindowOverridableVar<bool> keepAspectRatio;
CWindowOverridableVar<bool> nearestNeighbor;
CWindowOverridableVar<bool> noAnim;
CWindowOverridableVar<bool> noBorder;
CWindowOverridableVar<bool> noBlur;
CWindowOverridableVar<bool> noDim;
CWindowOverridableVar<bool> noFocus;
CWindowOverridableVar<bool> noMaxSize;
CWindowOverridableVar<bool> noRounding;
CWindowOverridableVar<bool> noShadow;
CWindowOverridableVar<bool> opaque;
CWindowOverridableVar<bool> RGBX;
CWindowOverridableVar<bool> tearing;
CWindowOverridableVar<bool> xray;
CWindowOverridableVar<bool> windowDanceCompat;
CWindowOverridableVar<int> rounding = -1; // -1 means no
CWindowOverridableVar<int> xray = -1; // -1 means unset, takes precedence over the renderdata one
CWindowOverridableVar<int> borderSize = -1; // -1 means unset, takes precedence over the renderdata one
CWindowOverridableVar<int> rounding;
CWindowOverridableVar<int> borderSize;
CWindowOverridableVar<std::string> animationStyle = std::string("");
CWindowOverridableVar<Vector2D> maxSize = Vector2D(std::numeric_limits<double>::max(), std::numeric_limits<double>::max());
CWindowOverridableVar<Vector2D> minSize = Vector2D(20, 20);
CWindowOverridableVar<std::string> animationStyle;
CWindowOverridableVar<Vector2D> maxSize;
CWindowOverridableVar<Vector2D> minSize;
CWindowOverridableVar<CGradientValueData> activeBorderColor = CGradientValueData(); // empty color vector means unset
CWindowOverridableVar<CGradientValueData> inactiveBorderColor = CGradientValueData(); // empty color vector means unset
CWindowOverridableVar<CGradientValueData> activeBorderColor;
CWindowOverridableVar<CGradientValueData> inactiveBorderColor;
};
struct SWindowRule {

View file

@ -452,7 +452,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
const auto PFOCUSEDWINDOWPREV = g_pCompositor->m_pLastWindow.lock();
if (PWINDOW->m_sWindowData.allowsInput) {
if (PWINDOW->m_sWindowData.allowsInput.value_or(false)) {
PWINDOW->m_sWindowData.noFocus = CWindowOverridableVar(false, PWINDOW->m_sWindowData.allowsInput.getPriority());
PWINDOW->m_bNoInitialFocus = false;
PWINDOW->m_bX11ShouldntFocus = false;
@ -474,11 +474,12 @@ void Events::listener_mapWindow(void* owner, void* data) {
requestsFullscreen = true;
}
if (!PWINDOW->m_sWindowData.noFocus && !PWINDOW->m_bNoInitialFocus && (PWINDOW->m_iX11Type != 2 || (PWINDOW->m_bIsX11 && PWINDOW->m_pXWaylandSurface->wantsFocus())) &&
!workspaceSilent && (!PFORCEFOCUS || PFORCEFOCUS == PWINDOW) && !g_pInputManager->isConstrained()) {
if (!PWINDOW->m_sWindowData.noFocus.value_or(false) && !PWINDOW->m_bNoInitialFocus &&
(PWINDOW->m_iX11Type != 2 || (PWINDOW->m_bIsX11 && PWINDOW->m_pXWaylandSurface->wantsFocus())) && !workspaceSilent && (!PFORCEFOCUS || PFORCEFOCUS == PWINDOW) &&
!g_pInputManager->isConstrained()) {
g_pCompositor->focusWindow(PWINDOW);
PWINDOW->m_fActiveInactiveAlpha.setValueAndWarp(*PACTIVEALPHA);
PWINDOW->m_fDimPercent.setValueAndWarp(PWINDOW->m_sWindowData.noDim ? 0.f : *PDIMSTRENGTH);
PWINDOW->m_fDimPercent.setValueAndWarp(PWINDOW->m_sWindowData.noDim.value_or(false) ? 0.f : *PDIMSTRENGTH);
} else {
PWINDOW->m_fActiveInactiveAlpha.setValueAndWarp(*PINACTIVEALPHA);
PWINDOW->m_fDimPercent.setValueAndWarp(0);

View file

@ -386,8 +386,12 @@ void IHyprLayout::onMouseMove(const Vector2D& mousePos) {
} else if (g_pInputManager->dragMode == MBIND_RESIZE || g_pInputManager->dragMode == MBIND_RESIZE_FORCE_RATIO || g_pInputManager->dragMode == MBIND_RESIZE_BLOCK_RATIO) {
if (DRAGGINGWINDOW->m_bIsFloating) {
Vector2D MINSIZE = g_pXWaylandManager->getMinSizeForWindow(DRAGGINGWINDOW).clamp(DRAGGINGWINDOW->m_sWindowData.minSize.toUnderlying());
Vector2D MAXSIZE = g_pXWaylandManager->getMaxSizeForWindow(DRAGGINGWINDOW).clamp({}, DRAGGINGWINDOW->m_sWindowData.maxSize.toUnderlying());
Vector2D MINSIZE = g_pXWaylandManager->getMinSizeForWindow(DRAGGINGWINDOW).clamp(DRAGGINGWINDOW->m_sWindowData.minSize.value_or(Vector2D(20, 20)));
Vector2D MAXSIZE;
if (DRAGGINGWINDOW->m_sWindowData.maxSize.has_value())
MAXSIZE = g_pXWaylandManager->getMaxSizeForWindow(DRAGGINGWINDOW).clamp({}, DRAGGINGWINDOW->m_sWindowData.maxSize.value());
else
MAXSIZE = g_pXWaylandManager->getMaxSizeForWindow(DRAGGINGWINDOW).clamp({}, Vector2D(std::numeric_limits<double>::max(), std::numeric_limits<double>::max()));
Vector2D newSize = m_vBeginDragSizeXY;
Vector2D newPos = m_vBeginDragPositionXY;
@ -403,7 +407,7 @@ void IHyprLayout::onMouseMove(const Vector2D& mousePos) {
if ((m_vBeginDragSizeXY.x >= 1 && m_vBeginDragSizeXY.y >= 1) &&
(g_pInputManager->dragMode == MBIND_RESIZE_FORCE_RATIO ||
(!(g_pInputManager->dragMode == MBIND_RESIZE_BLOCK_RATIO) && DRAGGINGWINDOW->m_sWindowData.keepAspectRatio))) {
(!(g_pInputManager->dragMode == MBIND_RESIZE_BLOCK_RATIO) && DRAGGINGWINDOW->m_sWindowData.keepAspectRatio.value_or(false)))) {
const float RATIO = m_vBeginDragSizeXY.y / m_vBeginDragSizeXY.x;
@ -587,7 +591,7 @@ PHLWINDOW IHyprLayout::getNextWindowCandidate(PHLWINDOW pWindow) {
// find whether there is a floating window below this one
for (auto& w : g_pCompositor->m_vWindows) {
if (w->m_bIsMapped && !w->isHidden() && w->m_bIsFloating && w->m_iX11Type != 2 && w->m_pWorkspace == pWindow->m_pWorkspace && !w->m_bX11ShouldntFocus &&
!w->m_sWindowData.noFocus && w != pWindow) {
!w->m_sWindowData.noFocus.value_or(false) && w != pWindow) {
if (VECINRECT((pWindow->m_vSize / 2.f + pWindow->m_vPosition), w->m_vPosition.x, w->m_vPosition.y, w->m_vPosition.x + w->m_vSize.x,
w->m_vPosition.y + w->m_vSize.y)) {
return w;
@ -607,7 +611,7 @@ PHLWINDOW IHyprLayout::getNextWindowCandidate(PHLWINDOW pWindow) {
// if not, floating window
for (auto& w : g_pCompositor->m_vWindows) {
if (w->m_bIsMapped && !w->isHidden() && w->m_bIsFloating && w->m_iX11Type != 2 && w->m_pWorkspace == pWindow->m_pWorkspace && !w->m_bX11ShouldntFocus &&
!w->m_sWindowData.noFocus && w != pWindow)
!w->m_sWindowData.noFocus.value_or(false) && w != pWindow)
return w;
}

View file

@ -102,7 +102,7 @@ void CAnimationManager::tick() {
PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID);
if (!PMONITOR)
continue;
animationsDisabled = animationsDisabled || PWINDOW->m_sWindowData.noAnim;
animationsDisabled = PWINDOW->m_sWindowData.noAnim.value_or(animationsDisabled);
} else if (PWORKSPACE) {
PMONITOR = g_pCompositor->getMonitorFromID(PWORKSPACE->m_iMonitorID);
if (!PMONITOR)
@ -407,18 +407,19 @@ void CAnimationManager::onWindowPostCreateClose(PHLWINDOW pWindow, bool close) {
if (!pWindow->m_vRealPosition.m_pConfig->pValues->internalEnabled)
return;
if (pWindow->m_sWindowData.animationStyle.toUnderlying() != "") {
if (pWindow->m_sWindowData.animationStyle.has_value()) {
const auto STYLE = pWindow->m_sWindowData.animationStyle.value();
// the window has config'd special anim
if (pWindow->m_sWindowData.animationStyle.toUnderlying().starts_with("slide")) {
CVarList animList2(pWindow->m_sWindowData.animationStyle.toUnderlying(), 0, 's');
if (STYLE.starts_with("slide")) {
CVarList animList2(STYLE, 0, 's');
animationSlide(pWindow, animList2[1], close);
} else {
// anim popin, fallback
float minPerc = 0.f;
if (pWindow->m_sWindowData.animationStyle.toUnderlying().find("%") != std::string::npos) {
if (STYLE.find("%") != std::string::npos) {
try {
auto percstr = pWindow->m_sWindowData.animationStyle.toUnderlying().substr(pWindow->m_sWindowData.animationStyle.toUnderlying().find_last_of(' '));
auto percstr = STYLE.substr(STYLE.find_last_of(' '));
minPerc = std::stoi(percstr.substr(0, percstr.length() - 1));
} catch (std::exception& e) {
; // oops

View file

@ -2238,7 +2238,7 @@ void CKeybindManager::toggleOpaque(std::string unused) {
if (!PWINDOW)
return;
PWINDOW->m_sWindowData.opaque = CWindowOverridableVar(!PWINDOW->m_sWindowData.opaque, PRIORITY_SET_PROP);
PWINDOW->m_sWindowData.opaque = CWindowOverridableVar(!PWINDOW->m_sWindowData.opaque.value_or(false), PRIORITY_SET_PROP);
g_pHyprRenderer->damageWindow(PWINDOW);
}

View file

@ -206,7 +206,8 @@ Vector2D CHyprXWaylandManager::getMaxSizeForWindow(PHLWINDOW pWindow) {
if (!validMapped(pWindow))
return Vector2D(99999, 99999);
if ((pWindow->m_bIsX11 && !pWindow->m_pXWaylandSurface->sizeHints) || (!pWindow->m_bIsX11 && !pWindow->m_pXDGSurface->toplevel) || pWindow->m_sWindowData.noMaxSize)
if ((pWindow->m_bIsX11 && !pWindow->m_pXWaylandSurface->sizeHints) || (!pWindow->m_bIsX11 && !pWindow->m_pXDGSurface->toplevel) ||
pWindow->m_sWindowData.noMaxSize.value_or(false))
return Vector2D(99999, 99999);
auto MAXSIZE = pWindow->m_bIsX11 ? Vector2D(pWindow->m_pXWaylandSurface->sizeHints->max_width, pWindow->m_pXWaylandSurface->sizeHints->max_height) :

View file

@ -434,7 +434,7 @@ bool CHyprOpenGLImpl::passRequiresIntrospection(CMonitor* pMonitor) {
if (!w->m_bIsFloating && *POPTIM && !w->onSpecialWorkspace())
continue;
if (w->m_sWindowData.noBlur.toUnderlying() == true || w->m_sWindowData.xray.toUnderlying() == true)
if (w->m_sWindowData.noBlur.value_or(false) || w->m_sWindowData.xray.value_or(false) == true)
continue;
if (w->opaque())
@ -1130,7 +1130,7 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(SP<CTexture> tex, CBox* pB
}
}
if (m_pCurrentWindow.lock() && m_pCurrentWindow->m_sWindowData.RGBX)
if (m_pCurrentWindow.lock() && m_pCurrentWindow->m_sWindowData.RGBX.value_or(false))
shader = &m_RenderData.pCurrentMonData->m_shRGBX;
glActiveTexture(GL_TEXTURE0);
@ -1601,7 +1601,7 @@ void CHyprOpenGLImpl::preRender(CMonitor* pMonitor) {
if (!pWindow)
return false;
if (pWindow->m_sWindowData.noBlur)
if (pWindow->m_sWindowData.noBlur.value_or(false))
return false;
if (pWindow->m_pWLSurface->small() && !pWindow->m_pWLSurface->m_bFillIgnoreSmall)
@ -1717,7 +1717,7 @@ bool CHyprOpenGLImpl::shouldUseNewBlurOptimizations(PHLLS pLayer, PHLWINDOW pWin
if (!m_RenderData.pCurrentMonData->blurFB.m_cTex->m_iTexID)
return false;
if (pWindow && pWindow->m_sWindowData.xray.toUnderlying() == 0)
if (pWindow && !pWindow->m_sWindowData.xray.value_or(false))
return false;
if (pLayer && pLayer->xray == 0)
@ -1726,7 +1726,7 @@ bool CHyprOpenGLImpl::shouldUseNewBlurOptimizations(PHLLS pLayer, PHLWINDOW pWin
if ((*PBLURNEWOPTIMIZE && pWindow && !pWindow->m_bIsFloating && !pWindow->onSpecialWorkspace()) || *PBLURXRAY)
return true;
if ((pLayer && pLayer->xray == 1) || (pWindow && pWindow->m_sWindowData.xray.toUnderlying() == 1))
if ((pLayer && pLayer->xray == 1) || (pWindow && pWindow->m_sWindowData.xray.value_or(false)))
return true;
return false;
@ -1750,7 +1750,7 @@ void CHyprOpenGLImpl::renderTextureWithBlur(SP<CTexture> tex, CBox* pBox, float
m_RenderData.renderModif.applyToRegion(texDamage);
if (*PBLURENABLED == 0 || (*PNOBLUROVERSIZED && m_RenderData.primarySurfaceUVTopLeft != Vector2D(-1, -1)) ||
(m_pCurrentWindow.lock() && (m_pCurrentWindow->m_sWindowData.noBlur || m_pCurrentWindow->m_sWindowData.RGBX))) {
(m_pCurrentWindow.lock() && (m_pCurrentWindow->m_sWindowData.noBlur.value_or(false) || m_pCurrentWindow->m_sWindowData.RGBX.value_or(false)))) {
renderTexture(tex, pBox, a, round, false, true);
return;
}
@ -1847,7 +1847,7 @@ void CHyprOpenGLImpl::renderBorder(CBox* box, const CGradientValueData& grad, in
TRACY_GPU_ZONE("RenderBorder");
if (m_RenderData.damage.empty() || (m_pCurrentWindow.lock() && m_pCurrentWindow->m_sWindowData.noBorder))
if (m_RenderData.damage.empty() || (m_pCurrentWindow.lock() && m_pCurrentWindow->m_sWindowData.noBorder.value_or(false)))
return;
CBox newBox = *box;
@ -2108,7 +2108,7 @@ void CHyprOpenGLImpl::renderSnapshot(PHLWINDOW pWindow) {
CRegion fakeDamage{0, 0, PMONITOR->vecTransformedSize.x, PMONITOR->vecTransformedSize.y};
if (*PDIMAROUND && pWindow->m_sWindowData.dimAround) {
if (*PDIMAROUND && pWindow->m_sWindowData.dimAround.value_or(false)) {
CBox monbox = {0, 0, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.y};
g_pHyprOpenGL->renderRect(&monbox, CColor(0, 0, 0, *PDIMAROUND * pWindow->m_fAlpha.value()));
g_pHyprRenderer->damageMonitor(PMONITOR);

View file

@ -531,7 +531,7 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, CMonitor* pMonitor, timespec
decorate = false;
renderdata.surface = pWindow->m_pWLSurface->resource();
renderdata.dontRound = (pWindow->m_bIsFullscreen && PWORKSPACE->m_efFullscreenMode == FULLSCREEN_FULL) || pWindow->m_sWindowData.noRounding;
renderdata.dontRound = (pWindow->m_bIsFullscreen && PWORKSPACE->m_efFullscreenMode == FULLSCREEN_FULL) || pWindow->m_sWindowData.noRounding.value_or(false);
renderdata.fadeAlpha = pWindow->m_fAlpha.value() * (pWindow->m_bPinned ? 1.f : PWORKSPACE->m_fAlpha.value());
renderdata.alpha = pWindow->m_fActiveInactiveAlpha.value();
renderdata.decorate = decorate && !pWindow->m_bX11DoesntWantBorders && (!pWindow->m_bIsFullscreen || PWORKSPACE->m_efFullscreenMode != FULLSCREEN_FULL);
@ -545,14 +545,14 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, CMonitor* pMonitor, timespec
}
// apply opaque
if (pWindow->m_sWindowData.opaque)
if (pWindow->m_sWindowData.opaque.value_or(false))
renderdata.alpha = 1.f;
g_pHyprOpenGL->m_pCurrentWindow = pWindow;
EMIT_HOOK_EVENT("render", RENDER_PRE_WINDOW);
if (*PDIMAROUND && pWindow->m_sWindowData.dimAround && !m_bRenderingSnapshot && mode != RENDER_PASS_POPUP) {
if (*PDIMAROUND && pWindow->m_sWindowData.dimAround.value_or(false) && !m_bRenderingSnapshot && mode != RENDER_PASS_POPUP) {
CBox monbox = {0, 0, g_pHyprOpenGL->m_RenderData.pMonitor->vecTransformedSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecTransformedSize.y};
g_pHyprOpenGL->renderRect(&monbox, CColor(0, 0, 0, *PDIMAROUND * renderdata.alpha * renderdata.fadeAlpha));
}
@ -597,10 +597,10 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, CMonitor* pMonitor, timespec
}
static auto PXWLUSENN = CConfigValue<Hyprlang::INT>("xwayland:use_nearest_neighbor");
if ((pWindow->m_bIsX11 && *PXWLUSENN) || pWindow->m_sWindowData.nearestNeighbor.toUnderlying())
if ((pWindow->m_bIsX11 && *PXWLUSENN) || pWindow->m_sWindowData.nearestNeighbor.value_or(false))
g_pHyprOpenGL->m_RenderData.useNearestNeighbor = true;
if (!pWindow->m_sWindowData.noBlur && pWindow->m_pWLSurface->small() && !pWindow->m_pWLSurface->m_bFillIgnoreSmall && renderdata.blur && *PBLUR) {
if (!pWindow->m_sWindowData.noBlur.value_or(false) && pWindow->m_pWLSurface->small() && !pWindow->m_pWLSurface->m_bFillIgnoreSmall && renderdata.blur && *PBLUR) {
CBox wb = {renderdata.x - pMonitor->vecPosition.x, renderdata.y - pMonitor->vecPosition.y, renderdata.w, renderdata.h};
wb.scale(pMonitor->scale).round();
g_pHyprOpenGL->renderRectWithBlur(&wb, CColor(0, 0, 0, 0), renderdata.dontRound ? 0 : renderdata.rounding - 1, renderdata.fadeAlpha,
@ -662,7 +662,7 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, CMonitor* pMonitor, timespec
g_pHyprOpenGL->m_RenderData.discardOpacity = *PBLURIGNOREA;
}
if (pWindow->m_sWindowData.nearestNeighbor.toUnderlying())
if (pWindow->m_sWindowData.nearestNeighbor.value_or(false))
g_pHyprOpenGL->m_RenderData.useNearestNeighbor = true;
renderdata.surfaceCounter = 0;

View file

@ -133,5 +133,5 @@ std::string CHyprBorderDecoration::getDisplayName() {
}
bool CHyprBorderDecoration::doesntWantBorders() {
return m_pWindow->m_sWindowData.noBorder || m_pWindow->m_bX11DoesntWantBorders || m_pWindow->getRealBorderSize() == 0;
return m_pWindow->m_sWindowData.noBorder.value_or(false) || m_pWindow->m_bX11DoesntWantBorders || m_pWindow->getRealBorderSize() == 0;
}

View file

@ -96,10 +96,10 @@ void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a) {
if (PWINDOW->m_cRealShadowColor.value() == CColor(0, 0, 0, 0))
return; // don't draw invisible shadows
if (!PWINDOW->m_sWindowData.decorate)
if (!PWINDOW->m_sWindowData.decorate.value_or(true))
return;
if (PWINDOW->m_sWindowData.noShadow)
if (PWINDOW->m_sWindowData.noShadow.value_or(false))
return;
static auto PSHADOWS = CConfigValue<Hyprlang::INT>("decoration:drop_shadow");

View file

@ -42,7 +42,7 @@ SDecorationPositioningInfo CHyprGroupBarDecoration::getPositioningInfo() {
info.priority = *PPRIORITY;
info.reserved = true;
if (*PENABLED && m_pWindow->m_sWindowData.decorate) {
if (*PENABLED && m_pWindow->m_sWindowData.decorate.value_or(true)) {
if (*PSTACKED) {
const auto ONEBARHEIGHT = BAR_PADDING_OUTER_VERT + BAR_INDICATOR_HEIGHT + (*PGRADIENTS || *PRENDERTITLES ? *PHEIGHT : 0);
info.desiredExtents = {{0, (ONEBARHEIGHT * m_dwGroupMembers.size()) + 2 + BAR_PADDING_OUTER_VERT}, {0, 0}};
@ -105,7 +105,7 @@ void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a) {
static auto PGRADIENTS = CConfigValue<Hyprlang::INT>("group:groupbar:gradients");
static auto PSTACKED = CConfigValue<Hyprlang::INT>("group:groupbar:stacked");
if (!*PENABLED || !m_pWindow->m_sWindowData.decorate)
if (!*PENABLED || !m_pWindow->m_sWindowData.decorate.value_or(true))
return;
const auto ASSIGNEDBOX = assignedBoxGlobal();