diff --git a/src/Compositor.cpp b/src/Compositor.cpp index bb1f4f92e..f39ae640c 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -2498,7 +2498,7 @@ void CCompositor::arrangeMonitors() { for (auto it = toArrange.begin(); it != toArrange.end();) { auto m = *it; - if (m->activeMonitorRule.offset.x >= 0 && m->activeMonitorRule.offset.y >= 0) { + if (m->activeMonitorRule.offset != Vector2D{-INT32_MAX, -INT32_MAX}) { // explicit. m->moveTo(m->activeMonitorRule.offset); arranged.push_back(m); diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 6f2558bb8..d3e69694d 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -626,15 +626,10 @@ void CConfigManager::handleMonitor(const std::string& command, const std::string } if (ARGS[2].find("auto") == 0) { - newrule.offset = Vector2D(-1, -1); + newrule.offset = Vector2D(-INT32_MAX, -INT32_MAX); } else { newrule.offset.x = stoi(ARGS[2].substr(0, ARGS[2].find_first_of('x'))); newrule.offset.y = stoi(ARGS[2].substr(ARGS[2].find_first_of('x') + 1)); - - if (newrule.offset.x < 0 || newrule.offset.y < 0) { - parseError = "invalid offset. Offset cannot be negative."; - newrule.offset = Vector2D(); - } } if (ARGS[3].find("auto") == 0) { @@ -1145,7 +1140,7 @@ void CConfigManager::handleWorkspaceRules(const std::string& command, const std: else if ((delim = rule.find("border:")) != std::string::npos) wsRule.border = configStringToInt(rule.substr(delim + 7)); else if ((delim = rule.find("shadow:")) != std::string::npos) - wsRule.shadow= configStringToInt(rule.substr(delim + 7)); + wsRule.shadow = configStringToInt(rule.substr(delim + 7)); else if ((delim = rule.find("rounding:")) != std::string::npos) wsRule.rounding = configStringToInt(rule.substr(delim + 9)); else if ((delim = rule.find("decorate:")) != std::string::npos) @@ -1780,7 +1775,7 @@ SMonitorRule CConfigManager::getMonitorRuleFor(const std::string& name, const st Debug::log(WARN, "No rules configured. Using the default hardcoded one."); - return SMonitorRule{.name = "", .resolution = Vector2D(0, 0), .offset = Vector2D(-1, -1), .scale = -1}; // 0, 0 is preferred and -1, -1 is auto + return SMonitorRule{.name = "", .resolution = Vector2D(0, 0), .offset = Vector2D(-INT32_MAX, -INT32_MAX), .scale = -1}; // 0, 0 is preferred and -1, -1 is auto } SWorkspaceRule CConfigManager::getWorkspaceRuleFor(CWorkspace* pWorkspace) { diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index c6f15e1cb..a223c1cea 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -1593,7 +1593,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR if (!force && DELTALESSTHAN(pMonitor->vecPixelSize.x, pMonitorRule->resolution.x, 1) && DELTALESSTHAN(pMonitor->vecPixelSize.y, pMonitorRule->resolution.y, 1) && DELTALESSTHAN(pMonitor->refreshRate, pMonitorRule->refreshRate, 1) && pMonitor->scale == pMonitorRule->scale && ((DELTALESSTHAN(pMonitor->vecPosition.x, pMonitorRule->offset.x, 1) && DELTALESSTHAN(pMonitor->vecPosition.y, pMonitorRule->offset.y, 1)) || - pMonitorRule->offset == Vector2D(-1, -1)) && + pMonitorRule->offset == Vector2D(-INT32_MAX, -INT32_MAX)) && pMonitor->transform == pMonitorRule->transform && pMonitorRule->enable10bit == pMonitor->enabled10bit && !memcmp(&pMonitor->customDrmMode, &pMonitorRule->drmMode, sizeof(pMonitor->customDrmMode))) {