xdg: minor improvements to initial size reporting

fixes #4918
This commit is contained in:
Vaxry 2024-03-02 18:53:11 +00:00
parent be89d6faa9
commit d2289d8327
5 changed files with 9 additions and 13 deletions

View file

@ -239,13 +239,12 @@ bool CWindow::checkInputOnDecos(const eInputType type, const Vector2D& mouseCoor
pid_t CWindow::getPID() { pid_t CWindow::getPID() {
pid_t PID = -1; pid_t PID = -1;
if (!m_bIsX11) { if (!m_bIsX11) {
if (!m_uSurface.xdg)
if (!m_bIsMapped)
return -1; return -1;
wl_client_get_credentials(wl_resource_get_client(m_uSurface.xdg->resource), &PID, nullptr, nullptr); wl_client_get_credentials(wl_resource_get_client(m_uSurface.xdg->resource), &PID, nullptr, nullptr);
} else { } else {
if (!m_bIsMapped) if (!m_uSurface.xwayland)
return -1; return -1;
PID = m_uSurface.xwayland->pid; PID = m_uSurface.xwayland->pid;

View file

@ -945,7 +945,7 @@ SWorkspaceRule CConfigManager::getWorkspaceRuleFor(CWorkspace* pWorkspace) {
return *IT; return *IT;
} }
std::vector<SWindowRule> CConfigManager::getMatchingRules(CWindow* pWindow, bool dynamic) { std::vector<SWindowRule> CConfigManager::getMatchingRules(CWindow* pWindow, bool dynamic, bool shadowExec) {
if (!g_pCompositor->windowExists(pWindow)) if (!g_pCompositor->windowExists(pWindow))
return std::vector<SWindowRule>(); return std::vector<SWindowRule>();
@ -1093,7 +1093,7 @@ std::vector<SWindowRule> 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(), 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; }); })); [&](const SExecRequestedRule& other) { return std::ranges::any_of(PIDs, [&](const auto& pid) { return pid == other.iPid; }); }));

View file

@ -111,7 +111,7 @@ class CConfigManager {
std::string getBoundMonitorStringForWS(const std::string&); std::string getBoundMonitorStringForWS(const std::string&);
const std::deque<SWorkspaceRule>& getAllWorkspaceRules(); const std::deque<SWorkspaceRule>& getAllWorkspaceRules();
std::vector<SWindowRule> getMatchingRules(CWindow*, bool dynamic = true); std::vector<SWindowRule> getMatchingRules(CWindow*, bool dynamic = true, bool shadowExec = false);
std::vector<SLayerRule> getMatchingRules(SLayerSurface*); std::vector<SLayerRule> getMatchingRules(SLayerSurface*);
std::unordered_map<std::string, SMonitorAdditionalReservedArea> m_mAdditionalReservedAreas; std::unordered_map<std::string, SMonitorAdditionalReservedArea> m_mAdditionalReservedAreas;

View file

@ -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)) if ((maxSize.x > 0 && maxSize.x < predSize.x) || (maxSize.y > 0 && maxSize.y < predSize.y))
predSize = {}; predSize = {};
for (auto& r : g_pConfigManager->getMatchingRules(PWINDOW)) { for (auto& r : g_pConfigManager->getMatchingRules(PWINDOW, true, true)) {
if (r.szRule == "float") { if (r.szRule.starts_with("float")) {
predSize = {}; predSize = {};
break; break;
} }

View file

@ -1124,12 +1124,9 @@ Vector2D CHyprDwindleLayout::predictSizeForNewWindow() {
static auto* const PPRESERVESPLIT = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("dwindle:preserve_split"); 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"); 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) const auto SPLITSIDE = !splitTop;
splitTop = box.h * **PFLMULT > box.w;
const auto SPLITSIDE = !splitTop;
if (SPLITSIDE) if (SPLITSIDE)
node.box = {{}, {box.w / 2.0, box.h}}; node.box = {{}, {box.w / 2.0, box.h}};