Skip to content

Commit 3822673

Browse files
committed
desktop: move popups to UPs and fix missing subsurface resource
fixes #9283
1 parent bdbfa93 commit 3822673

File tree

5 files changed

+16
-13
lines changed

5 files changed

+16
-13
lines changed

src/desktop/LayerSurface.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class CLayerSurface {
5959
CBox geometry = {0, 0, 0, 0};
6060
Vector2D position;
6161
std::string szNamespace = "";
62-
SP<CPopup> popupHead;
62+
UP<CPopup> popupHead;
6363

6464
void onDestroy();
6565
void onMap();

src/desktop/Popup.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,24 @@
1212
#include "../render/OpenGL.hpp"
1313
#include <ranges>
1414

15-
SP<CPopup> CPopup::create(PHLWINDOW pOwner) {
16-
auto popup = SP<CPopup>(new CPopup());
15+
UP<CPopup> CPopup::create(PHLWINDOW pOwner) {
16+
auto popup = UP<CPopup>(new CPopup());
1717
popup->m_pWindowOwner = pOwner;
1818
popup->m_pSelf = popup;
1919
popup->initAllSignals();
2020
return popup;
2121
}
2222

23-
SP<CPopup> CPopup::create(PHLLS pOwner) {
24-
auto popup = SP<CPopup>(new CPopup());
23+
UP<CPopup> CPopup::create(PHLLS pOwner) {
24+
auto popup = UP<CPopup>(new CPopup());
2525
popup->m_pLayerOwner = pOwner;
2626
popup->m_pSelf = popup;
2727
popup->initAllSignals();
2828
return popup;
2929
}
3030

31-
SP<CPopup> CPopup::create(SP<CXDGPopupResource> resource, WP<CPopup> pOwner) {
32-
auto popup = SP<CPopup>(new CPopup());
31+
UP<CPopup> CPopup::create(SP<CXDGPopupResource> resource, WP<CPopup> pOwner) {
32+
auto popup = UP<CPopup>(new CPopup());
3333
popup->m_pResource = resource;
3434
popup->m_pWindowOwner = pOwner->m_pWindowOwner;
3535
popup->m_pLayerOwner = pOwner->m_pLayerOwner;
@@ -282,7 +282,8 @@ void CPopup::recheckTree() {
282282
}
283283

284284
void CPopup::recheckChildrenRecursive() {
285-
auto cpy = m_vChildren;
285+
std::vector<WP<CPopup>> cpy;
286+
std::ranges::for_each(m_vChildren, [&cpy](const auto& el) { cpy.emplace_back(el); });
286287
for (auto const& c : cpy) {
287288
c->onCommit(true);
288289
c->recheckChildrenRecursive();

src/desktop/Popup.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ class CXDGPopupResource;
1010
class CPopup {
1111
public:
1212
// dummy head nodes
13-
static SP<CPopup> create(PHLWINDOW pOwner);
14-
static SP<CPopup> create(PHLLS pOwner);
13+
static UP<CPopup> create(PHLWINDOW pOwner);
14+
static UP<CPopup> create(PHLLS pOwner);
1515

1616
// real nodes
17-
static SP<CPopup> create(SP<CXDGPopupResource> popup, WP<CPopup> pOwner);
17+
static UP<CPopup> create(SP<CXDGPopupResource> popup, WP<CPopup> pOwner);
1818

1919
~CPopup();
2020

@@ -64,7 +64,7 @@ class CPopup {
6464
bool m_bInert = false;
6565

6666
//
67-
std::vector<SP<CPopup>> m_vChildren;
67+
std::vector<UP<CPopup>> m_vChildren;
6868
UP<CSubsurface> m_pSubsurfaceHead;
6969

7070
struct {

src/desktop/Subsurface.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ UP<CSubsurface> CSubsurface::create(WP<CPopup> pOwner) {
2929
UP<CSubsurface> CSubsurface::create(SP<CWLSubsurfaceResource> pSubsurface, PHLWINDOW pOwner) {
3030
auto subsurface = UP<CSubsurface>(new CSubsurface());
3131
subsurface->m_pWindowParent = pOwner;
32+
subsurface->m_pSubsurface = pSubsurface;
3233
subsurface->m_pSelf = subsurface;
3334
subsurface->m_pWLSurface = CWLSurface::create();
3435
subsurface->m_pWLSurface->assign(pSubsurface->surface.lock(), subsurface.get());
@@ -40,6 +41,7 @@ UP<CSubsurface> CSubsurface::create(SP<CWLSubsurfaceResource> pSubsurface, PHLWI
4041
UP<CSubsurface> CSubsurface::create(SP<CWLSubsurfaceResource> pSubsurface, WP<CPopup> pOwner) {
4142
auto subsurface = UP<CSubsurface>(new CSubsurface());
4243
subsurface->m_pPopupParent = pOwner;
44+
subsurface->m_pSubsurface = pSubsurface;
4345
subsurface->m_pSelf = subsurface;
4446
subsurface->m_pWLSurface = CWLSurface::create();
4547
subsurface->m_pWLSurface->assign(pSubsurface->surface.lock(), subsurface.get());

src/desktop/Window.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ class CWindow {
298298

299299
// desktop components
300300
UP<CSubsurface> m_pSubsurfaceHead;
301-
SP<CPopup> m_pPopupHead;
301+
UP<CPopup> m_pPopupHead;
302302

303303
// Animated border
304304
CGradientValueData m_cRealBorderColor = {0};

0 commit comments

Comments
 (0)