subsurface: Fix subsurface stack order error 84/295984/1
authorSeunghun Lee <shiin.lee@samsung.com>
Wed, 31 May 2023 00:22:26 +0000 (09:22 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Tue, 18 Jul 2023 04:40:27 +0000 (13:40 +0900)
Let's say there are two windows. One consists of a main surface and two
sub-surfaces placing above and below of the main surface each. The other
one consists of a main surface and a sub-surface placing above of the
main surface. Let's call these windows A and B in order.

The problem is that if the main surface of A window is restacked above
of the main surface of B window, the A window ended up placing between
the B's sub-surface and the main surface of B. This patch is to fix this
error.

Change-Id: Id06d833b75ca184e4eb55fb024fbf8e9356f8620

src/bin/e_comp_wl_subsurface.c

index b37f8ab..827b3af 100644 (file)
@@ -601,6 +601,34 @@ _e_comp_wl_subsurface_cb_ec_uniconify(void *data EINA_UNUSED, E_Client *ec)
    _e_comp_wl_subsurface_show(ec);
 }
 
+static E_Client *
+_e_comp_wl_subsurface_above_topmost_get(E_Client *ec)
+{
+   E_Client *iter = ec;
+
+   while ((iter = e_client_above_get(iter)))
+     {
+        if (!e_comp_wl_subsurface_check(iter))
+          return iter;
+     }
+
+   return NULL;
+}
+
+static E_Client *
+_e_comp_wl_subsurface_below_topmost_get(E_Client *ec)
+{
+   E_Client *iter = ec;
+
+   while ((iter = e_client_below_get(iter)))
+     {
+        if (!e_comp_wl_subsurface_check(iter))
+          return iter;
+     }
+
+   return NULL;
+}
+
 static void
 _e_comp_wl_subsurface_cb_comp_object_restack(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
 {
@@ -618,11 +646,11 @@ _e_comp_wl_subsurface_cb_comp_object_restack(void *data, Evas *e EINA_UNUSED, Ev
 
    _e_comp_wl_subsurface_stack_update(ec);
 
-   above = e_client_above_get(ec);
+   above = _e_comp_wl_subsurface_above_topmost_get(ec);
    if (above)
      _e_comp_wl_subsurface_stack_update(above);
 
-   below = e_client_below_get(ec);
+   below = _e_comp_wl_subsurface_below_topmost_get(ec);
    if (below)
      _e_comp_wl_subsurface_stack_update(below);
 }