From d2289d8327d46e6b55c06b3c639fc138c3e02d1a Mon Sep 17 00:00:00 2001 From: Vaxry Date: Sat, 2 Mar 2024 18:53:11 +0000 Subject: [PATCH] xdg: minor improvements to initial size reporting fixes #4918 --- src/Window.cpp | 5 ++--- src/config/ConfigManager.cpp | 4 ++-- src/config/ConfigManager.hpp | 2 +- src/events/Windows.cpp | 4 ++-- src/layout/DwindleLayout.cpp | 7 ++----- 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/Window.cpp b/src/Window.cpp index 997aa3f4..335010c8 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -239,13 +239,12 @@ bool CWindow::checkInputOnDecos(const eInputType type, const Vector2D& mouseCoor pid_t CWindow::getPID() { pid_t PID = -1; if (!m_bIsX11) { - - if (!m_bIsMapped) + if (!m_uSurface.xdg) return -1; wl_client_get_credentials(wl_resource_get_client(m_uSurface.xdg->resource), &PID, nullptr, nullptr); } else { - if (!m_bIsMapped) + if (!m_uSurface.xwayland) return -1; PID = m_uSurface.xwayland->pid; diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 2fd5aa28..4ae62392 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -945,7 +945,7 @@ SWorkspaceRule CConfigManager::getWorkspaceRuleFor(CWorkspace* pWorkspace) { return *IT; } -std::vector CConfigManager::getMatchingRules(CWindow* pWindow, bool dynamic) { +std::vector CConfigManager::getMatchingRules(CWindow* pWindow, bool dynamic, bool shadowExec) { if (!g_pCompositor->windowExists(pWindow)) return std::vector(); @@ -1093,7 +1093,7 @@ std::vector CConfigManager::getMatchingRules(CWindow* pWindow, bool } } - if (anyExecFound) // remove exec rules to unclog searches in the future, why have the garbage here. + if (anyExecFound && !shadowExec) // remove exec rules to unclog searches in the future, why have the garbage here. execRequestedRules.erase(std::remove_if(execRequestedRules.begin(), execRequestedRules.end(), [&](const SExecRequestedRule& other) { return std::ranges::any_of(PIDs, [&](const auto& pid) { return pid == other.iPid; }); })); diff --git a/src/config/ConfigManager.hpp b/src/config/ConfigManager.hpp index fbc61059..2effb644 100644 --- a/src/config/ConfigManager.hpp +++ b/src/config/ConfigManager.hpp @@ -111,7 +111,7 @@ class CConfigManager { std::string getBoundMonitorStringForWS(const std::string&); const std::deque& getAllWorkspaceRules(); - std::vector getMatchingRules(CWindow*, bool dynamic = true); + std::vector getMatchingRules(CWindow*, bool dynamic = true, bool shadowExec = false); std::vector getMatchingRules(SLayerSurface*); std::unordered_map m_mAdditionalReservedAreas; diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp index 6209b77b..83a37ec3 100644 --- a/src/events/Windows.cpp +++ b/src/events/Windows.cpp @@ -808,8 +808,8 @@ void Events::listener_commitWindow(void* owner, void* data) { if ((maxSize.x > 0 && maxSize.x < predSize.x) || (maxSize.y > 0 && maxSize.y < predSize.y)) predSize = {}; - for (auto& r : g_pConfigManager->getMatchingRules(PWINDOW)) { - if (r.szRule == "float") { + for (auto& r : g_pConfigManager->getMatchingRules(PWINDOW, true, true)) { + if (r.szRule.starts_with("float")) { predSize = {}; break; } diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp index fda93e97..a08dfa9e 100644 --- a/src/layout/DwindleLayout.cpp +++ b/src/layout/DwindleLayout.cpp @@ -1124,12 +1124,9 @@ Vector2D CHyprDwindleLayout::predictSizeForNewWindow() { static auto* const PPRESERVESPLIT = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("dwindle:preserve_split"); static auto* const PFLMULT = (Hyprlang::FLOAT* const*)g_pConfigManager->getConfigValuePtr("dwindle:split_width_multiplier"); - bool splitTop = false; + bool splitTop = box.h * **PFLMULT > box.w; - if (**PPRESERVESPLIT == 0 && **PSMARTSPLIT == 0) - splitTop = box.h * **PFLMULT > box.w; - - const auto SPLITSIDE = !splitTop; + const auto SPLITSIDE = !splitTop; if (SPLITSIDE) node.box = {{}, {box.w / 2.0, box.h}};