From: Seunghun Lee Date: Tue, 22 Sep 2020 04:32:11 +0000 (+0900) Subject: subsurface: Do not raise a protocol error for a reference surface as parent. X-Git-Tag: submit/tizen/20201109.083635~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F33%2F246933%2F3;p=platform%2Fupstream%2Fenlightenment.git 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: Iafb202dce3a88e12e9be24809a61aca5746e1fc6 --- 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);