diff options
author | Vaxry <[email protected]> | 2024-10-19 16:09:46 +0100 |
---|---|---|
committer | Vaxry <[email protected]> | 2024-10-19 16:09:53 +0100 |
commit | 48bf32c5de5628a4a17387375ea997f738a4f807 (patch) | |
tree | 5761dbb450f1d183470ec7b2971034759ebc107b | |
parent | 904f9b6aee6a4524fba554f76b32747f85f0609d (diff) | |
download | Hyprland-48bf32c5de5628a4a17387375ea997f738a4f807.tar.gz Hyprland-48bf32c5de5628a4a17387375ea997f738a4f807.zip |
foreign-toplevel-wlr: don't send updates to X11 OR windows
-rw-r--r-- | src/protocols/ForeignToplevelWlr.cpp | 26 | ||||
-rw-r--r-- | src/protocols/ForeignToplevelWlr.hpp | 1 |
2 files changed, 26 insertions, 1 deletions
diff --git a/src/protocols/ForeignToplevelWlr.cpp b/src/protocols/ForeignToplevelWlr.cpp index 291969db..1163a5e7 100644 --- a/src/protocols/ForeignToplevelWlr.cpp +++ b/src/protocols/ForeignToplevelWlr.cpp @@ -180,7 +180,7 @@ CForeignToplevelWlrManager::CForeignToplevelWlrManager(SP<CZwlrForeignToplevelMa }); for (auto const& w : g_pCompositor->m_vWindows) { - if (!w->m_bIsMapped || w->m_bFadingOut) + if (!PROTO::foreignToplevelWlr->windowValidForForeign(w)) continue; onMap(w); @@ -313,6 +313,10 @@ bool CForeignToplevelWlrManager::good() { CForeignToplevelWlrProtocol::CForeignToplevelWlrProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) { static auto P = g_pHookSystem->hookDynamic("openWindow", [this](void* self, SCallbackInfo& info, std::any data) { const auto PWINDOW = std::any_cast<PHLWINDOW>(data); + + if (!windowValidForForeign(PWINDOW)) + return; + for (auto const& m : m_vManagers) { m->onMap(PWINDOW); } @@ -320,6 +324,10 @@ CForeignToplevelWlrProtocol::CForeignToplevelWlrProtocol(const wl_interface* ifa static auto P1 = g_pHookSystem->hookDynamic("closeWindow", [this](void* self, SCallbackInfo& info, std::any data) { const auto PWINDOW = std::any_cast<PHLWINDOW>(data); + + if (!windowValidForForeign(PWINDOW)) + return; + for (auto const& m : m_vManagers) { m->onUnmap(PWINDOW); } @@ -327,6 +335,10 @@ CForeignToplevelWlrProtocol::CForeignToplevelWlrProtocol(const wl_interface* ifa static auto P2 = g_pHookSystem->hookDynamic("windowTitle", [this](void* self, SCallbackInfo& info, std::any data) { const auto PWINDOW = std::any_cast<PHLWINDOW>(data); + + if (!windowValidForForeign(PWINDOW)) + return; + for (auto const& m : m_vManagers) { m->onTitle(PWINDOW); } @@ -334,6 +346,10 @@ CForeignToplevelWlrProtocol::CForeignToplevelWlrProtocol(const wl_interface* ifa static auto P3 = g_pHookSystem->hookDynamic("activeWindow", [this](void* self, SCallbackInfo& info, std::any data) { const auto PWINDOW = std::any_cast<PHLWINDOW>(data); + + if (!windowValidForForeign(PWINDOW)) + return; + for (auto const& m : m_vManagers) { m->onNewFocus(PWINDOW); } @@ -348,6 +364,10 @@ CForeignToplevelWlrProtocol::CForeignToplevelWlrProtocol(const wl_interface* ifa static auto P5 = g_pHookSystem->hookDynamic("fullscreen", [this](void* self, SCallbackInfo& info, std::any data) { const auto PWINDOW = std::any_cast<PHLWINDOW>(data); + + if (!windowValidForForeign(PWINDOW)) + return; + for (auto const& m : m_vManagers) { m->onFullscreen(PWINDOW); } @@ -383,3 +403,7 @@ PHLWINDOW CForeignToplevelWlrProtocol::windowFromHandleResource(wl_resource* res return nullptr; } + +bool CForeignToplevelWlrProtocol::windowValidForForeign(PHLWINDOW pWindow) { + return validMapped(pWindow) && !pWindow->isX11OverrideRedirect(); +} diff --git a/src/protocols/ForeignToplevelWlr.hpp b/src/protocols/ForeignToplevelWlr.hpp index 99f63b47..e726707d 100644 --- a/src/protocols/ForeignToplevelWlr.hpp +++ b/src/protocols/ForeignToplevelWlr.hpp @@ -63,6 +63,7 @@ class CForeignToplevelWlrProtocol : public IWaylandProtocol { private: void onManagerResourceDestroy(CForeignToplevelWlrManager* mgr); void destroyHandle(CForeignToplevelHandleWlr* handle); + bool windowValidForForeign(PHLWINDOW pWindow); // std::vector<UP<CForeignToplevelWlrManager>> m_vManagers; |