From: Boram Park Date: Thu, 14 Jan 2016 10:34:15 +0000 (+0900) Subject: implement tizen_policy.get_subsurface X-Git-Tag: submit/tizen/20160121.104248~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=40c2d7e797c7e5711fed8209bdb3a470d85cf701;p=platform%2Fcore%2Fuifw%2Fe-mod-tizen-wm-policy.git implement tizen_policy.get_subsurface Change-Id: I4191fb272c9555eb417a2d70f9c6e5f08c92c461 --- diff --git a/src/e_mod_wl.c b/src/e_mod_wl.c index 37a4a5f..d090176 100644 --- a/src/e_mod_wl.c +++ b/src/e_mod_wl.c @@ -1568,6 +1568,52 @@ _tzpol_iface_cb_subsurf_place_below_parent(struct wl_client *client EINA_UNUSED, epc->comp_data->sub.list_changed = EINA_TRUE; } +static void +_tzpol_iface_cb_subsurface_get(struct wl_client *client, struct wl_resource *resource, uint32_t id, struct wl_resource *surface, uint32_t parent_id) +{ + E_Client *ec, *epc; + + ELOGF("TZPOL", + "SUBSURF |wl_surface@%d|parent_id:%d", + NULL, NULL, wl_resource_get_id(surface), parent_id); + + ec = wl_resource_get_user_data(surface); + if (!ec) + { + wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT, + "tizen_policy failed: wrong wl_surface@%d resource", + wl_resource_get_id(surface)); + return; + } + + if (e_object_is_del(E_OBJECT(ec))) return; + + epc = e_pixmap_find_client_by_res_id(parent_id); + if (!epc) + { + wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT, + "tizen_policy failed: wrong parent_id(%d)", parent_id); + return; + } + + if (e_object_is_del(E_OBJECT(epc))) return; + + /* check if this surface is already a sub-surface */ + if ((ec->comp_data) && (ec->comp_data->sub.data)) + { + wl_resource_post_error(resource, + WL_SUBCOMPOSITOR_ERROR_BAD_SURFACE, + "wl_surface@%d is already a sub-surface", + wl_resource_get_id(surface)); + return; + } + + /* try to create a new subsurface */ + if (!e_comp_wl_subsurface_create(ec, epc, id, surface)) + ERR("Failed to create subsurface for surface@%d", + wl_resource_get_id(surface)); +} + static void _tzpol_iface_cb_opaque_state_set(struct wl_client *client, struct wl_resource *resource, struct wl_resource *surface, int32_t state) { @@ -1816,6 +1862,7 @@ static const struct tizen_policy_interface _tzpol_iface = _tzpol_iface_cb_transient_for_unset, _tzpol_iface_cb_win_scrmode_set, _tzpol_iface_cb_subsurf_place_below_parent, + _tzpol_iface_cb_subsurface_get, _tzpol_iface_cb_opaque_state_set, _tzpol_iface_cb_iconify, _tzpol_iface_cb_uniconify,