parent
9f5a57ff45
commit
ae50f8614d
7 changed files with 61 additions and 31 deletions
|
|
@ -119,7 +119,7 @@ Vector2D CWLSubsurfaceResource::posRelativeToParent() {
|
|||
while (surf->role->role() == SURFACE_ROLE_SUBSURFACE &&
|
||||
std::find_if(surfacesVisited.begin(), surfacesVisited.end(), [surf](const auto& other) { return surf == other; }) == surfacesVisited.end()) {
|
||||
surfacesVisited.emplace_back(surf);
|
||||
auto subsurface = (CWLSubsurfaceResource*)parent->role.get();
|
||||
auto subsurface = ((CSubsurfaceRole*)parent->role.get())->subsurface.lock();
|
||||
pos += subsurface->position;
|
||||
surf = subsurface->parent.lock();
|
||||
}
|
||||
|
|
@ -130,10 +130,6 @@ bool CWLSubsurfaceResource::good() {
|
|||
return resource->resource();
|
||||
}
|
||||
|
||||
eSurfaceRole CWLSubsurfaceResource::role() {
|
||||
return SURFACE_ROLE_SUBSURFACE;
|
||||
}
|
||||
|
||||
SP<CWLSurfaceResource> CWLSubsurfaceResource::t1Parent() {
|
||||
SP<CWLSurfaceResource> surf = parent.lock();
|
||||
std::vector<SP<CWLSurfaceResource>> surfacesVisited;
|
||||
|
|
@ -141,7 +137,7 @@ SP<CWLSurfaceResource> CWLSubsurfaceResource::t1Parent() {
|
|||
while (surf->role->role() == SURFACE_ROLE_SUBSURFACE &&
|
||||
std::find_if(surfacesVisited.begin(), surfacesVisited.end(), [surf](const auto& other) { return surf == other; }) == surfacesVisited.end()) {
|
||||
surfacesVisited.emplace_back(surf);
|
||||
auto subsurface = (CWLSubsurfaceResource*)parent->role.get();
|
||||
auto subsurface = ((CSubsurfaceRole*)parent->role.get())->subsurface.lock();
|
||||
surf = subsurface->parent.lock();
|
||||
}
|
||||
return surf;
|
||||
|
|
@ -171,7 +167,7 @@ CWLSubcompositorResource::CWLSubcompositorResource(SP<CWlSubcompositor> resource
|
|||
SP<CWLSurfaceResource> t1Parent = nullptr;
|
||||
|
||||
if (PARENT->role->role() == SURFACE_ROLE_SUBSURFACE) {
|
||||
auto subsurface = (CWLSubsurfaceResource*)PARENT->role.get();
|
||||
auto subsurface = ((CSubsurfaceRole*)PARENT->role.get())->subsurface.lock();
|
||||
t1Parent = subsurface->t1Parent();
|
||||
} else
|
||||
t1Parent = PARENT;
|
||||
|
|
@ -191,7 +187,7 @@ CWLSubcompositorResource::CWLSubcompositorResource(SP<CWlSubcompositor> resource
|
|||
}
|
||||
|
||||
RESOURCE->self = RESOURCE;
|
||||
SURF->role = RESOURCE;
|
||||
SURF->role = makeShared<CSubsurfaceRole>(RESOURCE);
|
||||
PARENT->subsurfaces.emplace_back(RESOURCE);
|
||||
|
||||
LOGM(LOG, "New wl_subsurface with id {} at {:x}", id, (uintptr_t)RESOURCE.get());
|
||||
|
|
@ -225,3 +221,7 @@ void CWLSubcompositorProtocol::destroyResource(CWLSubcompositorResource* resourc
|
|||
void CWLSubcompositorProtocol::destroyResource(CWLSubsurfaceResource* resource) {
|
||||
std::erase_if(m_vSurfaces, [&](const auto& other) { return other.get() == resource; });
|
||||
}
|
||||
|
||||
CSubsurfaceRole::CSubsurfaceRole(SP<CWLSubsurfaceResource> sub) : subsurface(sub) {
|
||||
;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue