Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions src/desktop/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1927,13 +1927,18 @@ SP<CWLSurfaceResource> CWindow::getSolitaryResource() {
if (res->m_subsurfaces.size() == 0)
return res;

if (res->m_subsurfaces.size() == 1) {
if (res->m_subsurfaces[0].expired() || res->m_subsurfaces[0]->m_surface.expired())
return nullptr;
auto surf = res->m_subsurfaces[0]->m_surface.lock();
if (!surf || surf->m_subsurfaces.size() != 0 || surf->extends() != res->extends() || !surf->m_current.texture || !surf->m_current.texture->m_opaque)
return nullptr;
return surf;
if (res->m_subsurfaces.size() >= 1) {
if (!res->hasVisibleSubsurface())
return res;

if (res->m_subsurfaces.size() == 1) {
if (res->m_subsurfaces[0].expired() || res->m_subsurfaces[0]->m_surface.expired())
return nullptr;
auto surf = res->m_subsurfaces[0]->m_surface.lock();
if (!surf || surf->m_subsurfaces.size() != 0 || surf->extends() != res->extends() || !surf->m_current.texture || !surf->m_current.texture->m_opaque)
return nullptr;
return surf;
}
}

return nullptr;
Expand Down
13 changes: 13 additions & 0 deletions src/protocols/core/Compositor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,19 @@ void CWLSurfaceResource::sortSubsurfaces() {
}
}

bool CWLSurfaceResource::hasVisibleSubsurface() {
for (auto const& subsurface : m_subsurfaces) {
if (!subsurface || !subsurface->m_surface)
continue;

const auto& surf = subsurface->m_surface;
if (surf->m_current.size.x > 0 && surf->m_current.size.y > 0)
return true;
}

return false;
}

void CWLSurfaceResource::updateCursorShm(CRegion damage) {
if (damage.empty())
return;
Expand Down
1 change: 1 addition & 0 deletions src/protocols/core/Compositor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ class CWLSurfaceResource {
void commitState(SSurfaceState& state);
NColorManagement::SImageDescription getPreferredImageDescription();
void sortSubsurfaces();
bool hasVisibleSubsurface();

// returns a pair: found surface (null if not found) and surface local coords.
// localCoords param is relative to 0,0 of this surface
Expand Down
Loading