From 81308a9cc32a9fac71aefd0ecae9f40bc85220cb Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Thu, 4 Aug 2022 11:10:26 +0200 Subject: add position auto for mon config --- src/config/ConfigManager.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/config/ConfigManager.cpp') diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index cbef44f3..5128a4c3 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -453,12 +453,16 @@ void CConfigManager::handleMonitor(const std::string& command, const std::string nextItem(); - newrule.offset.x = stoi(curitem.substr(0, curitem.find_first_of('x'))); - newrule.offset.y = stoi(curitem.substr(curitem.find_first_of('x') + 1)); + if (curitem.find("auto") == 0) { + newrule.offset = Vector2D(-1, -1); + } else { + newrule.offset.x = stoi(curitem.substr(0, curitem.find_first_of('x'))); + newrule.offset.y = stoi(curitem.substr(curitem.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 (newrule.offset.x < 0 || newrule.offset.y < 0) { + parseError = "invalid offset. Offset cannot be negative."; + newrule.offset = Vector2D(); + } } nextItem(); -- cgit v1.2.3