From 3d028b1c348ab53170b4f6e70ebe0794de14ff8d Mon Sep 17 00:00:00 2001 From: Seunghun Lee Date: Thu, 22 Oct 2020 13:41:18 +0900 Subject: [PATCH] subsurface: Do not update stacking order of entire sub-surface tree. Accoding to the description of wl_subsurface, stacking order of the parent and its sub-surfaces is applied when the parent surface's wl_surface state is applied, regardless of the sub-surface's mode. However enlightenment updates stacking order of the topmost parent and its sub-surfaces when any wl_surface(in the tree) state was applied. This is the point that is different with the description. This patch corrects it. Here is a possible problem without this patch. Let's say there are surfaces which make up the tree of sub-surfaces: 0 / \ 1(desync) 2 / \ / \ 3 4 5 6 And let's say client writes wayland protocol like this: wl_subsurface_place_below(4, 3) wl_subsurface_place_below(2, 1) wl_surface_commit(1) wl_display_dispatch(wl_display) It should only place surface 4 under the surface 3, but should not place surface 2 under the surface 1 because surface 0's state isn't applied yet. Without this patch, this code will place surface 2 under the surface 1 as well. Change-Id: Icacf0ea171ac898a66c7afa33727be93934544b3 --- src/bin/e_comp_wl.c | 5 ++--- src/bin/e_comp_wl_subsurface.c | 25 +++++-------------------- 2 files changed, 7 insertions(+), 23 deletions(-) diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c index 1300ce6c77..e04d06c880 100644 --- a/src/bin/e_comp_wl.c +++ b/src/bin/e_comp_wl.c @@ -4357,9 +4357,8 @@ e_comp_wl_surface_commit(E_Client *ec) if (e_comp_wl_subsurface_order_commit(ec)) { - E_Client *topmost = e_comp_wl_topmost_parent_get(ec); - e_comp_wl_subsurface_restack(topmost); - e_comp_wl_subsurface_restack_bg_rectangle(topmost); + e_comp_wl_subsurface_restack(ec); + e_comp_wl_subsurface_restack_bg_rectangle(ec); } if (!e_pixmap_usable_get(ec->pixmap)) diff --git a/src/bin/e_comp_wl_subsurface.c b/src/bin/e_comp_wl_subsurface.c index aa9991cc4e..688cc551e7 100644 --- a/src/bin/e_comp_wl_subsurface.c +++ b/src/bin/e_comp_wl_subsurface.c @@ -328,17 +328,14 @@ _e_comp_wl_subsurface_invisible_parent_get(E_Client *ec) static Eina_Bool _e_comp_wl_subsurface_order_commit(E_Client *ec) { - E_Client *subc, *epc; + E_Client *subc; Eina_List *l; - Eina_Bool need_restack = EINA_FALSE; if (!ec->comp_data) return EINA_FALSE; - if (ec->comp_data->sub.data && (epc = ec->comp_data->sub.data->parent)) - if (epc->comp_data->sub.list_changed) - need_restack = _e_comp_wl_subsurface_order_commit(epc); + if (!ec->comp_data->sub.list_changed) + return EINA_FALSE; - if (!ec->comp_data->sub.list_changed) return (EINA_FALSE | need_restack); ec->comp_data->sub.list_changed = EINA_FALSE; /* TODO: need to check more complicated subsurface tree */ @@ -466,9 +463,8 @@ _e_comp_wl_subsurface_commit_from_cache(E_Client *ec) if (_e_comp_wl_subsurface_order_commit(ec)) { - E_Client *topmost = e_comp_wl_topmost_parent_get(ec); - _e_comp_wl_subsurface_restack(topmost); - _e_comp_wl_subsurface_restack_bg_rectangle(topmost); + _e_comp_wl_subsurface_restack(ec); + _e_comp_wl_subsurface_restack_bg_rectangle(ec); } sdata->cached.has_data = EINA_FALSE; @@ -1223,19 +1219,8 @@ e_comp_wl_subsurface_restack_bg_rectangle(E_Client *ec) EINTERN void e_comp_wl_subsurface_restack(E_Client *ec) { - E_Client *topmost; - EINA_SAFETY_ON_NULL_RETURN(ec); - topmost = e_comp_wl_topmost_parent_get(ec); - if (topmost != ec) - { - ELOGF("SUB-COMP", - "WARN: This API is only for topmost parent, not sub-surface.", - ec); - return; - } - _e_comp_wl_subsurface_restack(ec); } -- 2.34.1