protocols: add Hyprland toplevel mapping implementation (#9775)

This commit is contained in:
WhySoBad 2025-04-24 18:10:57 +02:00 committed by GitHub
parent b06fbdb743
commit a9549dbca0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 147 additions and 11 deletions

View file

@ -10,6 +10,8 @@ CForeignToplevelHandleWlr::CForeignToplevelHandleWlr(SP<CZwlrForeignToplevelHand
if UNLIKELY (!resource_->resource())
return;
resource->setData(this);
resource->setOnDestroy([this](CZwlrForeignToplevelHandleV1* h) { PROTO::foreignToplevelWlr->destroyHandle(this); });
resource->setDestroy([this](CZwlrForeignToplevelHandleV1* h) { PROTO::foreignToplevelWlr->destroyHandle(this); });
@ -420,14 +422,8 @@ void CForeignToplevelWlrProtocol::destroyHandle(CForeignToplevelHandleWlr* handl
}
PHLWINDOW CForeignToplevelWlrProtocol::windowFromHandleResource(wl_resource* res) {
for (auto const& h : m_vHandles) {
if (h->res() != res)
continue;
return h->window();
}
return nullptr;
auto data = (CForeignToplevelHandleWlr*)(((CZwlrForeignToplevelHandleV1*)wl_resource_get_user_data(res))->data());
return data ? data->window() : nullptr;
}
bool CForeignToplevelWlrProtocol::windowValidForForeign(PHLWINDOW pWindow) {