diff options
author | Vaxry <[email protected]> | 2024-03-08 17:10:38 +0000 |
---|---|---|
committer | Vaxry <[email protected]> | 2024-03-08 17:10:38 +0000 |
commit | 4c34e4aac25309b1203b5527387c8425f8e84ca8 (patch) | |
tree | b7a594831048e600b98d1ad31aa797d95c8dbbbf | |
parent | d1c80c31c8d4bdaff37c04d0e713cb8ba71f7588 (diff) | |
download | Hyprland-4c34e4aac25309b1203b5527387c8425f8e84ca8.tar.gz Hyprland-4c34e4aac25309b1203b5527387c8425f8e84ca8.zip |
windowrules: minor improvements to min/max size
fixes #5017
-rw-r--r-- | src/Window.cpp | 18 | ||||
-rw-r--r-- | src/Window.hpp | 2 |
2 files changed, 16 insertions, 4 deletions
diff --git a/src/Window.cpp b/src/Window.cpp index 8bc16f1b..3d101d13 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -691,7 +691,13 @@ void CWindow::applyDynamicRule(const SWindowRule& r) { try { if (!m_bIsFloating) return; - m_sAdditionalConfigData.maxSize = configStringToVector2D(r.szRule.substr(8)); + const auto VEC = configStringToVector2D(r.szRule.substr(8)); + if (VEC.x < 1 || VEC.y < 1) { + Debug::log(ERR, "Invalid size for maxsize"); + return; + } + + m_sAdditionalConfigData.maxSize = VEC; m_vRealSize = Vector2D(std::min((double)m_sAdditionalConfigData.maxSize.toUnderlying().x, m_vRealSize.goal().x), std::min((double)m_sAdditionalConfigData.maxSize.toUnderlying().y, m_vRealSize.goal().y)); g_pXWaylandManager->setWindowSize(this, m_vRealSize.goal()); @@ -701,7 +707,13 @@ void CWindow::applyDynamicRule(const SWindowRule& r) { try { if (!m_bIsFloating) return; - m_sAdditionalConfigData.minSize = configStringToVector2D(r.szRule.substr(8)); + const auto VEC = configStringToVector2D(r.szRule.substr(8)); + if (VEC.x < 1 || VEC.y < 1) { + Debug::log(ERR, "Invalid size for minsize"); + return; + } + + m_sAdditionalConfigData.minSize = VEC; m_vRealSize = Vector2D(std::max((double)m_sAdditionalConfigData.minSize.toUnderlying().x, m_vRealSize.goal().x), std::max((double)m_sAdditionalConfigData.minSize.toUnderlying().y, m_vRealSize.goal().y)); g_pXWaylandManager->setWindowSize(this, m_vRealSize.goal()); @@ -722,7 +734,7 @@ void CWindow::updateDynamicRules() { if (!m_sAdditionalConfigData.forceOpaqueOverridden) m_sAdditionalConfigData.forceOpaque = false; m_sAdditionalConfigData.maxSize = Vector2D(std::numeric_limits<double>::max(), std::numeric_limits<double>::max()); - m_sAdditionalConfigData.minSize = Vector2D(1, 1); + m_sAdditionalConfigData.minSize = Vector2D(20, 20); m_sAdditionalConfigData.forceNoAnims = false; m_sAdditionalConfigData.animationStyle = std::string(""); m_sAdditionalConfigData.rounding = -1; diff --git a/src/Window.hpp b/src/Window.hpp index 5fcb951f..2a19cfa5 100644 --- a/src/Window.hpp +++ b/src/Window.hpp @@ -156,7 +156,7 @@ struct SWindowAdditionalConfigData { CWindowOverridableVar<bool> windowDanceCompat = false; CWindowOverridableVar<bool> noMaxSize = false; CWindowOverridableVar<Vector2D> maxSize = Vector2D(std::numeric_limits<double>::max(), std::numeric_limits<double>::max()); - CWindowOverridableVar<Vector2D> minSize = Vector2D(1, 1); + CWindowOverridableVar<Vector2D> minSize = Vector2D(20, 20); CWindowOverridableVar<bool> dimAround = false; CWindowOverridableVar<bool> forceRGBX = false; CWindowOverridableVar<bool> keepAspectRatio = false; |