diff --git a/flake.lock b/flake.lock index d3f40397..1066e37b 100644 --- a/flake.lock +++ b/flake.lock @@ -87,11 +87,11 @@ ] }, "locked": { - "lastModified": 1720203444, - "narHash": "sha256-lq2dPPPcwMHTLsFrQ2pRp4c2LwDZWoqzSyjuPdeJCP4=", + "lastModified": 1720545076, + "narHash": "sha256-Pxacc2uoxI00koXp5+CyNqHOTQlqNlK0rlRHDBHX4+g=", "owner": "hyprwm", "repo": "hyprutils", - "rev": "a8c3a135701a7b64db0a88ec353a392f402d2a87", + "rev": "6174a2a25f4e216c0f1d0c4278adc23c476b1d09", "type": "github" }, "original": { @@ -125,11 +125,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1720031269, - "narHash": "sha256-rwz8NJZV+387rnWpTYcXaRNvzUSnnF9aHONoJIYmiUQ=", + "lastModified": 1720542800, + "narHash": "sha256-ZgnNHuKV6h2+fQ5LuqnUaqZey1Lqqt5dTUAiAnqH0QQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "9f4128e00b0ae8ec65918efeba59db998750ead6", + "rev": "feb2849fdeb70028c70d73b848214b00d324a497", "type": "github" }, "original": { diff --git a/protocols/meson.build b/protocols/meson.build index f4978c23..7c508659 100644 --- a/protocols/meson.build +++ b/protocols/meson.build @@ -113,7 +113,8 @@ foreach p : wl_server_protos wl_server_protos_gen += custom_target( p.underscorify(), input: p, - install: false, + install: true, + install_dir: [false, join_paths(get_option('includedir'), 'hyprland/protocols')], output: ['@BASENAME@.cpp', '@BASENAME@.hpp'], command: [hyprwayland_scanner, '--wayland-enums', '@INPUT@', '@OUTDIR@'], ) diff --git a/src/Compositor.cpp b/src/Compositor.cpp index f0a2887a..2abc1144 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -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_sAdditionalConfigData.noFocus && w != pIgnoreWindow) { + if (w->m_bIsFloating && w->m_bIsMapped && !w->isHidden() && !w->m_bX11ShouldntFocus && w->m_bPinned && !w->m_sWindowData.noFocus.valueOrDefault() && 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_sAdditionalConfigData.noFocus && + if (w->m_bIsFloating && w->m_bIsMapped && isWorkspaceVisible(w->m_pWorkspace) && !w->isHidden() && !w->m_bPinned && !w->m_sWindowData.noFocus.valueOrDefault() && 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_sAdditionalConfigData.noFocus && w != pIgnoreWindow) { + !w->m_sWindowData.noFocus.valueOrDefault() && 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_sAdditionalConfigData.noFocus && w != pIgnoreWindow) + !w->m_sWindowData.noFocus.valueOrDefault() && w != pIgnoreWindow) return w; } @@ -940,7 +940,7 @@ void CCompositor::focusWindow(PHLWINDOW pWindow, SP pSurface return; } - if (pWindow->m_sAdditionalConfigData.noFocus) { + if (pWindow->m_sWindowData.noFocus.valueOrDefault()) { 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_sAdditionalConfigData.noFocus)) + if (w->m_pWorkspace == pWindow->m_pWorkspace && w->m_bIsMapped && !w->isHidden() && (!focusableOnly || !w->m_sWindowData.noFocus.valueOrDefault())) 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_sAdditionalConfigData.noFocus)) + if (w != pWindow && w->m_pWorkspace == pWindow->m_pWorkspace && w->m_bIsMapped && !w->isHidden() && (!focusableOnly || !w->m_sWindowData.noFocus.valueOrDefault())) 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_sAdditionalConfigData.noFocus)) + if (w->m_pWorkspace == pWindow->m_pWorkspace && w->m_bIsMapped && !w->isHidden() && (!focusableOnly || !w->m_sWindowData.noFocus.valueOrDefault())) 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_sAdditionalConfigData.noFocus)) + if (w != pWindow && w->m_pWorkspace == pWindow->m_pWorkspace && w->m_bIsMapped && !w->isHidden() && (!focusableOnly || !w->m_sWindowData.noFocus.valueOrDefault())) 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_sSpecialRenderData.activeBorderColor.toUnderlying().m_vColors.empty() ? *ACTIVECOLOR : - pWindow->m_sSpecialRenderData.activeBorderColor.toUnderlying()); + setBorderColor(pWindow->m_sWindowData.activeBorderColor.valueOr(*ACTIVECOLOR)); } else { const auto* const INACTIVECOLOR = !pWindow->m_sGroupData.pNextWindow.lock() ? (!pWindow->m_sGroupData.deny ? INACTIVECOL : NOGROUPINACTIVECOL) : (GROUPLOCKED ? GROUPINACTIVELOCKEDCOL : GROUPINACTIVECOL); - setBorderColor(pWindow->m_sSpecialRenderData.inactiveBorderColor.toUnderlying().m_vColors.empty() ? *INACTIVECOLOR : - pWindow->m_sSpecialRenderData.inactiveBorderColor.toUnderlying()); + setBorderColor(pWindow->m_sWindowData.inactiveBorderColor.valueOr(*INACTIVECOLOR)); } } @@ -1821,23 +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_sSpecialRenderData.alphaFullscreen.toUnderlying() != -1 ? - (pWindow->m_sSpecialRenderData.alphaFullscreenOverride.toUnderlying() ? pWindow->m_sSpecialRenderData.alphaFullscreen.toUnderlying() : - pWindow->m_sSpecialRenderData.alphaFullscreen.toUnderlying() * *PFULLSCREENALPHA) : - *PFULLSCREENALPHA; + pWindow->m_fActiveInactiveAlpha = pWindow->m_sWindowData.alphaFullscreen.valueOrDefault().applyAlpha(*PFULLSCREENALPHA); } else { if (pWindow == m_pLastWindow) - pWindow->m_fActiveInactiveAlpha = pWindow->m_sSpecialRenderData.alphaOverride.toUnderlying() ? pWindow->m_sSpecialRenderData.alpha.toUnderlying() : - pWindow->m_sSpecialRenderData.alpha.toUnderlying() * *PACTIVEALPHA; + pWindow->m_fActiveInactiveAlpha = pWindow->m_sWindowData.alpha.valueOrDefault().applyAlpha(*PACTIVEALPHA); else - pWindow->m_fActiveInactiveAlpha = pWindow->m_sSpecialRenderData.alphaInactive.toUnderlying() != -1 ? - (pWindow->m_sSpecialRenderData.alphaInactiveOverride.toUnderlying() ? pWindow->m_sSpecialRenderData.alphaInactive.toUnderlying() : - pWindow->m_sSpecialRenderData.alphaInactive.toUnderlying() * *PINACTIVEALPHA) : - *PINACTIVEALPHA; + pWindow->m_fActiveInactiveAlpha = pWindow->m_sWindowData.alphaInactive.valueOrDefault().applyAlpha(*PINACTIVEALPHA); } // dim - if (pWindow == m_pLastWindow.lock() || pWindow->m_sAdditionalConfigData.forceNoDim || !*PDIMENABLED) { + if (pWindow == m_pLastWindow.lock() || pWindow->m_sWindowData.noDim.valueOrDefault() || !*PDIMENABLED) { pWindow->m_fDimPercent = 0; } else { pWindow->m_fDimPercent = *PDIMSTRENGTH; @@ -2268,7 +2259,7 @@ void CCompositor::updateWorkspaceWindowDecos(const int& id) { } } -void CCompositor::updateWorkspaceSpecialRenderData(const int& id) { +void CCompositor::updateWorkspaceWindowData(const int& id) { const auto PWORKSPACE = getWorkspaceByID(id); const auto WORKSPACERULE = PWORKSPACE ? g_pConfigManager->getWorkspaceRuleFor(PWORKSPACE) : SWorkspaceRule{}; @@ -2276,7 +2267,7 @@ void CCompositor::updateWorkspaceSpecialRenderData(const int& id) { if (w->workspaceID() != id) continue; - w->updateSpecialRenderData(WORKSPACERULE); + w->updateWindowData(WORKSPACERULE); } } diff --git a/src/Compositor.hpp b/src/Compositor.hpp index 5a1d8a64..17db2c8b 100644 --- a/src/Compositor.hpp +++ b/src/Compositor.hpp @@ -127,7 +127,7 @@ class CCompositor { PHLWORKSPACE getWorkspaceByString(const std::string&); void sanityCheckWorkspaces(); void updateWorkspaceWindowDecos(const int&); - void updateWorkspaceSpecialRenderData(const int&); + void updateWorkspaceWindowData(const int&); int getWindowsOnWorkspace(const int& id, std::optional onlyTiled = {}, std::optional onlyVisible = {}); int getGroupsOnWorkspace(const int& id, std::optional onlyTiled = {}, std::optional onlyVisible = {}); PHLWINDOW getUrgentWindow(); diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 54d0c24a..234dd5eb 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -881,7 +881,7 @@ void CConfigManager::postConfigReload(const Hyprlang::CParseResult& result) { if (w->inert()) continue; g_pCompositor->updateWorkspaceWindows(w->m_iID); - g_pCompositor->updateWorkspaceSpecialRenderData(w->m_iID); + g_pCompositor->updateWorkspaceWindowData(w->m_iID); } // Update window border colors @@ -1095,14 +1095,14 @@ SWorkspaceRule CConfigManager::mergeWorkspaceRules(const SWorkspaceRule& rule1, mergedRule.gapsOut = rule2.gapsOut; if (rule2.borderSize.has_value()) mergedRule.borderSize = rule2.borderSize; - if (rule2.border.has_value()) - mergedRule.border = rule2.border; - if (rule2.rounding.has_value()) - mergedRule.rounding = rule2.rounding; + if (rule2.noBorder.has_value()) + mergedRule.noBorder = rule2.noBorder; + if (rule2.noRounding.has_value()) + mergedRule.noRounding = rule2.noRounding; if (rule2.decorate.has_value()) mergedRule.decorate = rule2.decorate; - if (rule2.shadow.has_value()) - mergedRule.shadow = rule2.shadow; + if (rule2.noShadow.has_value()) + mergedRule.noShadow = rule2.noShadow; if (rule2.onCreatedEmptyRunCmd.has_value()) mergedRule.onCreatedEmptyRunCmd = rule2.onCreatedEmptyRunCmd; if (rule2.defaultName.has_value()) @@ -2123,16 +2123,17 @@ std::optional CConfigManager::handleUnbind(const std::string& comma bool windowRuleValid(const std::string& RULE) { static const auto rules = std::unordered_set{ - "dimaround", "fakefullscreen", "float", "focusonactivate", "forceinput", "forcergbx", "fullscreen", "immediate", - "keepaspectratio", "maximize", "nearestneighbor", "noanim", "noblur", "noborder", "nodim", "nofocus", - "noinitialfocus", "nomaxsize", "noshadow", "opaque", "pin", "stayfocused", "tile", "windowdance", + "fakefullscreen", "float", "fullscreen", "maximize", "noinitialfocus", "pin", "stayfocused", "tile", }; static const auto rulesPrefix = std::vector{ "animation", "bordercolor", "bordersize", "center", "group", "idleinhibit", "maxsize", "minsize", "monitor", "move", "opacity", "plugin:", "pseudo", "rounding", "size", "suppressevent", "tag", "workspace", "xray", }; - return rules.contains(RULE) || std::any_of(rulesPrefix.begin(), rulesPrefix.end(), [&RULE](auto prefix) { return RULE.starts_with(prefix); }); + const auto VALS = CVarList(RULE, 2, ' '); + return rules.contains(RULE) || std::any_of(rulesPrefix.begin(), rulesPrefix.end(), [&RULE](auto prefix) { return RULE.starts_with(prefix); }) || + (g_pConfigManager->mbWindowProperties.find(VALS[0]) != g_pConfigManager->mbWindowProperties.end()) || + (g_pConfigManager->miWindowProperties.find(VALS[0]) != g_pConfigManager->miWindowProperties.end()); } bool layerRuleValid(const std::string& RULE) { @@ -2458,11 +2459,11 @@ std::optional CConfigManager::handleWorkspaceRules(const std::strin wsRule.borderSize = std::stoi(rule.substr(delim + 11)); } catch (...) { return "Error parsing workspace rule bordersize: {}", rule.substr(delim + 11); } else if ((delim = rule.find("border:")) != std::string::npos) - wsRule.border = configStringToInt(rule.substr(delim + 7)); + wsRule.noBorder = !configStringToInt(rule.substr(delim + 7)); else if ((delim = rule.find("shadow:")) != std::string::npos) - wsRule.shadow = configStringToInt(rule.substr(delim + 7)); + wsRule.noShadow = !configStringToInt(rule.substr(delim + 7)); else if ((delim = rule.find("rounding:")) != std::string::npos) - wsRule.rounding = configStringToInt(rule.substr(delim + 9)); + wsRule.noRounding = !configStringToInt(rule.substr(delim + 9)); else if ((delim = rule.find("decorate:")) != std::string::npos) wsRule.decorate = configStringToInt(rule.substr(delim + 9)); else if ((delim = rule.find("monitor:")) != std::string::npos) diff --git a/src/config/ConfigManager.hpp b/src/config/ConfigManager.hpp index 1237bac2..2d8b219f 100644 --- a/src/config/ConfigManager.hpp +++ b/src/config/ConfigManager.hpp @@ -44,10 +44,10 @@ struct SWorkspaceRule { std::optional gapsIn; std::optional gapsOut; std::optional borderSize; - std::optional border; - std::optional rounding; - std::optional decorate; - std::optional shadow; + std::optional decorate; + std::optional noRounding; + std::optional noBorder; + std::optional noShadow; std::optional onCreatedEmptyRunCmd; std::optional defaultName; std::map layoutopts; @@ -176,26 +176,52 @@ class CConfigManager { void handlePluginLoads(); std::string getErrors(); - // Keywords - std::optional handleRawExec(const std::string&, const std::string&); - std::optional handleExecOnce(const std::string&, const std::string&); - std::optional handleMonitor(const std::string&, const std::string&); - std::optional handleBind(const std::string&, const std::string&); - std::optional handleUnbind(const std::string&, const std::string&); - std::optional handleWindowRule(const std::string&, const std::string&); - std::optional handleLayerRule(const std::string&, const std::string&); - std::optional handleWindowRuleV2(const std::string&, const std::string&); - std::optional handleWorkspaceRules(const std::string&, const std::string&); - std::optional handleBezier(const std::string&, const std::string&); - std::optional handleAnimation(const std::string&, const std::string&); - std::optional handleSource(const std::string&, const std::string&); - std::optional handleSubmap(const std::string&, const std::string&); - std::optional handleBlurLS(const std::string&, const std::string&); - std::optional handleBindWS(const std::string&, const std::string&); - std::optional handleEnv(const std::string&, const std::string&); - std::optional handlePlugin(const std::string&, const std::string&); - std::string configCurrentPath; + // keywords + std::optional handleRawExec(const std::string&, const std::string&); + std::optional handleExecOnce(const std::string&, const std::string&); + std::optional handleMonitor(const std::string&, const std::string&); + std::optional handleBind(const std::string&, const std::string&); + std::optional handleUnbind(const std::string&, const std::string&); + std::optional handleWindowRule(const std::string&, const std::string&); + std::optional handleLayerRule(const std::string&, const std::string&); + std::optional handleWindowRuleV2(const std::string&, const std::string&); + std::optional handleWorkspaceRules(const std::string&, const std::string&); + std::optional handleBezier(const std::string&, const std::string&); + std::optional handleAnimation(const std::string&, const std::string&); + std::optional handleSource(const std::string&, const std::string&); + std::optional handleSubmap(const std::string&, const std::string&); + std::optional handleBlurLS(const std::string&, const std::string&); + std::optional handleBindWS(const std::string&, const std::string&); + std::optional handleEnv(const std::string&, const std::string&); + std::optional handlePlugin(const std::string&, const std::string&); + + std::string configCurrentPath; + + std::unordered_map*(PHLWINDOW)>> mbWindowProperties = { + {"allowsinput", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.allowsInput; }}, + {"dimaround", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.dimAround; }}, + {"decorate", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.decorate; }}, + {"focusonactivate", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.focusOnActivate; }}, + {"keepaspectratio", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.keepAspectRatio; }}, + {"nearestneighbor", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.nearestNeighbor; }}, + {"noanim", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noAnim; }}, + {"noblur", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noBlur; }}, + {"noborder", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noBorder; }}, + {"nodim", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noDim; }}, + {"nofocus", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noFocus; }}, + {"nomaxsize", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noMaxSize; }}, + {"norounding", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noRounding; }}, + {"noshadow", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noShadow; }}, + {"opaque", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.opaque; }}, + {"forcergbx", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.RGBX; }}, + {"immediate", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.tearing; }}, + {"xray", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.xray; }}, + }; + + std::unordered_map*(PHLWINDOW)>> miWindowProperties = { + {"rounding", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.rounding; }}, {"bordersize", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.borderSize; }}}; + private: std::unique_ptr m_pConfig; diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp index f96c071a..08d2bb57 100644 --- a/src/debug/HyprCtl.cpp +++ b/src/debug/HyprCtl.cpp @@ -317,10 +317,10 @@ static std::string getWorkspaceRuleData(const SWorkspaceRule& r, eHyprCtlOutputF std::format(",\n \"gapsOut\": [{}, {}, {}, {}]", r.gapsOut.value().top, r.gapsOut.value().right, r.gapsOut.value().bottom, r.gapsOut.value().left) : ""; const std::string borderSize = (bool)(r.borderSize) ? std::format(",\n \"borderSize\": {}", r.borderSize.value()) : ""; - const std::string border = (bool)(r.border) ? std::format(",\n \"border\": {}", boolToString(r.border.value())) : ""; - const std::string rounding = (bool)(r.rounding) ? std::format(",\n \"rounding\": {}", boolToString(r.rounding.value())) : ""; + const std::string border = (bool)(r.noBorder) ? std::format(",\n \"border\": {}", boolToString(!r.noBorder.value())) : ""; + const std::string rounding = (bool)(r.noRounding) ? std::format(",\n \"rounding\": {}", boolToString(!r.noRounding.value())) : ""; const std::string decorate = (bool)(r.decorate) ? std::format(",\n \"decorate\": {}", boolToString(r.decorate.value())) : ""; - const std::string shadow = (bool)(r.shadow) ? std::format(",\n \"shadow\": {}", boolToString(r.shadow.value())) : ""; + const std::string shadow = (bool)(r.noShadow) ? std::format(",\n \"shadow\": {}", boolToString(!r.noShadow.value())) : ""; std::string result = std::format(R"#({{ "workspaceString": "{}"{}{}{}{}{}{}{}{} @@ -339,10 +339,10 @@ static std::string getWorkspaceRuleData(const SWorkspaceRule& r, eHyprCtlOutputF std::to_string(r.gapsOut.value().bottom), std::to_string(r.gapsOut.value().left)) : std::format("\tgapsOut: \n"); const std::string borderSize = std::format("\tborderSize: {}\n", (bool)(r.borderSize) ? std::to_string(r.borderSize.value()) : ""); - const std::string border = std::format("\tborder: {}\n", (bool)(r.border) ? boolToString(r.border.value()) : ""); - const std::string rounding = std::format("\trounding: {}\n", (bool)(r.rounding) ? boolToString(r.rounding.value()) : ""); + const std::string border = std::format("\tborder: {}\n", (bool)(r.noBorder) ? boolToString(!r.noBorder.value()) : ""); + const std::string rounding = std::format("\trounding: {}\n", (bool)(r.noRounding) ? boolToString(!r.noRounding.value()) : ""); const std::string decorate = std::format("\tdecorate: {}\n", (bool)(r.decorate) ? boolToString(r.decorate.value()) : ""); - const std::string shadow = std::format("\tshadow: {}\n", (bool)(r.shadow) ? boolToString(r.shadow.value()) : ""); + const std::string shadow = std::format("\tshadow: {}\n", (bool)(r.noShadow) ? boolToString(!r.noShadow.value()) : ""); std::string result = std::format("Workspace rule {}:\n{}{}{}{}{}{}{}{}{}{}\n", escapeJSONStrings(r.workspaceString), monitor, default_, persistent, gapsIn, gapsOut, borderSize, border, rounding, decorate, shadow); @@ -1202,74 +1202,44 @@ std::string dispatchSetProp(eHyprCtlOutputFormat format, std::string request) { const auto PROP = vars[2]; const auto VAL = vars[3]; - auto noFocus = PWINDOW->m_sAdditionalConfigData.noFocus; - - bool lock = false; - - if (request.ends_with("lock")) - lock = true; + bool noFocus = PWINDOW->m_sWindowData.noFocus.valueOrDefault(); try { if (PROP == "animationstyle") { - PWINDOW->m_sAdditionalConfigData.animationStyle = VAL; - } else if (PROP == "rounding") { - PWINDOW->m_sAdditionalConfigData.rounding.forceSetIgnoreLocked(configStringToInt(VAL), lock); - } else if (PROP == "forcenoblur") { - PWINDOW->m_sAdditionalConfigData.forceNoBlur.forceSetIgnoreLocked(configStringToInt(VAL), lock); - } else if (PROP == "forceopaque") { - PWINDOW->m_sAdditionalConfigData.forceOpaque.forceSetIgnoreLocked(configStringToInt(VAL), lock); - } else if (PROP == "forceopaqueoverriden") { - PWINDOW->m_sAdditionalConfigData.forceOpaqueOverridden.forceSetIgnoreLocked(configStringToInt(VAL), lock); - } else if (PROP == "forceallowsinput") { - PWINDOW->m_sAdditionalConfigData.forceAllowsInput.forceSetIgnoreLocked(configStringToInt(VAL), lock); - } else if (PROP == "forcenoanims") { - PWINDOW->m_sAdditionalConfigData.forceNoAnims.forceSetIgnoreLocked(configStringToInt(VAL), lock); - } else if (PROP == "forcenoborder") { - PWINDOW->m_sAdditionalConfigData.forceNoBorder.forceSetIgnoreLocked(configStringToInt(VAL), lock); - } else if (PROP == "forcenoshadow") { - PWINDOW->m_sAdditionalConfigData.forceNoShadow.forceSetIgnoreLocked(configStringToInt(VAL), lock); - } else if (PROP == "forcenodim") { - PWINDOW->m_sAdditionalConfigData.forceNoDim.forceSetIgnoreLocked(configStringToInt(VAL), lock); - } else if (PROP == "nofocus") { - PWINDOW->m_sAdditionalConfigData.noFocus.forceSetIgnoreLocked(configStringToInt(VAL), lock); - } else if (PROP == "windowdancecompat") { - PWINDOW->m_sAdditionalConfigData.windowDanceCompat.forceSetIgnoreLocked(configStringToInt(VAL), lock); - } else if (PROP == "nomaxsize") { - PWINDOW->m_sAdditionalConfigData.noMaxSize.forceSetIgnoreLocked(configStringToInt(VAL), lock); + PWINDOW->m_sWindowData.animationStyle = CWindowOverridableVar(VAL, PRIORITY_SET_PROP); } else if (PROP == "maxsize") { - PWINDOW->m_sAdditionalConfigData.maxSize.forceSetIgnoreLocked(configStringToVector2D(VAL + " " + vars[4]), lock); - if (lock) { - PWINDOW->m_vRealSize = Vector2D(std::min((double)PWINDOW->m_sAdditionalConfigData.maxSize.toUnderlying().x, PWINDOW->m_vRealSize.goal().x), - std::min((double)PWINDOW->m_sAdditionalConfigData.maxSize.toUnderlying().y, PWINDOW->m_vRealSize.goal().y)); - g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goal()); - PWINDOW->setHidden(false); - } + PWINDOW->m_sWindowData.maxSize = CWindowOverridableVar(configStringToVector2D(VAL + " " + vars[4]), PRIORITY_SET_PROP); + 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_sAdditionalConfigData.minSize.forceSetIgnoreLocked(configStringToVector2D(VAL + " " + vars[4]), lock); - if (lock) { - PWINDOW->m_vRealSize = Vector2D(std::max((double)PWINDOW->m_sAdditionalConfigData.minSize.toUnderlying().x, PWINDOW->m_vRealSize.goal().x), - std::max((double)PWINDOW->m_sAdditionalConfigData.minSize.toUnderlying().y, PWINDOW->m_vRealSize.goal().y)); - g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goal()); - PWINDOW->setHidden(false); - } - } else if (PROP == "dimaround") { - PWINDOW->m_sAdditionalConfigData.dimAround.forceSetIgnoreLocked(configStringToInt(VAL), lock); - } else if (PROP == "alphaoverride") { - PWINDOW->m_sSpecialRenderData.alphaOverride.forceSetIgnoreLocked(configStringToInt(VAL), lock); + PWINDOW->m_sWindowData.minSize = CWindowOverridableVar(configStringToVector2D(VAL + " " + vars[4]), PRIORITY_SET_PROP); + 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_sSpecialRenderData.alpha.forceSetIgnoreLocked(std::stof(VAL), lock); - } else if (PROP == "alphainactiveoverride") { - PWINDOW->m_sSpecialRenderData.alphaInactiveOverride.forceSetIgnoreLocked(configStringToInt(VAL), lock); + PWINDOW->m_sWindowData.alpha = CWindowOverridableVar(SAlphaValue{std::stof(VAL), PWINDOW->m_sWindowData.alpha.valueOrDefault().m_bOverride}, PRIORITY_SET_PROP); } else if (PROP == "alphainactive") { - PWINDOW->m_sSpecialRenderData.alphaInactive.forceSetIgnoreLocked(std::stof(VAL), lock); - } else if (PROP == "alphafullscreenoverride") { - PWINDOW->m_sSpecialRenderData.alphaFullscreenOverride.forceSetIgnoreLocked(configStringToInt(VAL), lock); + PWINDOW->m_sWindowData.alphaInactive = + CWindowOverridableVar(SAlphaValue{std::stof(VAL), PWINDOW->m_sWindowData.alphaInactive.valueOrDefault().m_bOverride}, PRIORITY_SET_PROP); } else if (PROP == "alphafullscreen") { - PWINDOW->m_sSpecialRenderData.alphaFullscreen.forceSetIgnoreLocked(std::stof(VAL), lock); + PWINDOW->m_sWindowData.alphaFullscreen = + CWindowOverridableVar(SAlphaValue{std::stof(VAL), PWINDOW->m_sWindowData.alphaFullscreen.valueOrDefault().m_bOverride}, PRIORITY_SET_PROP); + } else if (PROP == "alphaoverride") { + PWINDOW->m_sWindowData.alpha = + CWindowOverridableVar(SAlphaValue{PWINDOW->m_sWindowData.alpha.valueOrDefault().m_fAlpha, (bool)configStringToInt(VAL)}, PRIORITY_SET_PROP); + } else if (PROP == "alphainactiveoverride") { + PWINDOW->m_sWindowData.alphaInactive = + CWindowOverridableVar(SAlphaValue{PWINDOW->m_sWindowData.alphaInactive.valueOrDefault().m_fAlpha, (bool)configStringToInt(VAL)}, PRIORITY_SET_PROP); + } else if (PROP == "alphafullscreenoverride") { + PWINDOW->m_sWindowData.alphaFullscreen = + CWindowOverridableVar(SAlphaValue{PWINDOW->m_sWindowData.alphaFullscreen.valueOrDefault().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(lock ? vars.size() - 1 : vars.size()); ++i) { + for (int i = 3; i < static_cast(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); @@ -1280,19 +1250,22 @@ std::string dispatchSetProp(eHyprCtlOutputFormat format, std::string request) { colorData.m_vColors.push_back(configStringToInt(VAL)); if (PROP == "activebordercolor") - PWINDOW->m_sSpecialRenderData.activeBorderColor.forceSetIgnoreLocked(colorData, lock); + PWINDOW->m_sWindowData.activeBorderColor = CWindowOverridableVar(colorData, PRIORITY_SET_PROP); else - PWINDOW->m_sSpecialRenderData.inactiveBorderColor.forceSetIgnoreLocked(colorData, lock); - } else if (PROP == "forcergbx") { - PWINDOW->m_sAdditionalConfigData.forceRGBX.forceSetIgnoreLocked(configStringToInt(VAL), lock); - } else if (PROP == "bordersize") { - PWINDOW->m_sSpecialRenderData.borderSize.forceSetIgnoreLocked(configStringToInt(VAL), lock); - } else if (PROP == "keepaspectratio") { - PWINDOW->m_sAdditionalConfigData.keepAspectRatio.forceSetIgnoreLocked(configStringToInt(VAL), lock); - } else if (PROP == "immediate") { - PWINDOW->m_sAdditionalConfigData.forceTearing.forceSetIgnoreLocked(configStringToInt(VAL), lock); - } else if (PROP == "nearestneighbor") { - PWINDOW->m_sAdditionalConfigData.nearestNeighbor.forceSetIgnoreLocked(configStringToInt(VAL), lock); + PWINDOW->m_sWindowData.inactiveBorderColor = CWindowOverridableVar(colorData, PRIORITY_SET_PROP); + } else if (auto search = g_pConfigManager->mbWindowProperties.find(PROP); search != g_pConfigManager->mbWindowProperties.end()) { + auto pWindowDataElement = search->second(PWINDOW); + if (VAL == "toggle") + *pWindowDataElement = CWindowOverridableVar(!pWindowDataElement->valueOrDefault(), PRIORITY_SET_PROP); + else if (VAL == "unset") + pWindowDataElement->unset(PRIORITY_SET_PROP); + else + *pWindowDataElement = CWindowOverridableVar((bool)configStringToInt(VAL), PRIORITY_SET_PROP); + } else if (auto search = g_pConfigManager->miWindowProperties.find(PROP); search != g_pConfigManager->miWindowProperties.end()) { + if (VAL == "unset") + search->second(PWINDOW)->unset(PRIORITY_SET_PROP); + else + *(search->second(PWINDOW)) = CWindowOverridableVar((int)configStringToInt(VAL), PRIORITY_SET_PROP); } else { return "prop not found"; } @@ -1300,7 +1273,7 @@ std::string dispatchSetProp(eHyprCtlOutputFormat format, std::string request) { g_pCompositor->updateAllWindowsAnimatedDecorationValues(); - if (!(PWINDOW->m_sAdditionalConfigData.noFocus.toUnderlying() == noFocus.toUnderlying())) { + if (!(PWINDOW->m_sWindowData.noFocus.valueOrDefault() == noFocus)) { g_pCompositor->focusWindow(nullptr); g_pCompositor->focusWindow(PWINDOW); g_pCompositor->focusWindow(PLASTWINDOW); @@ -1848,7 +1821,6 @@ int hyprCtlFDTick(int fd, uint32_t mask, void* data) { } void CHyprCtl::startHyprCtlSocket() { - m_iSocketFD = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0); if (m_iSocketFD < 0) { diff --git a/src/desktop/Window.cpp b/src/desktop/Window.cpp index 560e5103..2dc5846b 100644 --- a/src/desktop/Window.cpp +++ b/src/desktop/Window.cpp @@ -110,7 +110,7 @@ SBoxExtents CWindow::getFullWindowExtents() { const int BORDERSIZE = getRealBorderSize(); - if (m_sAdditionalConfigData.dimAround) { + if (m_sWindowData.dimAround.valueOrDefault()) { 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_sAdditionalConfigData.dimAround) { + if (m_sWindowData.dimAround.valueOrDefault()) { 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_sAdditionalConfigData.dimAround) { + if (m_sWindowData.dimAround.valueOrDefault()) { const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID); if (PMONITOR) return {PMONITOR->vecPosition.x, PMONITOR->vecPosition.y, PMONITOR->vecSize.x, PMONITOR->vecSize.y}; @@ -411,11 +411,11 @@ void CWindow::moveToWorkspace(PHLWORKSPACE pWorkspace) { setAnimationsToMove(); g_pCompositor->updateWorkspaceWindows(OLDWORKSPACE->m_iID); - g_pCompositor->updateWorkspaceSpecialRenderData(OLDWORKSPACE->m_iID); + g_pCompositor->updateWorkspaceWindowData(OLDWORKSPACE->m_iID); g_pLayoutManager->getCurrentLayout()->recalculateMonitor(OLDWORKSPACE->m_iMonitorID); g_pCompositor->updateWorkspaceWindows(workspaceID()); - g_pCompositor->updateWorkspaceSpecialRenderData(workspaceID()); + g_pCompositor->updateWorkspaceWindowData(workspaceID()); g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m_iMonitorID); g_pCompositor->updateAllWindowsAnimatedDecorationValues(); @@ -524,7 +524,7 @@ void CWindow::onUnmap() { PMONITOR->solitaryClient.reset(); g_pCompositor->updateWorkspaceWindows(workspaceID()); - g_pCompositor->updateWorkspaceSpecialRenderData(workspaceID()); + g_pCompositor->updateWorkspaceWindowData(workspaceID()); g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m_iMonitorID); g_pCompositor->updateAllWindowsAnimatedDecorationValues(); @@ -607,38 +607,15 @@ bool CWindow::isHidden() { } void CWindow::applyDynamicRule(const SWindowRule& r) { - if (r.szRule == "noblur") { - m_sAdditionalConfigData.forceNoBlur = true; - } else if (r.szRule == "noborder") { - m_sAdditionalConfigData.forceNoBorder = true; - } else if (r.szRule == "noshadow") { - m_sAdditionalConfigData.forceNoShadow = true; - } else if (r.szRule == "nodim") { - m_sAdditionalConfigData.forceNoDim = true; - } else if (r.szRule == "forcergbx") { - m_sAdditionalConfigData.forceRGBX = true; - } else if (r.szRule == "opaque") { - if (!m_sAdditionalConfigData.forceOpaqueOverridden) - m_sAdditionalConfigData.forceOpaque = true; - } else if (r.szRule == "immediate") { - m_sAdditionalConfigData.forceTearing = true; - } else if (r.szRule == "nearestneighbor") { - m_sAdditionalConfigData.nearestNeighbor = true; - } else if (r.szRule.starts_with("tag")) { + const eOverridePriority priority = r.szValue == "execRule" ? PRIORITY_SET_PROP : PRIORITY_WINDOW_RULE; + const CVarList VARS(r.szRule, 0, ' '); + if (r.szRule.starts_with("tag")) { CVarList vars{r.szRule, 0, 's', true}; if (vars.size() == 2 && vars[0] == "tag") m_tags.applyTag(vars[1], true); else Debug::log(ERR, "Tag rule invalid: {}", r.szRule); - } else if (r.szRule.starts_with("rounding")) { - try { - m_sAdditionalConfigData.rounding = std::stoi(r.szRule.substr(r.szRule.find_first_of(' ') + 1)); - } catch (std::exception& e) { Debug::log(ERR, "Rounding rule \"{}\" failed with: {}", r.szRule, e.what()); } - } else if (r.szRule.starts_with("bordersize")) { - try { - m_sAdditionalConfigData.borderSize = std::stoi(r.szRule.substr(r.szRule.find_first_of(' ') + 1)); - } catch (std::exception& e) { Debug::log(ERR, "Bordersize rule \"{}\" failed with: {}", r.szRule, e.what()); } } else if (r.szRule.starts_with("opacity")) { try { CVarList vars(r.szRule, 0, ' '); @@ -651,21 +628,18 @@ void CWindow::applyDynamicRule(const SWindowRule& r) { if (r == "override") { if (opacityIDX == 1) - m_sSpecialRenderData.alphaOverride = true; + m_sWindowData.alpha = CWindowOverridableVar(SAlphaValue{m_sWindowData.alpha.value().m_fAlpha, true}, priority); else if (opacityIDX == 2) - m_sSpecialRenderData.alphaInactiveOverride = true; + m_sWindowData.alphaInactive = CWindowOverridableVar(SAlphaValue{m_sWindowData.alphaInactive.value().m_fAlpha, true}, priority); else if (opacityIDX == 3) - m_sSpecialRenderData.alphaFullscreenOverride = true; + m_sWindowData.alphaFullscreen = CWindowOverridableVar(SAlphaValue{m_sWindowData.alphaFullscreen.value().m_fAlpha, true}, priority); } else { if (opacityIDX == 0) { - m_sSpecialRenderData.alpha = std::stof(r); - m_sSpecialRenderData.alphaOverride = false; + m_sWindowData.alpha = CWindowOverridableVar(SAlphaValue{std::stof(r), false}, priority); } else if (opacityIDX == 1) { - m_sSpecialRenderData.alphaInactive = std::stof(r); - m_sSpecialRenderData.alphaInactiveOverride = false; + m_sWindowData.alphaInactive = CWindowOverridableVar(SAlphaValue{std::stof(r), false}, priority); } else if (opacityIDX == 2) { - m_sSpecialRenderData.alphaFullscreen = std::stof(r); - m_sSpecialRenderData.alphaFullscreenOverride = false; + m_sWindowData.alphaFullscreen = CWindowOverridableVar(SAlphaValue{std::stof(r), false}, priority); } else { throw std::runtime_error("more than 3 alpha values"); } @@ -675,17 +649,13 @@ void CWindow::applyDynamicRule(const SWindowRule& r) { } if (opacityIDX == 1) { - m_sSpecialRenderData.alphaInactiveOverride = m_sSpecialRenderData.alphaOverride; - m_sSpecialRenderData.alphaInactive = m_sSpecialRenderData.alpha; - m_sSpecialRenderData.alphaFullscreenOverride = m_sSpecialRenderData.alphaOverride; - m_sSpecialRenderData.alphaFullscreen = m_sSpecialRenderData.alpha; + m_sWindowData.alphaInactive = m_sWindowData.alpha; + m_sWindowData.alphaFullscreen = m_sWindowData.alpha; } } catch (std::exception& e) { Debug::log(ERR, "Opacity rule \"{}\" failed with: {}", r.szRule, e.what()); } - } else if (r.szRule == "noanim") { - m_sAdditionalConfigData.forceNoAnims = true; } else if (r.szRule.starts_with("animation")) { - auto STYLE = r.szRule.substr(r.szRule.find_first_of(' ') + 1); - m_sAdditionalConfigData.animationStyle = STYLE; + auto STYLE = r.szRule.substr(r.szRule.find_first_of(' ') + 1); + m_sWindowData.animationStyle = CWindowOverridableVar(STYLE, priority); } else if (r.szRule.starts_with("bordercolor")) { try { // Each vector will only get used if it has at least one color @@ -696,8 +666,8 @@ void CWindow::applyDynamicRule(const SWindowRule& r) { // Basic form has only two colors, everything else can be parsed as a gradient if (colorsAndAngles.size() == 2 && !colorsAndAngles[1].contains("deg")) { - m_sSpecialRenderData.activeBorderColor = CGradientValueData(CColor(configStringToInt(colorsAndAngles[0]))); - m_sSpecialRenderData.inactiveBorderColor = CGradientValueData(CColor(configStringToInt(colorsAndAngles[1]))); + m_sWindowData.activeBorderColor = CWindowOverridableVar(CGradientValueData(CColor(configStringToInt(colorsAndAngles[0]))), priority); + m_sWindowData.inactiveBorderColor = CWindowOverridableVar(CGradientValueData(CColor(configStringToInt(colorsAndAngles[1]))), priority); return; } @@ -720,24 +690,24 @@ void CWindow::applyDynamicRule(const SWindowRule& r) { else if (activeBorderGradient.m_vColors.empty()) Debug::log(WARN, "Bordercolor rule \"{}\" has no colors, ignoring", r.szRule); else if (inactiveBorderGradient.m_vColors.empty()) - m_sSpecialRenderData.activeBorderColor = activeBorderGradient; + m_sWindowData.activeBorderColor = CWindowOverridableVar(activeBorderGradient, priority); else { - m_sSpecialRenderData.activeBorderColor = activeBorderGradient; - m_sSpecialRenderData.inactiveBorderColor = inactiveBorderGradient; + m_sWindowData.activeBorderColor = CWindowOverridableVar(activeBorderGradient, priority); + m_sWindowData.inactiveBorderColor = CWindowOverridableVar(inactiveBorderGradient, priority); } } catch (std::exception& e) { Debug::log(ERR, "BorderColor rule \"{}\" failed with: {}", r.szRule, e.what()); } - } else if (r.szRule == "dimaround") { - m_sAdditionalConfigData.dimAround = true; - } else if (r.szRule == "keepaspectratio") { - m_sAdditionalConfigData.keepAspectRatio = true; - } else if (r.szRule.starts_with("focusonactivate")) { - m_sAdditionalConfigData.focusOnActivate = true; - } else if (r.szRule.starts_with("xray")) { - CVarList vars(r.szRule, 0, ' '); - + } else if (auto search = g_pConfigManager->mbWindowProperties.find(VARS[0]); search != g_pConfigManager->mbWindowProperties.end()) { + if (VARS[1].empty()) { + *(search->second(m_pSelf.lock())) = CWindowOverridableVar(true, priority); + } else { + try { + *(search->second(m_pSelf.lock())) = CWindowOverridableVar((bool)configStringToInt(VARS[1]), priority); + } catch (...) {} + } + } else if (auto search = g_pConfigManager->miWindowProperties.find(VARS[0]); search != g_pConfigManager->miWindowProperties.end()) { try { - m_sAdditionalConfigData.xray = configStringToInt(vars[1]); - } catch (...) {} + *(search->second(m_pSelf.lock())) = CWindowOverridableVar(std::stoi(VARS[1]), priority); + } catch (std::exception& e) { Debug::log(ERR, "Rule \"{}\" failed with: {}", r.szRule, e.what()); } } else if (r.szRule.starts_with("idleinhibit")) { auto IDLERULE = r.szRule.substr(r.szRule.find_first_of(' ') + 1); @@ -761,9 +731,9 @@ void CWindow::applyDynamicRule(const SWindowRule& r) { return; } - m_sAdditionalConfigData.maxSize = VEC; - m_vRealSize = Vector2D(std::min((double)m_sAdditionalConfigData.maxSize.toUnderlying().x, m_vRealSize.goal().x), - std::min((double)m_sAdditionalConfigData.maxSize.toUnderlying().y, m_vRealSize.goal().y)); + m_sWindowData.maxSize = CWindowOverridableVar(VEC, priority); + 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")) { @@ -776,9 +746,9 @@ void CWindow::applyDynamicRule(const SWindowRule& r) { return; } - m_sAdditionalConfigData.minSize = VEC; - m_vRealSize = Vector2D(std::max((double)m_sAdditionalConfigData.minSize.toUnderlying().x, m_vRealSize.goal().x), - std::max((double)m_sAdditionalConfigData.minSize.toUnderlying().y, m_vRealSize.goal().y)); + m_sWindowData.minSize = CWindowOverridableVar(VEC, priority); + 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); @@ -787,30 +757,20 @@ void CWindow::applyDynamicRule(const SWindowRule& r) { } void CWindow::updateDynamicRules() { - m_sSpecialRenderData.activeBorderColor = CGradientValueData(); - m_sSpecialRenderData.inactiveBorderColor = CGradientValueData(); - m_sSpecialRenderData.alpha = 1.f; - m_sSpecialRenderData.alphaInactive = -1.f; - m_sAdditionalConfigData.forceNoBlur = false; - m_sAdditionalConfigData.forceNoBorder = false; - m_sAdditionalConfigData.forceNoShadow = false; - m_sAdditionalConfigData.forceNoDim = false; - if (!m_sAdditionalConfigData.forceOpaqueOverridden) - m_sAdditionalConfigData.forceOpaque = false; - m_sAdditionalConfigData.maxSize = Vector2D(std::numeric_limits::max(), std::numeric_limits::max()); - m_sAdditionalConfigData.minSize = Vector2D(20, 20); - m_sAdditionalConfigData.forceNoAnims = false; - m_sAdditionalConfigData.animationStyle = std::string(""); - m_sAdditionalConfigData.rounding = -1; - m_sAdditionalConfigData.dimAround = false; - m_sAdditionalConfigData.forceRGBX = false; - m_sAdditionalConfigData.borderSize = -1; - m_sAdditionalConfigData.keepAspectRatio = false; - m_sAdditionalConfigData.focusOnActivate = false; - m_sAdditionalConfigData.xray = -1; - m_sAdditionalConfigData.forceTearing = false; - m_sAdditionalConfigData.nearestNeighbor = false; - m_eIdleInhibitMode = IDLEINHIBIT_NONE; + m_sWindowData.alpha.unset(PRIORITY_WINDOW_RULE); + m_sWindowData.alphaInactive.unset(PRIORITY_WINDOW_RULE); + m_sWindowData.alphaFullscreen.unset(PRIORITY_WINDOW_RULE); + + unsetWindowData(PRIORITY_WINDOW_RULE); + + m_sWindowData.animationStyle.unset(PRIORITY_WINDOW_RULE); + m_sWindowData.maxSize.unset(PRIORITY_WINDOW_RULE); + m_sWindowData.minSize.unset(PRIORITY_WINDOW_RULE); + + m_sWindowData.activeBorderColor.unset(PRIORITY_WINDOW_RULE); + m_sWindowData.inactiveBorderColor.unset(PRIORITY_WINDOW_RULE); + + m_eIdleInhibitMode = IDLEINHIBIT_NONE; m_tags.removeDynamicTags(); @@ -887,7 +847,7 @@ void CWindow::createGroup() { addWindowDeco(std::make_unique(m_pSelf.lock())); g_pCompositor->updateWorkspaceWindows(workspaceID()); - g_pCompositor->updateWorkspaceSpecialRenderData(workspaceID()); + g_pCompositor->updateWorkspaceWindowData(workspaceID()); g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m_iMonitorID); g_pCompositor->updateAllWindowsAnimatedDecorationValues(); @@ -905,7 +865,7 @@ void CWindow::destroyGroup() { m_sGroupData.head = false; updateWindowDecos(); g_pCompositor->updateWorkspaceWindows(workspaceID()); - g_pCompositor->updateWorkspaceSpecialRenderData(workspaceID()); + g_pCompositor->updateWorkspaceWindowData(workspaceID()); g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m_iMonitorID); g_pCompositor->updateAllWindowsAnimatedDecorationValues(); @@ -941,7 +901,7 @@ void CWindow::destroyGroup() { g_pKeybindManager->m_bGroupsLocked = GROUPSLOCKEDPREV; g_pCompositor->updateWorkspaceWindows(workspaceID()); - g_pCompositor->updateWorkspaceSpecialRenderData(workspaceID()); + g_pCompositor->updateWorkspaceWindowData(workspaceID()); g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m_iMonitorID); g_pCompositor->updateAllWindowsAnimatedDecorationValues(); @@ -1159,48 +1119,43 @@ bool CWindow::opaque() { float CWindow::rounding() { static auto PROUNDING = CConfigValue("decoration:rounding"); - float rounding = m_sAdditionalConfigData.rounding.toUnderlying() == -1 ? *PROUNDING : m_sAdditionalConfigData.rounding.toUnderlying(); + float rounding = m_sWindowData.rounding.valueOr(*PROUNDING); - return m_sSpecialRenderData.rounding ? rounding : 0; + return m_sWindowData.noRounding.valueOrDefault() ? 0 : rounding; } -void CWindow::updateSpecialRenderData() { +void CWindow::updateWindowData() { const auto PWORKSPACE = m_pWorkspace; const auto WORKSPACERULE = PWORKSPACE ? g_pConfigManager->getWorkspaceRuleFor(PWORKSPACE) : SWorkspaceRule{}; - updateSpecialRenderData(WORKSPACERULE); + updateWindowData(WORKSPACERULE); } -void CWindow::updateSpecialRenderData(const SWorkspaceRule& workspaceRule) { +void CWindow::updateWindowData(const SWorkspaceRule& workspaceRule) { static auto PNOBORDERONFLOATING = CConfigValue("general:no_border_on_floating"); - bool border = true; - if (m_bIsFloating && *PNOBORDERONFLOATING == 1) - border = false; + if (*PNOBORDERONFLOATING) + m_sWindowData.noBorder = CWindowOverridableVar(m_bIsFloating, PRIORITY_LAYOUT); + else + m_sWindowData.noBorder.unset(PRIORITY_LAYOUT); - m_sSpecialRenderData.border = workspaceRule.border.value_or(border); - m_sSpecialRenderData.borderSize = workspaceRule.borderSize.value_or(-1); - m_sSpecialRenderData.decorate = workspaceRule.decorate.value_or(true); - m_sSpecialRenderData.rounding = workspaceRule.rounding.value_or(true); - m_sSpecialRenderData.shadow = workspaceRule.shadow.value_or(true); + m_sWindowData.borderSize.matchOptional(workspaceRule.borderSize, PRIORITY_WORKSPACE_RULE); + m_sWindowData.decorate.matchOptional(workspaceRule.decorate, PRIORITY_WORKSPACE_RULE); + m_sWindowData.noBorder.matchOptional(workspaceRule.noBorder, PRIORITY_WORKSPACE_RULE); + m_sWindowData.noRounding.matchOptional(workspaceRule.noRounding, PRIORITY_WORKSPACE_RULE); + m_sWindowData.noShadow.matchOptional(workspaceRule.noShadow, PRIORITY_WORKSPACE_RULE); } int CWindow::getRealBorderSize() { - if (!m_sSpecialRenderData.border || m_sAdditionalConfigData.forceNoBorder || (m_pWorkspace && m_bIsFullscreen && (m_pWorkspace->m_efFullscreenMode == FULLSCREEN_FULL))) + if (m_sWindowData.noBorder.valueOrDefault() || (m_pWorkspace && m_bIsFullscreen && (m_pWorkspace->m_efFullscreenMode == FULLSCREEN_FULL))) return 0; - if (m_sAdditionalConfigData.borderSize.toUnderlying() != -1) - return m_sAdditionalConfigData.borderSize.toUnderlying(); - - if (m_sSpecialRenderData.borderSize.toUnderlying() != -1) - return m_sSpecialRenderData.borderSize.toUnderlying(); - static auto PBORDERSIZE = CConfigValue("general:border_size"); - return *PBORDERSIZE; + return m_sWindowData.borderSize.valueOr(*PBORDERSIZE); } bool CWindow::canBeTorn() { - return (m_sAdditionalConfigData.forceTearing.toUnderlying() || m_bTearingHint); + return m_sWindowData.tearing.valueOr(m_bTearingHint); } bool CWindow::shouldSendFullscreenState() { @@ -1349,8 +1304,7 @@ void CWindow::activate(bool force) { m_bIsUrgent = true; - if (!force && - (!(*PFOCUSONACTIVATE || m_sAdditionalConfigData.focusOnActivate) || (m_eSuppressedEvents & SUPPRESS_ACTIVATE_FOCUSONLY) || (m_eSuppressedEvents & SUPPRESS_ACTIVATE))) + if (!force && (!m_sWindowData.focusOnActivate.valueOr(*PFOCUSONACTIVATE) || (m_eSuppressedEvents & SUPPRESS_ACTIVATE_FOCUSONLY) || (m_eSuppressedEvents & SUPPRESS_ACTIVATE))) return; if (m_bIsFloating) @@ -1526,9 +1480,6 @@ void CWindow::onX11Configure(CBox box) { m_bCreatedOverFullscreen = true; - if (!m_sAdditionalConfigData.windowDanceCompat) - g_pInputManager->refocus(); - g_pHyprRenderer->damageWindow(m_pSelf.lock()); } @@ -1597,3 +1548,12 @@ PHLWINDOW CWindow::getSwallower() { // if none are found (??) then just return the first one return candidates.at(0); } + +void CWindow::unsetWindowData(eOverridePriority priority) { + for (auto const& element : g_pConfigManager->mbWindowProperties) { + element.second(m_pSelf.lock())->unset(priority); + } + for (auto const& element : g_pConfigManager->miWindowProperties) { + element.second(m_pSelf.lock())->unset(priority); + } +} diff --git a/src/desktop/Window.hpp b/src/desktop/Window.hpp index 6bfdbc50..60189fac 100644 --- a/src/desktop/Window.hpp +++ b/src/desktop/Window.hpp @@ -59,13 +59,36 @@ enum eSuppressEvents { class IWindowTransformer; +struct SAlphaValue { + float m_fAlpha; + bool m_bOverride; + + float applyAlpha(float alpha) { + if (m_bOverride) + return m_fAlpha; + else + return m_fAlpha * alpha; + }; +}; + +enum eOverridePriority { + PRIORITY_LAYOUT, + PRIORITY_WORKSPACE_RULE, + PRIORITY_WINDOW_RULE, + PRIORITY_SET_PROP, +}; + template class CWindowOverridableVar { public: - CWindowOverridableVar(T const& val) { - value = val; + CWindowOverridableVar(T const& value, eOverridePriority priority) { + values[priority] = value; + } + CWindowOverridableVar(T const& value) { + defaultValue = value; } + CWindowOverridableVar() = default; ~CWindowOverridableVar() = default; CWindowOverridableVar& operator=(CWindowOverridableVar const& other) { @@ -73,112 +96,91 @@ class CWindowOverridableVar { if (this == &other) return *this; - // Check if the current object is locked - if (!locked) { - locked = other.locked; - value = other.value; + for (auto const& value : other.values) { + values[value.first] = value.second; } return *this; } - T operator=(T& other) { - if (locked) - return value; - value = other; - return other; + void unset(eOverridePriority priority) { + values.erase(priority); } - void forceSetIgnoreLocked(T const& val, bool lock = false) { - value = val; - locked = lock; + bool hasValue() { + 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; + T valueOr(T const& other) { + if (hasValue()) + return value(); + else + return other; } - bool operator==(T const& other) { - return other == value; + T valueOrDefault() { + return valueOr(defaultValue); } - bool operator>=(T const& other) { - return value >= other; + eOverridePriority getPriority() { + if (!values.empty()) + return std::prev(values.end())->first; + else + throw std::bad_optional_access(); } - bool operator<=(T const& other) { - return value <= other; + void matchOptional(std::optional const& optValue, eOverridePriority priority) { + if (optValue.has_value()) + values[priority] = optValue.value(); + else + unset(priority); } - bool operator>(T const& other) { - return value > other; - } - - bool operator<(T const& other) { - return value < other; - } - - explicit operator bool() { - return static_cast(value); - } - - T toUnderlying() { - return value; - } - - bool locked = false; - private: - T value; + std::map values; + T defaultValue; // used for toggling, so required for bool }; -struct SWindowSpecialRenderData { - CWindowOverridableVar alphaOverride = false; - CWindowOverridableVar alpha = 1.f; - CWindowOverridableVar alphaInactiveOverride = false; - CWindowOverridableVar alphaInactive = -1.f; // -1 means unset - CWindowOverridableVar alphaFullscreenOverride = false; - CWindowOverridableVar alphaFullscreen = -1.f; // -1 means unset +struct SWindowData { + CWindowOverridableVar alpha = SAlphaValue{1.f, false}; + CWindowOverridableVar alphaInactive = SAlphaValue{1.f, false}; + CWindowOverridableVar alphaFullscreen = SAlphaValue{1.f, false}; - CWindowOverridableVar activeBorderColor = CGradientValueData(); // empty color vector means unset - CWindowOverridableVar inactiveBorderColor = CGradientValueData(); // empty color vector means unset + CWindowOverridableVar allowsInput = false; + CWindowOverridableVar dimAround = false; + CWindowOverridableVar decorate = true; + CWindowOverridableVar focusOnActivate = false; + CWindowOverridableVar keepAspectRatio = false; + CWindowOverridableVar nearestNeighbor = false; + CWindowOverridableVar noAnim = false; + CWindowOverridableVar noBorder = false; + CWindowOverridableVar noBlur = false; + CWindowOverridableVar noDim = false; + CWindowOverridableVar noFocus = false; + CWindowOverridableVar noMaxSize = false; + CWindowOverridableVar noRounding = false; + CWindowOverridableVar noShadow = false; + CWindowOverridableVar opaque = false; + CWindowOverridableVar RGBX = false; + CWindowOverridableVar tearing = false; + CWindowOverridableVar xray = false; - // set by the layout - CWindowOverridableVar borderSize = -1; // -1 means unset - bool rounding = true; - bool border = true; - bool decorate = true; - bool shadow = true; -}; + CWindowOverridableVar rounding; + CWindowOverridableVar borderSize; -struct SWindowAdditionalConfigData { - std::string animationStyle = std::string(""); - CWindowOverridableVar rounding = -1; // -1 means no - CWindowOverridableVar forceNoBlur = false; - CWindowOverridableVar forceOpaque = false; - CWindowOverridableVar forceOpaqueOverridden = false; // if true, a rule will not change the forceOpaque state. This is for the force opaque dispatcher. - CWindowOverridableVar forceAllowsInput = false; - CWindowOverridableVar forceNoAnims = false; - CWindowOverridableVar forceNoBorder = false; - CWindowOverridableVar forceNoShadow = false; - CWindowOverridableVar forceNoDim = false; - CWindowOverridableVar noFocus = false; - CWindowOverridableVar windowDanceCompat = false; - CWindowOverridableVar noMaxSize = false; - CWindowOverridableVar maxSize = Vector2D(std::numeric_limits::max(), std::numeric_limits::max()); - CWindowOverridableVar minSize = Vector2D(20, 20); - CWindowOverridableVar dimAround = false; - CWindowOverridableVar forceRGBX = false; - CWindowOverridableVar keepAspectRatio = false; - CWindowOverridableVar focusOnActivate = false; - CWindowOverridableVar xray = -1; // -1 means unset, takes precedence over the renderdata one - CWindowOverridableVar borderSize = -1; // -1 means unset, takes precedence over the renderdata one - CWindowOverridableVar forceTearing = false; - CWindowOverridableVar nearestNeighbor = false; + CWindowOverridableVar animationStyle; + CWindowOverridableVar maxSize; + CWindowOverridableVar minSize; + + CWindowOverridableVar activeBorderColor; + CWindowOverridableVar inactiveBorderColor; }; struct SWindowRule { @@ -331,8 +333,7 @@ class CWindow { std::vector m_vDecosToRemove; // Special render data, rules, etc - SWindowSpecialRenderData m_sSpecialRenderData; - SWindowAdditionalConfigData m_sAdditionalConfigData; + SWindowData m_sWindowData; // Transformers std::vector> m_vTransformers; @@ -423,8 +424,8 @@ class CWindow { int surfacesCount(); int getRealBorderSize(); - void updateSpecialRenderData(); - void updateSpecialRenderData(const struct SWorkspaceRule&); + void updateWindowData(); + void updateWindowData(const struct SWorkspaceRule&); void onBorderAngleAnimEnd(void* ptr); bool isInCurvedCorner(double x, double y); @@ -455,6 +456,7 @@ class CWindow { std::string fetchClass(); void warpCursor(); PHLWINDOW getSwallower(); + void unsetWindowData(eOverridePriority priority); // listeners void onAck(uint32_t serial); diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp index bb1197e5..1612deeb 100644 --- a/src/events/Windows.cpp +++ b/src/events/Windows.cpp @@ -196,8 +196,6 @@ void Events::listener_mapWindow(void* owner, void* data) { PWINDOW->m_bIsFloating = false; } else if (r.szRule.starts_with("pseudo")) { PWINDOW->m_bIsPseudotiled = true; - } else if (r.szRule.starts_with("nofocus")) { - PWINDOW->m_sAdditionalConfigData.noFocus = true; } else if (r.szRule.starts_with("noinitialfocus")) { PWINDOW->m_bNoInitialFocus = true; } else if (r.szRule.starts_with("suppressevent")) { @@ -219,12 +217,6 @@ void Events::listener_mapWindow(void* owner, void* data) { overridingNoFullscreen = true; } else if (r.szRule == "fakefullscreen") { requestsFakeFullscreen = true; - } else if (r.szRule == "windowdance") { - PWINDOW->m_sAdditionalConfigData.windowDanceCompat = true; - } else if (r.szRule == "nomaxsize") { - PWINDOW->m_sAdditionalConfigData.noMaxSize = true; - } else if (r.szRule == "forceinput") { - PWINDOW->m_sAdditionalConfigData.forceAllowsInput = true; } else if (r.szRule == "pin") { PWINDOW->m_bPinned = true; } else if (r.szRule == "maximize") { @@ -321,7 +313,7 @@ void Events::listener_mapWindow(void* owner, void* data) { workspaceSilent = false; } - PWINDOW->updateSpecialRenderData(); + PWINDOW->updateWindowData(); if (PWINDOW->m_bIsFloating) { g_pLayoutManager->getCurrentLayout()->onWindowCreatedFloating(PWINDOW); @@ -457,10 +449,10 @@ void Events::listener_mapWindow(void* owner, void* data) { const auto PFOCUSEDWINDOWPREV = g_pCompositor->m_pLastWindow.lock(); - if (PWINDOW->m_sAdditionalConfigData.forceAllowsInput) { - PWINDOW->m_sAdditionalConfigData.noFocus = false; - PWINDOW->m_bNoInitialFocus = false; - PWINDOW->m_bX11ShouldntFocus = false; + if (PWINDOW->m_sWindowData.allowsInput.valueOrDefault()) { // if default value wasn't set to false getPriority() would throw an exception + PWINDOW->m_sWindowData.noFocus = CWindowOverridableVar(false, PWINDOW->m_sWindowData.allowsInput.getPriority()); + PWINDOW->m_bNoInitialFocus = false; + PWINDOW->m_bX11ShouldntFocus = false; } // check LS focus grab @@ -479,12 +471,12 @@ void Events::listener_mapWindow(void* owner, void* data) { requestsFullscreen = true; } - if (!PWINDOW->m_sAdditionalConfigData.noFocus && !PWINDOW->m_bNoInitialFocus && + if (!PWINDOW->m_sWindowData.noFocus.valueOrDefault() && !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_sAdditionalConfigData.forceNoDim ? 0.f : *PDIMSTRENGTH); + PWINDOW->m_fDimPercent.setValueAndWarp(PWINDOW->m_sWindowData.noDim.valueOrDefault() ? 0.f : *PDIMSTRENGTH); } else { PWINDOW->m_fActiveInactiveAlpha.setValueAndWarp(*PINACTIVEALPHA); PWINDOW->m_fDimPercent.setValueAndWarp(0); diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp index cbeaa420..d1b4b7ca 100644 --- a/src/layout/DwindleLayout.cpp +++ b/src/layout/DwindleLayout.cpp @@ -139,7 +139,7 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for if (PWINDOW->m_bIsFullscreen && !pNode->ignoreFullscreenChecks) return; - PWINDOW->updateSpecialRenderData(); + PWINDOW->unsetWindowData(PRIORITY_LAYOUT); static auto PNOGAPSWHENONLY = CConfigValue("dwindle:no_gaps_when_only"); static auto PGAPSINDATA = CConfigValue("general:gaps_in"); @@ -160,10 +160,10 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for if (*PNOGAPSWHENONLY && !PWINDOW->onSpecialWorkspace() && (NODESONWORKSPACE == 1 || (PWINDOW->m_bIsFullscreen && PWINDOW->m_pWorkspace->m_efFullscreenMode == FULLSCREEN_MAXIMIZED))) { - PWINDOW->m_sSpecialRenderData.border = WORKSPACERULE.border.value_or(*PNOGAPSWHENONLY == 2); - PWINDOW->m_sSpecialRenderData.decorate = WORKSPACERULE.decorate.value_or(true); - PWINDOW->m_sSpecialRenderData.rounding = false; - PWINDOW->m_sSpecialRenderData.shadow = false; + PWINDOW->m_sWindowData.decorate = CWindowOverridableVar(true, PRIORITY_LAYOUT); + PWINDOW->m_sWindowData.noBorder = CWindowOverridableVar(*PNOGAPSWHENONLY != 2, PRIORITY_LAYOUT); + PWINDOW->m_sWindowData.noRounding = CWindowOverridableVar(true, PRIORITY_LAYOUT); + PWINDOW->m_sWindowData.noShadow = CWindowOverridableVar(true, PRIORITY_LAYOUT); PWINDOW->updateWindowDecos(); @@ -496,7 +496,7 @@ void CHyprDwindleLayout::onWindowRemovedTiling(PHLWINDOW pWindow) { return; } - pWindow->updateSpecialRenderData(); + pWindow->unsetWindowData(PRIORITY_LAYOUT); if (pWindow->m_bIsFullscreen) g_pCompositor->setWindowFullscreen(pWindow, false, FULLSCREEN_FULL); @@ -830,7 +830,7 @@ void CHyprDwindleLayout::fullscreenRequestForWindow(PHLWINDOW pWindow, eFullscre pWindow->m_vRealPosition = pWindow->m_vLastFloatingPosition; pWindow->m_vRealSize = pWindow->m_vLastFloatingSize; - pWindow->updateSpecialRenderData(); + pWindow->unsetWindowData(PRIORITY_LAYOUT); } } else { // if it now got fullscreen, make it fullscreen diff --git a/src/layout/IHyprLayout.cpp b/src/layout/IHyprLayout.cpp index c6a7a66c..56d22d4b 100644 --- a/src/layout/IHyprLayout.cpp +++ b/src/layout/IHyprLayout.cpp @@ -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_sAdditionalConfigData.minSize.toUnderlying()); - Vector2D MAXSIZE = g_pXWaylandManager->getMaxSizeForWindow(DRAGGINGWINDOW).clamp({}, DRAGGINGWINDOW->m_sAdditionalConfigData.maxSize.toUnderlying()); + Vector2D MINSIZE = g_pXWaylandManager->getMinSizeForWindow(DRAGGINGWINDOW).clamp(DRAGGINGWINDOW->m_sWindowData.minSize.valueOr(Vector2D(20, 20))); + Vector2D MAXSIZE; + if (DRAGGINGWINDOW->m_sWindowData.maxSize.hasValue()) + MAXSIZE = g_pXWaylandManager->getMaxSizeForWindow(DRAGGINGWINDOW).clamp({}, DRAGGINGWINDOW->m_sWindowData.maxSize.value()); + else + MAXSIZE = g_pXWaylandManager->getMaxSizeForWindow(DRAGGINGWINDOW).clamp({}, Vector2D(std::numeric_limits::max(), std::numeric_limits::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_sAdditionalConfigData.keepAspectRatio))) { + (!(g_pInputManager->dragMode == MBIND_RESIZE_BLOCK_RATIO) && DRAGGINGWINDOW->m_sWindowData.keepAspectRatio.valueOrDefault()))) { const float RATIO = m_vBeginDragSizeXY.y / m_vBeginDragSizeXY.x; @@ -538,7 +542,7 @@ void IHyprLayout::changeWindowFloatingMode(PHLWINDOW pWindow) { g_pHyprRenderer->damageMonitor(g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID)); - pWindow->updateSpecialRenderData(); + pWindow->unsetWindowData(PRIORITY_LAYOUT); if (pWindow == m_pLastTiledWindow) m_pLastTiledWindow.reset(); @@ -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_sAdditionalConfigData.noFocus && w != pWindow) { + !w->m_sWindowData.noFocus.valueOrDefault() && 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_sAdditionalConfigData.noFocus && w != pWindow) + !w->m_sWindowData.noFocus.valueOrDefault() && w != pWindow) return w; } diff --git a/src/layout/MasterLayout.cpp b/src/layout/MasterLayout.cpp index 965c0ed7..b5f2fa9f 100644 --- a/src/layout/MasterLayout.cpp +++ b/src/layout/MasterLayout.cpp @@ -264,7 +264,7 @@ void CHyprMasterLayout::onWindowRemovedTiling(PHLWINDOW pWindow) { const auto MASTERSLEFT = getMastersOnWorkspace(WORKSPACEID); static auto SMALLSPLIT = CConfigValue("master:allow_small_split"); - pWindow->updateSpecialRenderData(); + pWindow->unsetWindowData(PRIORITY_LAYOUT); g_pCompositor->setWindowFullscreen(pWindow, false, FULLSCREEN_FULL); @@ -646,7 +646,7 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) { if (PWINDOW->m_bIsFullscreen && !pNode->ignoreFullscreenChecks) return; - PWINDOW->updateSpecialRenderData(); + PWINDOW->unsetWindowData(PRIORITY_LAYOUT); static auto PNOGAPSWHENONLY = CConfigValue("master:no_gaps_when_only"); static auto PANIMATE = CConfigValue("misc:animate_manual_resizes"); @@ -669,10 +669,10 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) { if (*PNOGAPSWHENONLY && !PWINDOW->onSpecialWorkspace() && (getNodesOnWorkspace(PWINDOW->workspaceID()) == 1 || (PWINDOW->m_bIsFullscreen && PWINDOW->m_pWorkspace->m_efFullscreenMode == FULLSCREEN_MAXIMIZED))) { - PWINDOW->m_sSpecialRenderData.border = WORKSPACERULE.border.value_or(*PNOGAPSWHENONLY == 2); - PWINDOW->m_sSpecialRenderData.decorate = WORKSPACERULE.decorate.value_or(true); - PWINDOW->m_sSpecialRenderData.rounding = false; - PWINDOW->m_sSpecialRenderData.shadow = false; + PWINDOW->m_sWindowData.decorate = CWindowOverridableVar(true, PRIORITY_LAYOUT); + PWINDOW->m_sWindowData.noBorder = CWindowOverridableVar(*PNOGAPSWHENONLY != 2, PRIORITY_LAYOUT); + PWINDOW->m_sWindowData.noRounding = CWindowOverridableVar(true, PRIORITY_LAYOUT); + PWINDOW->m_sWindowData.noShadow = CWindowOverridableVar(true, PRIORITY_LAYOUT); PWINDOW->updateWindowDecos(); @@ -922,7 +922,7 @@ void CHyprMasterLayout::fullscreenRequestForWindow(PHLWINDOW pWindow, eFullscree pWindow->m_vRealPosition = pWindow->m_vLastFloatingPosition; pWindow->m_vRealSize = pWindow->m_vLastFloatingSize; - pWindow->updateSpecialRenderData(); + pWindow->unsetWindowData(PRIORITY_LAYOUT); } } else { // if it now got fullscreen, make it fullscreen diff --git a/src/managers/AnimationManager.cpp b/src/managers/AnimationManager.cpp index 1fec375e..677b2109 100644 --- a/src/managers/AnimationManager.cpp +++ b/src/managers/AnimationManager.cpp @@ -102,7 +102,7 @@ void CAnimationManager::tick() { PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID); if (!PMONITOR) continue; - animationsDisabled = animationsDisabled || PWINDOW->m_sAdditionalConfigData.forceNoAnims; + animationsDisabled = PWINDOW->m_sWindowData.noAnim.valueOr(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_sAdditionalConfigData.animationStyle != "") { + if (pWindow->m_sWindowData.animationStyle.hasValue()) { + const auto STYLE = pWindow->m_sWindowData.animationStyle.value(); // the window has config'd special anim - if (pWindow->m_sAdditionalConfigData.animationStyle.starts_with("slide")) { - CVarList animList2(pWindow->m_sAdditionalConfigData.animationStyle, 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_sAdditionalConfigData.animationStyle.find("%") != std::string::npos) { + if (STYLE.find("%") != std::string::npos) { try { - auto percstr = pWindow->m_sAdditionalConfigData.animationStyle.substr(pWindow->m_sAdditionalConfigData.animationStyle.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 diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index cfc77c10..eb8a3232 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -252,7 +252,7 @@ bool CKeybindManager::ensureMouseBindState() { g_pInputManager->dragMode = MBIND_INVALID; g_pCompositor->updateWorkspaceWindows(lastDraggedWindow->workspaceID()); - g_pCompositor->updateWorkspaceSpecialRenderData(lastDraggedWindow->workspaceID()); + g_pCompositor->updateWorkspaceWindowData(lastDraggedWindow->workspaceID()); g_pLayoutManager->getCurrentLayout()->recalculateMonitor(lastDraggedWindow->m_iMonitorID); g_pCompositor->updateAllWindowsAnimatedDecorationValues(); @@ -974,7 +974,7 @@ static void toggleActiveFloatingCore(std::string args, std::optional float g_pLayoutManager->getCurrentLayout()->changeWindowFloatingMode(PWINDOW); } g_pCompositor->updateWorkspaceWindows(PWINDOW->workspaceID()); - g_pCompositor->updateWorkspaceSpecialRenderData(PWINDOW->workspaceID()); + g_pCompositor->updateWorkspaceWindowData(PWINDOW->workspaceID()); g_pLayoutManager->getCurrentLayout()->recalculateMonitor(PWINDOW->m_iMonitorID); g_pCompositor->updateAllWindowsAnimatedDecorationValues(); } @@ -2239,8 +2239,7 @@ void CKeybindManager::toggleOpaque(std::string unused) { if (!PWINDOW) return; - PWINDOW->m_sAdditionalConfigData.forceOpaque = !PWINDOW->m_sAdditionalConfigData.forceOpaque; - PWINDOW->m_sAdditionalConfigData.forceOpaqueOverridden = true; + PWINDOW->m_sWindowData.opaque = CWindowOverridableVar(!PWINDOW->m_sWindowData.opaque.valueOrDefault(), PRIORITY_SET_PROP); g_pHyprRenderer->damageWindow(PWINDOW); } diff --git a/src/managers/XWaylandManager.cpp b/src/managers/XWaylandManager.cpp index 12387900..e702a172 100644 --- a/src/managers/XWaylandManager.cpp +++ b/src/managers/XWaylandManager.cpp @@ -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_sAdditionalConfigData.noMaxSize) + if ((pWindow->m_bIsX11 && !pWindow->m_pXWaylandSurface->sizeHints) || (!pWindow->m_bIsX11 && !pWindow->m_pXDGSurface->toplevel) || + pWindow->m_sWindowData.noMaxSize.valueOrDefault()) return Vector2D(99999, 99999); auto MAXSIZE = pWindow->m_bIsX11 ? Vector2D(pWindow->m_pXWaylandSurface->sizeHints->max_width, pWindow->m_pXWaylandSurface->sizeHints->max_height) : diff --git a/src/protocols/SessionLock.cpp b/src/protocols/SessionLock.cpp index e7abc7cb..42df5fd6 100644 --- a/src/protocols/SessionLock.cpp +++ b/src/protocols/SessionLock.cpp @@ -177,7 +177,7 @@ void CSessionLockProtocol::onLock(CExtSessionLockManagerV1* pMgr, uint32_t id) { return; } - if (m_vLocks.size() > 1) { + if (locked) { LOGM(ERR, "Tried to lock a locked session"); RESOURCE->inert = true; RESOURCE->resource->sendFinished(); diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index 3178ab8c..2b603868 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -434,7 +434,7 @@ bool CHyprOpenGLImpl::passRequiresIntrospection(CMonitor* pMonitor) { if (!w->m_bIsFloating && *POPTIM && !w->onSpecialWorkspace()) continue; - if (w->m_sAdditionalConfigData.forceNoBlur.toUnderlying() == true || w->m_sAdditionalConfigData.xray.toUnderlying() == true) + if (w->m_sWindowData.noBlur.valueOrDefault() || w->m_sWindowData.xray.valueOrDefault() == true) continue; if (w->opaque()) @@ -1130,7 +1130,7 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(SP tex, CBox* pB } } - if (m_pCurrentWindow.lock() && m_pCurrentWindow->m_sAdditionalConfigData.forceRGBX) + if (m_pCurrentWindow.lock() && m_pCurrentWindow->m_sWindowData.RGBX.valueOrDefault()) 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_sAdditionalConfigData.forceNoBlur) + if (pWindow->m_sWindowData.noBlur.valueOrDefault()) 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_sAdditionalConfigData.xray.toUnderlying() == 0) + if (pWindow && !pWindow->m_sWindowData.xray.valueOrDefault()) 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_sAdditionalConfigData.xray.toUnderlying() == 1)) + if ((pLayer && pLayer->xray == 1) || (pWindow && pWindow->m_sWindowData.xray.valueOrDefault())) return true; return false; @@ -1750,7 +1750,7 @@ void CHyprOpenGLImpl::renderTextureWithBlur(SP 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_sAdditionalConfigData.forceNoBlur || m_pCurrentWindow->m_sAdditionalConfigData.forceRGBX))) { + (m_pCurrentWindow.lock() && (m_pCurrentWindow->m_sWindowData.noBlur.valueOrDefault() || m_pCurrentWindow->m_sWindowData.RGBX.valueOrDefault()))) { 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_sAdditionalConfigData.forceNoBorder)) + if (m_RenderData.damage.empty() || (m_pCurrentWindow.lock() && m_pCurrentWindow->m_sWindowData.noBorder.valueOrDefault())) 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_sAdditionalConfigData.dimAround) { + if (*PDIMAROUND && pWindow->m_sWindowData.dimAround.valueOrDefault()) { 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); diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 8d98a182..955a16b9 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -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_sSpecialRenderData.rounding); + renderdata.dontRound = (pWindow->m_bIsFullscreen && PWORKSPACE->m_efFullscreenMode == FULLSCREEN_FULL) || pWindow->m_sWindowData.noRounding.valueOrDefault(); 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_sAdditionalConfigData.forceOpaque) + if (pWindow->m_sWindowData.opaque.valueOrDefault()) renderdata.alpha = 1.f; g_pHyprOpenGL->m_pCurrentWindow = pWindow; EMIT_HOOK_EVENT("render", RENDER_PRE_WINDOW); - if (*PDIMAROUND && pWindow->m_sAdditionalConfigData.dimAround && !m_bRenderingSnapshot && mode != RENDER_PASS_POPUP) { + if (*PDIMAROUND && pWindow->m_sWindowData.dimAround.valueOrDefault() && !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("xwayland:use_nearest_neighbor"); - if ((pWindow->m_bIsX11 && *PXWLUSENN) || pWindow->m_sAdditionalConfigData.nearestNeighbor.toUnderlying()) + if ((pWindow->m_bIsX11 && *PXWLUSENN) || pWindow->m_sWindowData.nearestNeighbor.valueOrDefault()) g_pHyprOpenGL->m_RenderData.useNearestNeighbor = true; - if (!pWindow->m_sAdditionalConfigData.forceNoBlur && pWindow->m_pWLSurface->small() && !pWindow->m_pWLSurface->m_bFillIgnoreSmall && renderdata.blur && *PBLUR) { + if (!pWindow->m_sWindowData.noBlur.valueOrDefault() && 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_sAdditionalConfigData.nearestNeighbor.toUnderlying()) + if (pWindow->m_sWindowData.nearestNeighbor.valueOrDefault()) g_pHyprOpenGL->m_RenderData.useNearestNeighbor = true; renderdata.surfaceCounter = 0; diff --git a/src/render/decorations/CHyprBorderDecoration.cpp b/src/render/decorations/CHyprBorderDecoration.cpp index 7d9a0401..708215b6 100644 --- a/src/render/decorations/CHyprBorderDecoration.cpp +++ b/src/render/decorations/CHyprBorderDecoration.cpp @@ -133,5 +133,5 @@ std::string CHyprBorderDecoration::getDisplayName() { } bool CHyprBorderDecoration::doesntWantBorders() { - return !m_pWindow->m_sSpecialRenderData.border || m_pWindow->m_bX11DoesntWantBorders || m_pWindow->getRealBorderSize() == 0; + return m_pWindow->m_sWindowData.noBorder.valueOrDefault() || m_pWindow->m_bX11DoesntWantBorders || m_pWindow->getRealBorderSize() == 0; } diff --git a/src/render/decorations/CHyprDropShadowDecoration.cpp b/src/render/decorations/CHyprDropShadowDecoration.cpp index 6893d78c..423256d7 100644 --- a/src/render/decorations/CHyprDropShadowDecoration.cpp +++ b/src/render/decorations/CHyprDropShadowDecoration.cpp @@ -96,13 +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_sSpecialRenderData.decorate) + if (!PWINDOW->m_sWindowData.decorate.valueOrDefault()) return; - if (!PWINDOW->m_sSpecialRenderData.shadow) - return; - - if (PWINDOW->m_sAdditionalConfigData.forceNoShadow) + if (PWINDOW->m_sWindowData.noShadow.valueOrDefault()) return; static auto PSHADOWS = CConfigValue("decoration:drop_shadow"); diff --git a/src/render/decorations/CHyprGroupBarDecoration.cpp b/src/render/decorations/CHyprGroupBarDecoration.cpp index e461ba08..a13750d0 100644 --- a/src/render/decorations/CHyprGroupBarDecoration.cpp +++ b/src/render/decorations/CHyprGroupBarDecoration.cpp @@ -42,7 +42,7 @@ SDecorationPositioningInfo CHyprGroupBarDecoration::getPositioningInfo() { info.priority = *PPRIORITY; info.reserved = true; - if (*PENABLED && m_pWindow->m_sSpecialRenderData.decorate) { + if (*PENABLED && m_pWindow->m_sWindowData.decorate.valueOrDefault()) { 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("group:groupbar:gradients"); static auto PSTACKED = CConfigValue("group:groupbar:stacked"); - if (!*PENABLED || !m_pWindow->m_sSpecialRenderData.decorate) + if (!*PENABLED || !m_pWindow->m_sWindowData.decorate.valueOrDefault()) return; const auto ASSIGNEDBOX = assignedBoxGlobal();