mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-15 11:05:58 +01:00
foreign-toplevel: don't send updates to X11 OR windows
This commit is contained in:
parent
e5d3a71263
commit
904f9b6aee
2 changed files with 25 additions and 5 deletions
|
@ -31,8 +31,8 @@ CForeignToplevelList::CForeignToplevelList(SP<CExtForeignToplevelListV1> resourc
|
||||||
});
|
});
|
||||||
|
|
||||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
for (auto const& w : g_pCompositor->m_vWindows) {
|
||||||
if (!w->m_bIsMapped || w->m_bFadingOut)
|
if (!PROTO::foreignToplevel->windowValidForForeign(w))
|
||||||
continue;
|
return;
|
||||||
|
|
||||||
onMap(w);
|
onMap(w);
|
||||||
}
|
}
|
||||||
|
@ -112,20 +112,35 @@ bool CForeignToplevelList::good() {
|
||||||
|
|
||||||
CForeignToplevelProtocol::CForeignToplevelProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
CForeignToplevelProtocol::CForeignToplevelProtocol(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) {
|
static auto P = g_pHookSystem->hookDynamic("openWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||||
|
auto window = std::any_cast<PHLWINDOW>(data);
|
||||||
|
|
||||||
|
if (!windowValidForForeign(window))
|
||||||
|
return;
|
||||||
|
|
||||||
for (auto const& m : m_vManagers) {
|
for (auto const& m : m_vManagers) {
|
||||||
m->onMap(std::any_cast<PHLWINDOW>(data));
|
m->onMap(window);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
static auto P1 = g_pHookSystem->hookDynamic("closeWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
static auto P1 = g_pHookSystem->hookDynamic("closeWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||||
|
auto window = std::any_cast<PHLWINDOW>(data);
|
||||||
|
|
||||||
|
if (!windowValidForForeign(window))
|
||||||
|
return;
|
||||||
|
|
||||||
for (auto const& m : m_vManagers) {
|
for (auto const& m : m_vManagers) {
|
||||||
m->onUnmap(std::any_cast<PHLWINDOW>(data));
|
m->onUnmap(window);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
static auto P2 = g_pHookSystem->hookDynamic("windowTitle", [this](void* self, SCallbackInfo& info, std::any data) {
|
static auto P2 = g_pHookSystem->hookDynamic("windowTitle", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||||
|
auto window = std::any_cast<PHLWINDOW>(data);
|
||||||
|
|
||||||
|
if (!windowValidForForeign(window))
|
||||||
|
return;
|
||||||
|
|
||||||
for (auto const& m : m_vManagers) {
|
for (auto const& m : m_vManagers) {
|
||||||
m->onTitle(std::any_cast<PHLWINDOW>(data));
|
m->onTitle(window);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -148,3 +163,7 @@ void CForeignToplevelProtocol::onManagerResourceDestroy(CForeignToplevelList* mg
|
||||||
void CForeignToplevelProtocol::destroyHandle(CForeignToplevelHandle* handle) {
|
void CForeignToplevelProtocol::destroyHandle(CForeignToplevelHandle* handle) {
|
||||||
std::erase_if(m_vHandles, [&](const auto& other) { return other.get() == handle; });
|
std::erase_if(m_vHandles, [&](const auto& other) { return other.get() == handle; });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CForeignToplevelProtocol::windowValidForForeign(PHLWINDOW pWindow) {
|
||||||
|
return validMapped(pWindow) && !pWindow->isX11OverrideRedirect();
|
||||||
|
}
|
||||||
|
|
|
@ -50,6 +50,7 @@ class CForeignToplevelProtocol : public IWaylandProtocol {
|
||||||
private:
|
private:
|
||||||
void onManagerResourceDestroy(CForeignToplevelList* mgr);
|
void onManagerResourceDestroy(CForeignToplevelList* mgr);
|
||||||
void destroyHandle(CForeignToplevelHandle* handle);
|
void destroyHandle(CForeignToplevelHandle* handle);
|
||||||
|
bool windowValidForForeign(PHLWINDOW pWindow);
|
||||||
|
|
||||||
//
|
//
|
||||||
std::vector<UP<CForeignToplevelList>> m_vManagers;
|
std::vector<UP<CForeignToplevelList>> m_vManagers;
|
||||||
|
|
Loading…
Reference in a new issue