modified:   src/Compositor.cpp
modified:   src/Compositor.hpp
modified:   src/config/ConfigManager.cpp
modified:   src/config/ConfigManager.hpp
modified:   src/debug/HyprCtl.cpp
modified:   src/desktop/Window.cpp
modified:   src/desktop/Window.hpp
modified:   src/events/Windows.cpp
modified:   src/layout/DwindleLayout.cpp
modified:   src/layout/IHyprLayout.cpp
modified:   src/layout/IHyprLayout.hpp
modified:   src/layout/MasterLayout.cpp
modified:   src/managers/KeybindManager.cpp
This commit is contained in:
MightyPlaza 2024-07-04 22:06:15 +01:00
parent 5a492856ee
commit 57cb8730e4
No known key found for this signature in database
GPG key ID: 284C27FD27A6DC0D
13 changed files with 120 additions and 111 deletions

View file

@ -2259,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{};
@ -2267,7 +2267,7 @@ void CCompositor::updateWorkspaceSpecialRenderData(const int& id) {
if (w->workspaceID() != id)
continue;
w->updateSpecialRenderData(WORKSPACERULE);
w->updateWindowData(WORKSPACERULE);
}
}

View file

@ -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<bool> onlyTiled = {}, std::optional<bool> onlyVisible = {});
int getGroupsOnWorkspace(const int& id, std::optional<bool> onlyTiled = {}, std::optional<bool> onlyVisible = {});
PHLWINDOW getUrgentWindow();

View file

@ -839,7 +839,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
@ -1053,14 +1053,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())
@ -2416,11 +2416,11 @@ std::optional<std::string> 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)

View file

@ -39,10 +39,10 @@ struct SWorkspaceRule {
std::optional<CCssGapData> gapsIn;
std::optional<CCssGapData> gapsOut;
std::optional<int64_t> borderSize;
std::optional<int> border;
std::optional<int> rounding;
std::optional<int> decorate;
std::optional<int> shadow;
std::optional<bool> decorate;
std::optional<bool> noRounding;
std::optional<bool> noBorder;
std::optional<bool> noShadow;
std::optional<std::string> onCreatedEmptyRunCmd;
std::optional<std::string> defaultName;
std::map<std::string, std::string> layoutopts;
@ -148,25 +148,47 @@ class CConfigManager {
std::string getErrors();
// keywords
std::optional<std::string> handleRawExec(const std::string&, const std::string&);
std::optional<std::string> handleExecOnce(const std::string&, const std::string&);
std::optional<std::string> handleMonitor(const std::string&, const std::string&);
std::optional<std::string> handleBind(const std::string&, const std::string&);
std::optional<std::string> handleUnbind(const std::string&, const std::string&);
std::optional<std::string> handleWindowRule(const std::string&, const std::string&);
std::optional<std::string> handleLayerRule(const std::string&, const std::string&);
std::optional<std::string> handleWindowRuleV2(const std::string&, const std::string&);
std::optional<std::string> handleWorkspaceRules(const std::string&, const std::string&);
std::optional<std::string> handleBezier(const std::string&, const std::string&);
std::optional<std::string> handleAnimation(const std::string&, const std::string&);
std::optional<std::string> handleSource(const std::string&, const std::string&);
std::optional<std::string> handleSubmap(const std::string&, const std::string&);
std::optional<std::string> handleBlurLS(const std::string&, const std::string&);
std::optional<std::string> handleBindWS(const std::string&, const std::string&);
std::optional<std::string> handleEnv(const std::string&, const std::string&);
std::optional<std::string> handlePlugin(const std::string&, const std::string&);
std::optional<std::string> handleRawExec(const std::string&, const std::string&);
std::optional<std::string> handleExecOnce(const std::string&, const std::string&);
std::optional<std::string> handleMonitor(const std::string&, const std::string&);
std::optional<std::string> handleBind(const std::string&, const std::string&);
std::optional<std::string> handleUnbind(const std::string&, const std::string&);
std::optional<std::string> handleWindowRule(const std::string&, const std::string&);
std::optional<std::string> handleLayerRule(const std::string&, const std::string&);
std::optional<std::string> handleWindowRuleV2(const std::string&, const std::string&);
std::optional<std::string> handleWorkspaceRules(const std::string&, const std::string&);
std::optional<std::string> handleBezier(const std::string&, const std::string&);
std::optional<std::string> handleAnimation(const std::string&, const std::string&);
std::optional<std::string> handleSource(const std::string&, const std::string&);
std::optional<std::string> handleSubmap(const std::string&, const std::string&);
std::optional<std::string> handleBlurLS(const std::string&, const std::string&);
std::optional<std::string> handleBindWS(const std::string&, const std::string&);
std::optional<std::string> handleEnv(const std::string&, const std::string&);
std::optional<std::string> handlePlugin(const std::string&, const std::string&);
std::string configCurrentPath;
std::string configCurrentPath;
std::unordered_map<std::string, std::function<CWindowOverridableVar<bool>*(PHLWINDOW)>> mbWindowProperties = {
{"dimaround", [](const PHLWINDOW& pWindow) { return &pWindow->m_sWindowData.dimAround; }},
{"focusonactivate", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.focusOnActivate; }},
{"forceinput", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.allowsInput; }},
{"forceopaque", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.opaque; }},
{"forcergbx", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.RGBX; }},
{"immediate", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.tearing; }},
{"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; }},
{"noshadow", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noShadow; }},
{"windowdance", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.windowDanceCompat; }},
};
std::unordered_map<std::string, std::function<CWindowOverridableVar<int>*(PHLWINDOW)>> miWindowProperties = {
{"rounding", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.rounding; }}, {"bordersize", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.borderSize; }}};
private:
std::unique_ptr<Hyprlang::CConfig> m_pConfig;

View file

@ -311,10 +311,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 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 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.noShadow) ? std::format(",\n \"shadow\": {}", boolToString(!r.noShadow.value())) : "";
std::string result = std::format(R"#({{
"workspaceString": "{}"{}{}{}{}{}{}{}{}
@ -333,10 +333,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: <unset>\n");
const std::string borderSize = std::format("\tborderSize: {}\n", (bool)(r.borderSize) ? std::to_string(r.borderSize.value()) : "<unset>");
const std::string border = std::format("\tborder: {}\n", (bool)(r.border) ? boolToString(r.border.value()) : "<unset>");
const std::string rounding = std::format("\trounding: {}\n", (bool)(r.rounding) ? boolToString(r.rounding.value()) : "<unset>");
const std::string border = std::format("\tborder: {}\n", (bool)(r.noBorder) ? boolToString(!r.noBorder.value()) : "<unset>");
const std::string rounding = std::format("\trounding: {}\n", (bool)(r.noRounding) ? boolToString(!r.noRounding.value()) : "<unset>");
const std::string decorate = std::format("\tdecorate: {}\n", (bool)(r.decorate) ? boolToString(r.decorate.value()) : "<unset>");
const std::string shadow = std::format("\tshadow: {}\n", (bool)(r.shadow) ? boolToString(r.shadow.value()) : "<unset>");
const std::string shadow = std::format("\tshadow: {}\n", (bool)(r.noShadow) ? boolToString(!r.noShadow.value()) : "<unset>");
std::string result = std::format("Workspace rule {}:\n{}{}{}{}{}{}{}{}{}{}\n", escapeJSONStrings(r.workspaceString), monitor, default_, persistent, gapsIn, gapsOut,
borderSize, border, rounding, decorate, shadow);
@ -1248,10 +1248,10 @@ std::string dispatchSetProp(eHyprCtlOutputFormat format, std::string request) {
PWINDOW->m_sWindowData.activeBorderColor = CWindowOverridableVar(colorData, PRIORITY_SET_PROP);
else
PWINDOW->m_sWindowData.inactiveBorderColor = CWindowOverridableVar(colorData, PRIORITY_SET_PROP);
} else if (auto search = PWINDOW->mbWindowProperties.find(PROP); search != PWINDOW->mbWindowProperties.end()) {
*(search->second) = CWindowOverridableVar((bool)configStringToInt(VAL), PRIORITY_SET_PROP);
} else if (auto search = PWINDOW->miWindowProperties.find(PROP); search != PWINDOW->miWindowProperties.end()) {
*(search->second) = CWindowOverridableVar((int)configStringToInt(VAL), PRIORITY_SET_PROP);
} else if (auto search = g_pConfigManager->mbWindowProperties.find(PROP); search != g_pConfigManager->mbWindowProperties.end()) {
*(search->second(PWINDOW)) = CWindowOverridableVar((bool)configStringToInt(VAL), PRIORITY_SET_PROP);
} else if (auto search = g_pConfigManager->miWindowProperties.find(PROP); search != g_pConfigManager->miWindowProperties.end()) {
*(search->second(PWINDOW)) = CWindowOverridableVar((int)configStringToInt(VAL), PRIORITY_SET_PROP);
} else {
return "prop not found";
}

View file

@ -280,28 +280,6 @@ void CWindow::updateWindowDecos() {
}
}
void CWindow::createWindowProperties() {
mbWindowProperties["dimaround"] = &m_sWindowData.dimAround;
mbWindowProperties["focusonactivate"] = &m_sWindowData.focusOnActivate;
mbWindowProperties["forceinput"] = &m_sWindowData.allowsInput;
mbWindowProperties["forceopaque"] = &m_sWindowData.opaque;
mbWindowProperties["forcergbx"] = &m_sWindowData.RGBX;
mbWindowProperties["immediate"] = &m_sWindowData.tearing;
mbWindowProperties["keepaspectratio"] = &m_sWindowData.keepAspectRatio;
mbWindowProperties["nearestneighbor"] = &m_sWindowData.nearestNeighbor;
mbWindowProperties["noanim"] = &m_sWindowData.noAnim;
mbWindowProperties["noblur"] = &m_sWindowData.noBlur;
mbWindowProperties["noborder"] = &m_sWindowData.noBorder;
mbWindowProperties["nodim"] = &m_sWindowData.noDim;
mbWindowProperties["nofocus"] = &m_sWindowData.noFocus;
mbWindowProperties["nomaxsize"] = &m_sWindowData.noMaxSize;
mbWindowProperties["noshadow"] = &m_sWindowData.noShadow;
mbWindowProperties["windowdance"] = &m_sWindowData.windowDanceCompat;
miWindowProperties["rounding"] = &m_sWindowData.rounding;
miWindowProperties["bordersize"] = &m_sWindowData.borderSize;
}
void CWindow::addWindowDeco(std::unique_ptr<IHyprWindowDecoration> deco) {
m_dWindowDecorations.emplace_back(std::move(deco));
g_pDecorationPositioner->forceRecalcFor(m_pSelf.lock());
@ -433,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();
@ -546,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();
@ -724,11 +702,11 @@ void CWindow::applyDynamicRule(const SWindowRule& r) {
try {
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);
} else if (auto search = miWindowProperties.find(r.szRule.substr(0, r.szRule.find_first_of(' '))); search != miWindowProperties.end()) {
} else if (auto search = g_pConfigManager->mbWindowProperties.find(r.szRule); search != g_pConfigManager->mbWindowProperties.end()) {
*(search->second(m_pSelf.lock())) = CWindowOverridableVar(true, PRIORITY_WINDOW_RULE);
} else if (auto search = g_pConfigManager->miWindowProperties.find(r.szRule.substr(0, r.szRule.find_first_of(' '))); search != g_pConfigManager->miWindowProperties.end()) {
try {
*(search->second) = CWindowOverridableVar(std::stoi(r.szRule.substr(r.szRule.find_first_of(' ') + 1)), PRIORITY_WINDOW_RULE);
*(search->second(m_pSelf.lock())) = CWindowOverridableVar(std::stoi(r.szRule.substr(r.szRule.find_first_of(' ') + 1)), PRIORITY_WINDOW_RULE);
} 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);
@ -884,7 +862,7 @@ void CWindow::createGroup() {
addWindowDeco(std::make_unique<CHyprGroupBarDecoration>(m_pSelf.lock()));
g_pCompositor->updateWorkspaceWindows(workspaceID());
g_pCompositor->updateWorkspaceSpecialRenderData(workspaceID());
g_pCompositor->updateWorkspaceWindowData(workspaceID());
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m_iMonitorID);
g_pCompositor->updateAllWindowsAnimatedDecorationValues();
@ -902,7 +880,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();
@ -938,7 +916,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();
@ -1161,27 +1139,25 @@ float CWindow::rounding() {
return m_sWindowData.noRounding.value_or(false) ? 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<Hyprlang::INT>("general:no_border_on_floating");
m_sWindowData.noBorder = CWindowOverridableVar(*PNOBORDERONFLOATING && m_bIsFloating, PRIORITY_LAYOUT);
if (*PNOBORDERONFLOATING)
m_sWindowData.noBorder = CWindowOverridableVar(m_bIsFloating, PRIORITY_LAYOUT);
else
m_sWindowData.noBorder.unset(PRIORITY_LAYOUT);
if (workspaceRule.borderSize.has_value())
m_sWindowData.borderSize = CWindowOverridableVar((int)workspaceRule.borderSize.value(), PRIORITY_WORKSPACE_RULE);
if (workspaceRule.decorate.has_value())
m_sWindowData.decorate = CWindowOverridableVar((bool)workspaceRule.decorate.value(), PRIORITY_WORKSPACE_RULE);
if (workspaceRule.border.has_value())
m_sWindowData.noBorder = CWindowOverridableVar(!workspaceRule.border.value(), PRIORITY_WORKSPACE_RULE);
if (workspaceRule.rounding.has_value())
m_sWindowData.noRounding = CWindowOverridableVar(!workspaceRule.rounding.value(), PRIORITY_WORKSPACE_RULE);
if (workspaceRule.shadow.has_value())
m_sWindowData.noShadow = CWindowOverridableVar(!workspaceRule.shadow.value(), PRIORITY_WORKSPACE_RULE);
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() {

View file

@ -129,6 +129,13 @@ class CWindowOverridableVar {
throw std::bad_optional_access();
}
void matchOptional(std::optional<T> const& optValue, eOverridePriority priority) {
if (optValue.has_value())
values[priority] = optValue.value();
else
unset(priority);
}
private:
std::map<eOverridePriority, T> values;
};
@ -319,10 +326,7 @@ class CWindow {
std::vector<IHyprWindowDecoration*> m_vDecosToRemove;
// Special render data, rules, etc
SWindowData m_sWindowData;
std::unordered_map<std::string, CWindowOverridableVar<bool>*> mbWindowProperties;
std::unordered_map<std::string, CWindowOverridableVar<int>*> miWindowProperties;
SWindowData m_sWindowData;
// Transformers
std::vector<std::unique_ptr<IWindowTransformer>> m_vTransformers;
@ -397,7 +401,6 @@ class CWindow {
void onMap();
void setHidden(bool hidden);
bool isHidden();
void createWindowProperties();
void applyDynamicRule(const SWindowRule& r);
void updateDynamicRules();
SBoxExtents getFullWindowReservedArea();
@ -414,8 +417,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);

View file

@ -139,8 +139,6 @@ void Events::listener_mapWindow(void* owner, void* data) {
bool overridingNoFullscreen = false;
bool overridingNoMaximize = false;
PWINDOW->createWindowProperties();
for (auto& r : PWINDOW->m_vMatchedRules) {
if (r.szRule.starts_with("monitor")) {
try {
@ -316,7 +314,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
workspaceSilent = false;
}
PWINDOW->updateSpecialRenderData();
g_pLayoutManager->getCurrentLayout()->unsetLayoutWindowData(PWINDOW);
if (PWINDOW->m_bIsFloating) {
g_pLayoutManager->getCurrentLayout()->onWindowCreatedFloating(PWINDOW);

View file

@ -139,7 +139,7 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for
if (PWINDOW->m_bIsFullscreen && !pNode->ignoreFullscreenChecks)
return;
PWINDOW->updateSpecialRenderData();
unsetLayoutWindowData(PWINDOW);
static auto PNOGAPSWHENONLY = CConfigValue<Hyprlang::INT>("dwindle:no_gaps_when_only");
static auto PGAPSINDATA = CConfigValue<Hyprlang::CUSTOMTYPE>("general:gaps_in");
@ -496,7 +496,7 @@ void CHyprDwindleLayout::onWindowRemovedTiling(PHLWINDOW pWindow) {
return;
}
pWindow->updateSpecialRenderData();
unsetLayoutWindowData(pWindow);
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();
unsetLayoutWindowData(pWindow);
}
} else {
// if it now got fullscreen, make it fullscreen

View file

@ -542,7 +542,7 @@ void IHyprLayout::changeWindowFloatingMode(PHLWINDOW pWindow) {
g_pHyprRenderer->damageMonitor(g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID));
pWindow->updateSpecialRenderData();
g_pLayoutManager->getCurrentLayout()->unsetLayoutWindowData(pWindow);
if (pWindow == m_pLastTiledWindow)
m_pLastTiledWindow.reset();
@ -712,4 +712,12 @@ Vector2D IHyprLayout::predictSizeForNewWindow(PHLWINDOW pWindow) {
return sizePredicted;
}
void IHyprLayout::unsetLayoutWindowData(PHLWINDOW pWindow) {
// not finished
pWindow->m_sWindowData.decorate.unset(PRIORITY_LAYOUT);
pWindow->m_sWindowData.noBorder.unset(PRIORITY_LAYOUT);
pWindow->m_sWindowData.noRounding.unset(PRIORITY_LAYOUT);
pWindow->m_sWindowData.noShadow.unset(PRIORITY_LAYOUT);
}
IHyprLayout::~IHyprLayout() {}

View file

@ -195,6 +195,8 @@ class IHyprLayout {
virtual Vector2D predictSizeForNewWindow(PHLWINDOW pWindow);
virtual Vector2D predictSizeForNewWindowFloating(PHLWINDOW pWindow);
virtual void unsetLayoutWindowData(PHLWINDOW);
private:
int m_iMouseMoveEventCount;
Vector2D m_vBeginDragXY;

View file

@ -264,7 +264,7 @@ void CHyprMasterLayout::onWindowRemovedTiling(PHLWINDOW pWindow) {
const auto MASTERSLEFT = getMastersOnWorkspace(WORKSPACEID);
static auto SMALLSPLIT = CConfigValue<Hyprlang::INT>("master:allow_small_split");
pWindow->updateSpecialRenderData();
unsetLayoutWindowData(pWindow);
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();
unsetLayoutWindowData(PWINDOW);
static auto PNOGAPSWHENONLY = CConfigValue<Hyprlang::INT>("master:no_gaps_when_only");
static auto PANIMATE = CConfigValue<Hyprlang::INT>("misc:animate_manual_resizes");
@ -922,7 +922,7 @@ void CHyprMasterLayout::fullscreenRequestForWindow(PHLWINDOW pWindow, eFullscree
pWindow->m_vRealPosition = pWindow->m_vLastFloatingPosition;
pWindow->m_vRealSize = pWindow->m_vLastFloatingSize;
pWindow->updateSpecialRenderData();
unsetLayoutWindowData(pWindow);
}
} else {
// if it now got fullscreen, make it fullscreen

View file

@ -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<bool> 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();
}