diff options
| author | vaxerski <vaxry@vaxry.net> | 2022-09-22 18:12:25 +0100 |
|---|---|---|
| committer | vaxerski <vaxry@vaxry.net> | 2022-09-22 18:13:23 +0100 |
| commit | ef3eb37c7f2cdbbab23e611aedc438c317463ef8 (patch) | |
| tree | 3ed8903651421368da2220cb1972d1cfaffb3640 /src/events/Windows.cpp | |
| parent | db551b89708cc1b438a9cb1fa4e0f18f10de7354 (diff) | |
support max in size rules
Diffstat (limited to 'src/events/Windows.cpp')
| -rw-r--r-- | src/events/Windows.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp index 42aa344b..3fbaddb1 100644 --- a/src/events/Windows.cpp +++ b/src/events/Windows.cpp @@ -233,8 +233,10 @@ void Events::listener_mapWindow(void* owner, void* data) { const auto SIZEXSTR = VALUE.substr(0, VALUE.find(" ")); const auto SIZEYSTR = VALUE.substr(VALUE.find(" ") + 1); - const auto SIZEX = !SIZEXSTR.contains('%') ? std::stoi(SIZEXSTR) : std::stoi(SIZEXSTR.substr(0, SIZEXSTR.length() - 1)) * 0.01f * PMONITOR->vecSize.x; - const auto SIZEY = !SIZEYSTR.contains('%') ? std::stoi(SIZEYSTR) : std::stoi(SIZEYSTR.substr(0, SIZEYSTR.length() - 1)) * 0.01f * PMONITOR->vecSize.y; + const auto MAXSIZE = g_pXWaylandManager->getMaxSizeForWindow(PWINDOW); + + const auto SIZEX = SIZEXSTR == "max" ? std::clamp(MAXSIZE.x, (double)20, PMONITOR->vecSize.x) : (!SIZEXSTR.contains('%') ? std::stoi(SIZEXSTR) : std::stoi(SIZEXSTR.substr(0, SIZEXSTR.length() - 1)) * 0.01f * PMONITOR->vecSize.x); + const auto SIZEY = SIZEYSTR == "max" ? std::clamp(MAXSIZE.y, (double)20, PMONITOR->vecSize.y) : (!SIZEYSTR.contains('%') ? std::stoi(SIZEYSTR) : std::stoi(SIZEYSTR.substr(0, SIZEYSTR.length() - 1)) * 0.01f * PMONITOR->vecSize.y); Debug::log(LOG, "Rule size, applying to window %x", PWINDOW); |
