aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/desktop
diff options
context:
space:
mode:
authorMightyPlaza <[email protected]>2024-10-30 18:58:36 +0000
committerGitHub <[email protected]>2024-10-30 18:58:36 +0000
commit12c1bb936dd463c4188def1c73c2bb786433a6dc (patch)
treed59596edbf4c4ffa0581b92e3bbcf5710e9758e6 /src/desktop
parent5f721dce36651232ae245d872c17dfa3aae5cc6c (diff)
downloadHyprland-12c1bb936dd463c4188def1c73c2bb786433a6dc.tar.gz
Hyprland-12c1bb936dd463c4188def1c73c2bb786433a6dc.zip
internal: check size limit in layouts (#8298)
modified: src/desktop/Window.cpp modified: src/desktop/Window.hpp modified: src/events/Windows.cpp modified: src/helpers/MiscFunctions.cpp modified: src/helpers/MiscFunctions.hpp modified: src/layout/DwindleLayout.cpp modified: src/layout/IHyprLayout.cpp modified: src/layout/MasterLayout.cpp modified: src/macros.hpp
Diffstat (limited to 'src/desktop')
-rw-r--r--src/desktop/Window.cpp2
-rw-r--r--src/desktop/Window.hpp7
2 files changed, 8 insertions, 1 deletions
diff --git a/src/desktop/Window.cpp b/src/desktop/Window.cpp
index 60f3b79d..20fed565 100644
--- a/src/desktop/Window.cpp
+++ b/src/desktop/Window.cpp
@@ -1255,7 +1255,7 @@ int CWindow::surfacesCount() {
void CWindow::clampWindowSize(const std::optional<Vector2D> minSize, const std::optional<Vector2D> maxSize) {
const Vector2D REALSIZE = m_vRealSize.goal();
- const Vector2D NEWSIZE = REALSIZE.clamp(minSize.value_or(Vector2D{0.f, 0.f}), maxSize.value_or(Vector2D{INFINITY, INFINITY}));
+ const Vector2D NEWSIZE = REALSIZE.clamp(minSize.value_or(Vector2D{MIN_WINDOW_SIZE, MIN_WINDOW_SIZE}), maxSize.value_or(Vector2D{INFINITY, INFINITY}));
const Vector2D DELTA = REALSIZE - NEWSIZE;
m_vRealPosition = m_vRealPosition.goal() + DELTA / 2.0;
diff --git a/src/desktop/Window.hpp b/src/desktop/Window.hpp
index 825e8ca2..b8dd3cf7 100644
--- a/src/desktop/Window.hpp
+++ b/src/desktop/Window.hpp
@@ -144,6 +144,13 @@ class CWindowOverridableVar {
unset(priority);
}
+ operator std::optional<T>() {
+ if (hasValue())
+ return value();
+ else
+ return std::nullopt;
+ }
+
private:
std::map<eOverridePriority, T> values;
T defaultValue; // used for toggling, so required for bool