1From 67d6cf6144652a8862c60135adf247fd3e1a8706 Mon Sep 17 00:00:00 2001 2From: Jeffy Chen <jeffy.chen@rock-chips.com> 3Date: Wed, 3 Nov 2021 17:52:51 +0800 4Subject: [PATCH 55/93] compositor: Support placing subsurface above or below 5 all siblings 6 7By passing itself as sibling in ::place_above or ::place_below. 8 9Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com> 10--- 11 libweston/compositor.c | 14 ++++++++++++-- 12 1 file changed, 12 insertions(+), 2 deletions(-) 13 14diff --git a/libweston/compositor.c b/libweston/compositor.c 15index ff07e40..b76e1e9 100644 16--- a/libweston/compositor.c 17+++ b/libweston/compositor.c 18@@ -5158,7 +5158,12 @@ subsurface_place_above(struct wl_client *client, 19 if (!sub) 20 return; 21 22- sibling = subsurface_sibling_check(sub, surface, "place_above"); 23+ if (surface == sub->surface) 24+ sibling = container_of(sub->parent->subsurface_list.next, 25+ struct weston_subsurface, parent_link); 26+ else 27+ sibling = subsurface_sibling_check(sub, surface, "place_above"); 28+ 29 if (!sibling) 30 return; 31 32@@ -5182,7 +5187,12 @@ subsurface_place_below(struct wl_client *client, 33 if (!sub) 34 return; 35 36- sibling = subsurface_sibling_check(sub, surface, "place_below"); 37+ if (surface == sub->surface) 38+ sibling = container_of(sub->parent->subsurface_list.prev, 39+ struct weston_subsurface, parent_link); 40+ else 41+ sibling = subsurface_sibling_check(sub, surface, "place_below"); 42+ 43 if (!sibling) 44 return; 45 46-- 472.20.1 48 49