subsurface: Do not raise a protocol error for a reference surface as parent. 33/246933/3
authorSeunghun Lee <shiin.lee@samsung.com>
Tue, 22 Sep 2020 04:32:11 +0000 (13:32 +0900)
committerSeunghun Lee <shiin.lee@samsung.com>
Mon, 9 Nov 2020 02:49:38 +0000 (11:49 +0900)
According to a documentation of wl_subsurface, a parent surface can be a
reference surface for wl_subsurface.place_(above/below) interface.

Change-Id: Iafb202dce3a88e12e9be24809a61aca5746e1fc6

src/bin/e_comp_wl_subsurface.c

index 3c4b05d986986c366316b88c1d8eaffd4e935e56..e8ce3f54a4712f17baf70d1f2e808dc9f7a8c8ef 100644 (file)
@@ -550,6 +550,9 @@ _subsurface_sibling_check(E_Client *ec1, E_Client *ec2)
 
    parent = ec1->comp_data->sub.data->parent;
 
+   if (parent == ec2)
+     return EINA_TRUE;
+
    EINA_LIST_FOREACH(parent->comp_data->sub.list_pending, l, sibling)
      {
         if ((sibling != ec1) && (sibling == ec2))
@@ -578,14 +581,12 @@ _e_comp_wl_subsurface_cb_place_above(struct wl_client *client EINA_UNUSED, struc
    if (e_object_is_del(E_OBJECT(ec)) || !ec->comp_data) return;
    if (!ec->comp_data->sub.data) return;
 
-   /* try to get the client from the sibling resource */
-   if (!(ecs = wl_resource_get_user_data(sibling_resource))) return;
-
-   if (!ecs->comp_data->sub.data) return;
-
    if (!(parent = ec->comp_data->sub.data->parent)) return;
    if (e_object_is_del(E_OBJECT(parent)) || !parent->comp_data) return;
 
+   /* try to get the client from the sibling resource */
+   if (!(ecs = wl_resource_get_user_data(sibling_resource))) return;
+
    if (!_subsurface_sibling_check(ec, ecs))
      {
         wl_resource_post_error(ec->comp_data->sub.data->resource,
@@ -595,6 +596,8 @@ _e_comp_wl_subsurface_cb_place_above(struct wl_client *client EINA_UNUSED, struc
         return;
      }
 
+   if (!ecs->comp_data->sub.data) return;
+
    parent->comp_data->sub.list_pending =
      eina_list_remove(parent->comp_data->sub.list_pending, ec);
 
@@ -617,14 +620,12 @@ _e_comp_wl_subsurface_cb_place_below(struct wl_client *client EINA_UNUSED, struc
    if (e_object_is_del(E_OBJECT(ec)) || !ec->comp_data) return;
    if (!ec->comp_data->sub.data) return;
 
-   /* try to get the client from the sibling resource */
-   if (!(ecs = wl_resource_get_user_data(sibling_resource))) return;
-
-   if (!ecs->comp_data->sub.data) return;
-
    if (!(parent = ec->comp_data->sub.data->parent)) return;
    if (e_object_is_del(E_OBJECT(parent)) || !parent->comp_data) return;
 
+   /* try to get the client from the sibling resource */
+   if (!(ecs = wl_resource_get_user_data(sibling_resource))) return;
+
    if (!_subsurface_sibling_check(ec, ecs))
      {
         wl_resource_post_error(ec->comp_data->sub.data->resource,
@@ -634,6 +635,8 @@ _e_comp_wl_subsurface_cb_place_below(struct wl_client *client EINA_UNUSED, struc
         return;
      }
 
+   if (!ecs->comp_data->sub.data) return;
+
    parent->comp_data->sub.list_pending =
      eina_list_remove(parent->comp_data->sub.list_pending, ec);