mirror of
https://github.com/hyprwm/Hyprland
synced 2025-12-20 05:10:20 +01:00
renderer: Allow DS for surfaces with inert subsurfaces (#12133)
This commit is contained in:
parent
0b1d690676
commit
b2ea6b010c
3 changed files with 26 additions and 7 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue