hc
2024-07-02 39af2116d7581c9a12be9e73bb6bdc31496495ef
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 2276c5ab50f32c1b3471f1ac05855cb92f958e6c 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/69] 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 c22d9b9d6..631d5ee56 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -4769,7 +4769,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;
 
@@ -4793,7 +4798,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