summaryrefslogtreecommitdiff
path: root/src/layout/IHyprLayout.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/layout/IHyprLayout.cpp')
-rw-r--r--src/layout/IHyprLayout.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/layout/IHyprLayout.cpp b/src/layout/IHyprLayout.cpp
index f2616668..73e7a125 100644
--- a/src/layout/IHyprLayout.cpp
+++ b/src/layout/IHyprLayout.cpp
@@ -881,18 +881,17 @@ Vector2D IHyprLayout::predictSizeForNewWindowFloating(PHLWINDOW pWindow) { // ge
for (auto const& r : g_pConfigManager->getMatchingRules(pWindow, true, true)) {
if (r.szRule.starts_with("size")) {
try {
- const auto VALUE = r.szRule.substr(r.szRule.find(' ') + 1);
- const auto SIZEXSTR = VALUE.substr(0, VALUE.find(' '));
- const auto SIZEYSTR = VALUE.substr(VALUE.find(' ') + 1);
-
- const auto MAXSIZE = g_pXWaylandManager->getMaxSizeForWindow(pWindow);
-
- const auto SIZEX = SIZEXSTR == "max" ?
- std::clamp(MAXSIZE.x, 20.0, g_pCompositor->m_pLastMonitor->vecSize.x) :
- (!SIZEXSTR.contains('%') ? std::stoi(SIZEXSTR) : std::stof(SIZEXSTR.substr(0, SIZEXSTR.length() - 1)) * 0.01 * g_pCompositor->m_pLastMonitor->vecSize.x);
- const auto SIZEY = SIZEYSTR == "max" ?
- std::clamp(MAXSIZE.y, 20.0, g_pCompositor->m_pLastMonitor->vecSize.y) :
- (!SIZEYSTR.contains('%') ? std::stoi(SIZEYSTR) : std::stof(SIZEYSTR.substr(0, SIZEYSTR.length() - 1)) * 0.01 * g_pCompositor->m_pLastMonitor->vecSize.y);
+ const auto VALUE = r.szRule.substr(r.szRule.find(' ') + 1);
+ const auto SIZEXSTR = VALUE.substr(0, VALUE.find(' '));
+ const auto SIZEYSTR = VALUE.substr(VALUE.find(' ') + 1);
+
+ const auto MAXSIZE = g_pXWaylandManager->getMaxSizeForWindow(pWindow);
+
+ const float SIZEX = SIZEXSTR == "max" ? std::clamp(MAXSIZE.x, MIN_WINDOW_SIZE, g_pCompositor->m_pLastMonitor->vecSize.x) :
+ stringToPercentage(SIZEXSTR, g_pCompositor->m_pLastMonitor->vecSize.x);
+
+ const float SIZEY = SIZEYSTR == "max" ? std::clamp(MAXSIZE.y, MIN_WINDOW_SIZE, g_pCompositor->m_pLastMonitor->vecSize.y) :
+ stringToPercentage(SIZEYSTR, g_pCompositor->m_pLastMonitor->vecSize.y);
sizeOverride = {SIZEX, SIZEY};