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

@ -6,6 +6,8 @@ CForeignToplevelHandle::CForeignToplevelHandle(SP<CExtForeignToplevelHandleV1> r
if UNLIKELY (!resource_->resource())
return;
resource->setData(this);
resource->setOnDestroy([this](CExtForeignToplevelHandleV1* h) { PROTO::foreignToplevel->destroyHandle(this); });
resource->setDestroy([this](CExtForeignToplevelHandleV1* h) { PROTO::foreignToplevel->destroyHandle(this); });
}
@ -168,3 +170,8 @@ void CForeignToplevelProtocol::destroyHandle(CForeignToplevelHandle* handle) {
bool CForeignToplevelProtocol::windowValidForForeign(PHLWINDOW pWindow) {
return validMapped(pWindow) && !pWindow->isX11OverrideRedirect();
}
PHLWINDOW CForeignToplevelProtocol::windowFromHandleResource(wl_resource* res) {
auto data = (CForeignToplevelHandle*)(((CExtForeignToplevelHandleV1*)wl_resource_get_user_data(res))->data());
return data ? data->window() : nullptr;
}