From 29359d02eb4667384e599ba6baa0797d14f823ca Mon Sep 17 00:00:00 2001 From: Seunghun Lee Date: Tue, 22 Sep 2020 13:32:11 +0900 Subject: [PATCH] subsurface: Do not raise a protocol error for a reference surface as parent. According to a documentation of wl_subsurface, a parent surface can be a reference surface for wl_subsurface.place_(above/below) interface. Change-Id: I790b6a39cf64c413d8fc17b857c07ff55b646cd0 --- src/bin/e_comp_wl_subsurface.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/bin/e_comp_wl_subsurface.c b/src/bin/e_comp_wl_subsurface.c index 3c4b05d986..e8ce3f54a4 100644 --- a/src/bin/e_comp_wl_subsurface.c +++ b/src/bin/e_comp_wl_subsurface.c @@ -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); -- 2.34.1