diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2025-11-17 18:34:02 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-17 18:34:02 +0000 |
| commit | c2670e9ab90bd657e87a1da2c5322e9007dce01f (patch) | |
| tree | cd033fe3a9b87b1b0d457df043ecc50929ad3c8d /src/protocols | |
| parent | 95ee08b3403b90e2930d46425cada1d280f3524e (diff) | |
windowrules: rewrite completely (#12269)
Reworks the window rule syntax completely
---------
Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
Diffstat (limited to 'src/protocols')
| -rw-r--r-- | src/protocols/Screencopy.cpp | 6 | ||||
| -rw-r--r-- | src/protocols/ShortcutsInhibit.cpp | 2 | ||||
| -rw-r--r-- | src/protocols/ToplevelExport.cpp | 4 | ||||
| -rw-r--r-- | src/protocols/XDGDialog.cpp | 2 | ||||
| -rw-r--r-- | src/protocols/XDGTag.cpp | 3 | ||||
| -rw-r--r-- | src/protocols/types/ContentType.cpp | 10 | ||||
| -rw-r--r-- | src/protocols/types/ContentType.hpp | 1 |
7 files changed, 20 insertions, 8 deletions
diff --git a/src/protocols/Screencopy.cpp b/src/protocols/Screencopy.cpp index e2a32c91..84487a18 100644 --- a/src/protocols/Screencopy.cpp +++ b/src/protocols/Screencopy.cpp @@ -230,7 +230,7 @@ void CScreencopyFrame::renderMon() { }; for (auto const& l : g_pCompositor->m_layers) { - if (!l->m_noScreenShare) + if (!l->m_ruleApplicator->noScreenShare().valueOrDefault()) continue; if UNLIKELY ((!l->m_mapped && !l->m_fadingOut) || l->m_alpha->value() == 0.f) @@ -251,7 +251,7 @@ void CScreencopyFrame::renderMon() { } for (auto const& w : g_pCompositor->m_windows) { - if (!w->m_windowData.noScreenShare.valueOrDefault()) + if (!w->m_ruleApplicator->noScreenShare().valueOrDefault()) continue; if (!g_pHyprRenderer->shouldRenderWindow(w, m_monitor.lock())) @@ -272,7 +272,7 @@ void CScreencopyFrame::renderMon() { .scale(m_monitor->m_scale) .translate(-m_box.pos()); - const auto dontRound = w->isEffectiveInternalFSMode(FSMODE_FULLSCREEN) || w->m_windowData.noRounding.valueOrDefault(); + const auto dontRound = w->isEffectiveInternalFSMode(FSMODE_FULLSCREEN); const auto rounding = dontRound ? 0 : w->rounding() * m_monitor->m_scale; const auto roundingPower = dontRound ? 2.0f : w->roundingPower(); diff --git a/src/protocols/ShortcutsInhibit.cpp b/src/protocols/ShortcutsInhibit.cpp index b33db998..749390cd 100644 --- a/src/protocols/ShortcutsInhibit.cpp +++ b/src/protocols/ShortcutsInhibit.cpp @@ -70,7 +70,7 @@ bool CKeyboardShortcutsInhibitProtocol::isInhibited() { if (!g_pCompositor->m_lastFocus) return false; - if (const auto PWINDOW = g_pCompositor->getWindowFromSurface(g_pCompositor->m_lastFocus.lock()); PWINDOW && PWINDOW->m_windowData.noShortcutsInhibit.valueOrDefault()) + if (const auto PWINDOW = g_pCompositor->getWindowFromSurface(g_pCompositor->m_lastFocus.lock()); PWINDOW && PWINDOW->m_ruleApplicator->noShortcutsInhibit().valueOrDefault()) return false; for (auto const& in : m_inhibitors) { diff --git a/src/protocols/ToplevelExport.cpp b/src/protocols/ToplevelExport.cpp index eb0a39aa..c66c1f2b 100644 --- a/src/protocols/ToplevelExport.cpp +++ b/src/protocols/ToplevelExport.cpp @@ -257,7 +257,7 @@ bool CToplevelExportFrame::copyShm(const Time::steady_tp& now) { // render client at 0,0 if (PERM == PERMISSION_RULE_ALLOW_MODE_ALLOW) { - if (!m_window->m_windowData.noScreenShare.valueOrDefault()) { + if (!m_window->m_ruleApplicator->noScreenShare().valueOrDefault()) { g_pHyprRenderer->m_bBlockSurfaceFeedback = g_pHyprRenderer->shouldRenderWindow(m_window); // block the feedback to avoid spamming the surface if it's visible g_pHyprRenderer->renderWindow(m_window, PMONITOR, now, false, RENDER_PASS_ALL, true, true); g_pHyprRenderer->m_bBlockSurfaceFeedback = false; @@ -339,7 +339,7 @@ bool CToplevelExportFrame::copyDmabuf(const Time::steady_tp& now) { g_pHyprOpenGL->clear(CHyprColor(0, 0, 0, 1.0)); if (PERM == PERMISSION_RULE_ALLOW_MODE_ALLOW) { - if (!m_window->m_windowData.noScreenShare.valueOrDefault()) { + if (!m_window->m_ruleApplicator->noScreenShare().valueOrDefault()) { g_pHyprRenderer->m_bBlockSurfaceFeedback = g_pHyprRenderer->shouldRenderWindow(m_window); // block the feedback to avoid spamming the surface if it's visible g_pHyprRenderer->renderWindow(m_window, PMONITOR, now, false, RENDER_PASS_ALL, true, true); g_pHyprRenderer->m_bBlockSurfaceFeedback = false; diff --git a/src/protocols/XDGDialog.cpp b/src/protocols/XDGDialog.cpp index c38a1077..c64a8379 100644 --- a/src/protocols/XDGDialog.cpp +++ b/src/protocols/XDGDialog.cpp @@ -30,7 +30,7 @@ void CXDGDialogV1Resource::updateWindow() { if UNLIKELY (!HLSurface || !HLSurface->getWindow()) return; - g_pCompositor->updateWindowAnimatedDecorationValues(HLSurface->getWindow()); + HLSurface->getWindow()->m_ruleApplicator->propertiesChanged(Desktop::Rule::RULE_PROP_MODAL); } bool CXDGDialogV1Resource::good() { diff --git a/src/protocols/XDGTag.cpp b/src/protocols/XDGTag.cpp index 2966ac90..98c8651f 100644 --- a/src/protocols/XDGTag.cpp +++ b/src/protocols/XDGTag.cpp @@ -1,5 +1,6 @@ #include "XDGTag.hpp" #include "XDGShell.hpp" +#include "../desktop/Window.hpp" CXDGToplevelTagManagerResource::CXDGToplevelTagManagerResource(UP<CXdgToplevelTagManagerV1>&& resource) : m_resource(std::move(resource)) { if UNLIKELY (!good()) @@ -17,6 +18,8 @@ CXDGToplevelTagManagerResource::CXDGToplevelTagManagerResource(UP<CXdgToplevelTa } TOPLEVEL->m_toplevelTag = tag; + if (TOPLEVEL->m_window) + TOPLEVEL->m_window->m_ruleApplicator->propertiesChanged(Desktop::Rule::RULE_PROP_XDG_TAG); }); m_resource->setSetToplevelDescription([](CXdgToplevelTagManagerV1* r, wl_resource* toplevel, const char* description) { diff --git a/src/protocols/types/ContentType.cpp b/src/protocols/types/ContentType.cpp index c0a3d30f..b5b0041c 100644 --- a/src/protocols/types/ContentType.cpp +++ b/src/protocols/types/ContentType.cpp @@ -12,7 +12,15 @@ namespace NContentType { if (it != table.end()) return it->second; else - throw std::invalid_argument(std::format("Unknown content type {}", name)); + return CONTENT_TYPE_NONE; + } + + std::string toString(eContentType type) { + for (const auto& [k, v] : table) { + if (v == type) + return k; + } + return ""; } eContentType fromWP(wpContentTypeV1Type contentType) { diff --git a/src/protocols/types/ContentType.hpp b/src/protocols/types/ContentType.hpp index 66fcbca7..68bc7a41 100644 --- a/src/protocols/types/ContentType.hpp +++ b/src/protocols/types/ContentType.hpp @@ -13,6 +13,7 @@ namespace NContentType { }; eContentType fromString(const std::string name); + std::string toString(eContentType); eContentType fromWP(wpContentTypeV1Type contentType); uint16_t toDRM(eContentType contentType); }
\ No newline at end of file |
