diff options
author | Vaxry <[email protected]> | 2024-04-06 03:09:20 +0100 |
---|---|---|
committer | Vaxry <[email protected]> | 2024-04-06 15:16:16 +0100 |
commit | ec73f033aa2d08163d0667d34623ed36686da83c (patch) | |
tree | ecfdd71f1e507018106a413ce0b9f3f15e668893 | |
parent | fb22c996eb613868c0da86c4c5d9633e9981c749 (diff) | |
download | Hyprland-ec73f033aa2d08163d0667d34623ed36686da83c.tar.gz Hyprland-ec73f033aa2d08163d0667d34623ed36686da83c.zip |
subsurface: init existing subsurfaces on children creations
fixes #5333
-rw-r--r-- | src/desktop/Subsurface.cpp | 34 | ||||
-rw-r--r-- | src/desktop/Subsurface.hpp | 2 |
2 files changed, 11 insertions, 25 deletions
diff --git a/src/desktop/Subsurface.cpp b/src/desktop/Subsurface.cpp index c3538ee1..88a77af9 100644 --- a/src/desktop/Subsurface.cpp +++ b/src/desktop/Subsurface.cpp @@ -7,38 +7,24 @@ static void onNewSubsurface(void* owner, void* data); CSubsurface::CSubsurface(CWindow* pOwner) : m_pWindowParent(pOwner) { initSignals(); - - wlr_subsurface* wlrSubsurface; - wl_list_for_each(wlrSubsurface, &pOwner->m_pWLSurface.wlr()->current.subsurfaces_below, current.link) { - ::onNewSubsurface(this, wlrSubsurface); - } - wl_list_for_each(wlrSubsurface, &pOwner->m_pWLSurface.wlr()->current.subsurfaces_above, current.link) { - ::onNewSubsurface(this, wlrSubsurface); - } + initExistingSubsurfaces(pOwner->m_pWLSurface.wlr()); } CSubsurface::CSubsurface(CPopup* pOwner) : m_pPopupParent(pOwner) { initSignals(); - - wlr_subsurface* wlrSubsurface; - wl_list_for_each(wlrSubsurface, &pOwner->m_sWLSurface.wlr()->current.subsurfaces_below, current.link) { - ::onNewSubsurface(this, wlrSubsurface); - } - wl_list_for_each(wlrSubsurface, &pOwner->m_sWLSurface.wlr()->current.subsurfaces_above, current.link) { - ::onNewSubsurface(this, wlrSubsurface); - } + initExistingSubsurfaces(pOwner->m_sWLSurface.wlr()); } CSubsurface::CSubsurface(wlr_subsurface* pSubsurface, CWindow* pOwner) : m_pSubsurface(pSubsurface), m_pWindowParent(pOwner) { m_sWLSurface.assign(pSubsurface->surface, this); initSignals(); - initExistingSubsurfaces(); + initExistingSubsurfaces(pSubsurface->surface); } CSubsurface::CSubsurface(wlr_subsurface* pSubsurface, CPopup* pOwner) : m_pSubsurface(pSubsurface), m_pPopupParent(pOwner) { m_sWLSurface.assign(pSubsurface->surface, this); initSignals(); - initExistingSubsurfaces(); + initExistingSubsurfaces(pSubsurface->surface); } CSubsurface::~CSubsurface() { @@ -47,6 +33,8 @@ CSubsurface::~CSubsurface() { if (!m_pSubsurface) return; + m_pSubsurface->data = nullptr; + hyprListener_commitSubsurface.removeCallback(); hyprListener_destroySubsurface.removeCallback(); } @@ -78,6 +66,7 @@ static void onUnmapSubsurface(void* owner, void* data) { void CSubsurface::initSignals() { if (m_pSubsurface) { + m_pSubsurface->data = this; hyprListener_commitSubsurface.initCallback(&m_pSubsurface->surface->events.commit, &onCommitSubsurface, this, "CSubsurface"); hyprListener_destroySubsurface.initCallback(&m_pSubsurface->events.destroy, &onDestroySubsurface, this, "CSubsurface"); hyprListener_newSubsurface.initCallback(&m_pSubsurface->surface->events.new_subsurface, &::onNewSubsurface, this, "CSubsurface"); @@ -225,15 +214,12 @@ Vector2D CSubsurface::coordsGlobal() { return coords; } -void CSubsurface::initExistingSubsurfaces() { - if (m_pWindowParent) - return; - +void CSubsurface::initExistingSubsurfaces(wlr_surface* pSurface) { wlr_subsurface* wlrSubsurface; - wl_list_for_each(wlrSubsurface, &m_sWLSurface.wlr()->current.subsurfaces_below, current.link) { + wl_list_for_each(wlrSubsurface, &pSurface->current.subsurfaces_below, current.link) { ::onNewSubsurface(this, wlrSubsurface); } - wl_list_for_each(wlrSubsurface, &m_sWLSurface.wlr()->current.subsurfaces_above, current.link) { + wl_list_for_each(wlrSubsurface, &pSurface->current.subsurfaces_above, current.link) { ::onNewSubsurface(this, wlrSubsurface); } } diff --git a/src/desktop/Subsurface.hpp b/src/desktop/Subsurface.hpp index ca02a6d5..b7c0a397 100644 --- a/src/desktop/Subsurface.hpp +++ b/src/desktop/Subsurface.hpp @@ -54,6 +54,6 @@ class CSubsurface { bool m_bInert = false; void initSignals(); - void initExistingSubsurfaces(); + void initExistingSubsurfaces(wlr_surface* pSurface); void checkSiblingDamage(); };
\ No newline at end of file |