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