aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorVaxry <[email protected]>2024-09-08 00:46:16 +0100
committerVaxry <[email protected]>2024-09-08 00:46:46 +0100
commit312411fc7073143a8bf1fc3ba23ef403b7d15eee (patch)
tree266a203b0499bbccf0bc1286960072122b9bafc9
parent70add904c40924a761059e4009a8c0f1e43d76a3 (diff)
downloadHyprland-312411fc7073143a8bf1fc3ba23ef403b7d15eee.tar.gz
Hyprland-312411fc7073143a8bf1fc3ba23ef403b7d15eee.zip
windows: support size with pseudo tiled
fixes #7690
-rw-r--r--src/events/Windows.cpp35
1 files changed, 32 insertions, 3 deletions
diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp
index 034920a2..544483b1 100644
--- a/src/events/Windows.cpp
+++ b/src/events/Windows.cpp
@@ -344,7 +344,8 @@ void Events::listener_mapWindow(void* owner, void* data) {
Debug::log(LOG, "Rule size, applying to {}", PWINDOW);
- PWINDOW->m_vRealSize = Vector2D(SIZEX, SIZEY);
+ PWINDOW->m_vRealSize = Vector2D(SIZEX, SIZEY);
+ PWINDOW->m_vPseudoSize = PWINDOW->m_vRealSize.goal();
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goal());
PWINDOW->setHidden(false);
@@ -449,8 +450,36 @@ void Events::listener_mapWindow(void* owner, void* data) {
} else {
g_pLayoutManager->getCurrentLayout()->onWindowCreated(PWINDOW);
- // Set the pseudo size here too so that it doesnt end up being 0x0
- PWINDOW->m_vPseudoSize = PWINDOW->m_vRealSize.goal() - Vector2D(10, 10);
+ bool setPseudo = false;
+
+ for (auto const& r : PWINDOW->m_vMatchedRules) {
+ 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, PMONITOR->vecSize.x) :
+ (!SIZEXSTR.contains('%') ? std::stoi(SIZEXSTR) : std::stof(SIZEXSTR.substr(0, SIZEXSTR.length() - 1)) * 0.01 * PMONITOR->vecSize.x);
+ const auto SIZEY = SIZEYSTR == "max" ?
+ std::clamp(MAXSIZE.y, 20.0, PMONITOR->vecSize.y) :
+ (!SIZEYSTR.contains('%') ? std::stoi(SIZEYSTR) : std::stof(SIZEYSTR.substr(0, SIZEYSTR.length() - 1)) * 0.01 * PMONITOR->vecSize.y);
+
+ Debug::log(LOG, "Rule size (tiled), applying to {}", PWINDOW);
+
+ setPseudo = true;
+ PWINDOW->m_vPseudoSize = Vector2D(SIZEX, SIZEY);
+
+ PWINDOW->setHidden(false);
+ } catch (...) { Debug::log(LOG, "Rule size failed, rule: {} -> {}", r.szRule, r.szValue); }
+ }
+ }
+
+ if (!setPseudo)
+ PWINDOW->m_vPseudoSize = PWINDOW->m_vRealSize.goal() - Vector2D(10, 10);
}
const auto PFOCUSEDWINDOWPREV = g_pCompositor->m_pLastWindow.lock();