1From b3be9051f1ad37160d412cb215e7230257d0919a Mon Sep 17 00:00:00 2001 2From: Jeffy Chen <jeffy.chen@rock-chips.com> 3Date: Wed, 3 Nov 2021 17:55:58 +0800 4Subject: [PATCH 15/17] qwaylandwindow: Support lower() and raise() 5 6Support lower() and raise() through hacked subsurface::place_below() and 7subsurface::place_below(). 8 9Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com> 10--- 11 src/client/qwaylandsubsurface.cpp | 10 ++++++++++ 12 src/client/qwaylandsubsurface_p.h | 3 +++ 13 src/client/qwaylandwindow.cpp | 12 ++++++++++-- 14 3 files changed, 23 insertions(+), 2 deletions(-) 15 16diff --git a/src/client/qwaylandsubsurface.cpp b/src/client/qwaylandsubsurface.cpp 17index 2ff966c..2fcb79e 100644 18--- a/src/client/qwaylandsubsurface.cpp 19+++ b/src/client/qwaylandsubsurface.cpp 20@@ -62,6 +62,16 @@ QWaylandSubSurface::~QWaylandSubSurface() 21 destroy(); 22 } 23 24+void QWaylandSubSurface::placeAbove(struct ::wl_surface *sibling) 25+{ 26+ QtWayland::wl_subsurface::place_above(sibling); 27+} 28+ 29+void QWaylandSubSurface::placeBelow(struct ::wl_surface *sibling) 30+{ 31+ QtWayland::wl_subsurface::place_below(sibling); 32+} 33+ 34 void QWaylandSubSurface::setSync() 35 { 36 QMutexLocker l(&m_syncLock); 37diff --git a/src/client/qwaylandsubsurface_p.h b/src/client/qwaylandsubsurface_p.h 38index 76da10b..1c38151 100644 39--- a/src/client/qwaylandsubsurface_p.h 40+++ b/src/client/qwaylandsubsurface_p.h 41@@ -73,6 +73,9 @@ public: 42 QWaylandWindow *window() const { return m_window; } 43 QWaylandWindow *parent() const { return m_parent; } 44 45+ void placeAbove(struct ::wl_surface *sibling); 46+ void placeBelow(struct ::wl_surface *sibling); 47+ 48 void setSync(); 49 void setDeSync(); 50 bool isSync() const { return m_synchronized; } 51diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp 52index ef308c5..b8d19a4 100644 53--- a/src/client/qwaylandwindow.cpp 54+++ b/src/client/qwaylandwindow.cpp 55@@ -501,18 +501,26 @@ void QWaylandWindow::setVisible(bool visible) 56 } 57 } 58 59- 60 void QWaylandWindow::raise() 61 { 62 if (mShellSurface) 63 mShellSurface->raise(); 64-} 65 66+ if (mSubSurfaceWindow && wlSurface()) { 67+ mSubSurfaceWindow->placeAbove(wlSurface()); 68+ mSubSurfaceWindow->parent()->commit(); 69+ } 70+} 71 72 void QWaylandWindow::lower() 73 { 74 if (mShellSurface) 75 mShellSurface->lower(); 76+ 77+ if (mSubSurfaceWindow && wlSurface()) { 78+ mSubSurfaceWindow->placeBelow(wlSurface()); 79+ mSubSurfaceWindow->parent()->commit(); 80+ } 81 } 82 83 void QWaylandWindow::setOpacity(qreal level) 84-- 852.20.1 86 87