hc
2023-11-20 2e7bd41e4e8ab3d1efdabd9e263a2f7fe79bff8c
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
From 66b8ecef5aea7337a418f9a6e99f651329a2a390 Mon Sep 17 00:00:00 2001
From: Jeffy Chen <jeffy.chen@rock-chips.com>
Date: Wed, 3 Nov 2021 17:52:51 +0800
Subject: [PATCH 52/74] compositor: Support placing subsurface above or below
 all siblings
 
By passing itself as sibling in ::place_above or ::place_below.
 
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
---
 libweston/compositor.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
 
diff --git a/libweston/compositor.c b/libweston/compositor.c
index 02cb51b..9ef5669 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -4748,7 +4748,12 @@ subsurface_place_above(struct wl_client *client,
     if (!sub)
         return;
 
-    sibling = subsurface_sibling_check(sub, surface, "place_above");
+    if (surface == sub->surface)
+        sibling = container_of(sub->parent->subsurface_list.next,
+            struct weston_subsurface, parent_link);
+    else
+        sibling = subsurface_sibling_check(sub, surface, "place_above");
+
     if (!sibling)
         return;
 
@@ -4772,7 +4777,12 @@ subsurface_place_below(struct wl_client *client,
     if (!sub)
         return;
 
-    sibling = subsurface_sibling_check(sub, surface, "place_below");
+    if (surface == sub->surface)
+        sibling = container_of(sub->parent->subsurface_list.prev,
+            struct weston_subsurface, parent_link);
+    else
+        sibling = subsurface_sibling_check(sub, surface, "place_below");
+
     if (!sibling)
         return;
 
-- 
2.20.1