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 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;

View file

@ -945,7 +945,7 @@ SWorkspaceRule CConfigManager::getWorkspaceRuleFor(CWorkspace* pWorkspace) {
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))
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(),
[&](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&);
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::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))
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;
}

View file

@ -1124,10 +1124,7 @@ 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;
if (**PPRESERVESPLIT == 0 && **PSMARTSPLIT == 0)
splitTop = box.h * **PFLMULT > box.w;
bool splitTop = box.h * **PFLMULT > box.w;
const auto SPLITSIDE = !splitTop;