mirror of
https://github.com/hyprwm/Hyprland
synced 2025-12-25 01:10:15 +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)
|
if (res->m_subsurfaces.size() == 0)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
if (res->m_subsurfaces.size() == 1) {
|
if (res->m_subsurfaces.size() >= 1) {
|
||||||
if (res->m_subsurfaces[0].expired() || res->m_subsurfaces[0]->m_surface.expired())
|
if (!res->hasVisibleSubsurface())
|
||||||
return nullptr;
|
return res;
|
||||||
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)
|
if (res->m_subsurfaces.size() == 1) {
|
||||||
return nullptr;
|
if (res->m_subsurfaces[0].expired() || res->m_subsurfaces[0]->m_surface.expired())
|
||||||
return surf;
|
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;
|
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) {
|
void CWLSurfaceResource::updateCursorShm(CRegion damage) {
|
||||||
if (damage.empty())
|
if (damage.empty())
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -128,6 +128,7 @@ class CWLSurfaceResource {
|
||||||
void commitState(SSurfaceState& state);
|
void commitState(SSurfaceState& state);
|
||||||
NColorManagement::SImageDescription getPreferredImageDescription();
|
NColorManagement::SImageDescription getPreferredImageDescription();
|
||||||
void sortSubsurfaces();
|
void sortSubsurfaces();
|
||||||
|
bool hasVisibleSubsurface();
|
||||||
|
|
||||||
// returns a pair: found surface (null if not found) and surface local coords.
|
// returns a pair: found surface (null if not found) and surface local coords.
|
||||||
// localCoords param is relative to 0,0 of this surface
|
// localCoords param is relative to 0,0 of this surface
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue