efl-wl: add function to get the parent of an extracted surface

@feature
This commit is contained in:
Mike Blumenkrantz 2018-01-03 18:22:32 -05:00
parent 0f7c5582a4
commit cca561e94e
2 changed files with 31 additions and 0 deletions

View File

@ -156,6 +156,17 @@ EAPI Eina_Bool efl_wl_surface_extract(Evas_Object *surface);
* @since 1.21
*/
EAPI Evas_Object *efl_wl_extracted_surface_object_find(void *surface_resource);
/**
* Get the Evas_Object for an extracted surface's parent
*
* @note Passing anything other than a valid, extracted surface guarantees a crash.
*
* @param surface The extracted surface for a wl_surface
* @return The Evas_Object of the parent surface, NULL on failure or if there is no parent
* @since 1.21
*/
EAPI Evas_Object *efl_wl_extracted_surface_extracted_parent_get(Evas_Object *surface);
#endif
#endif

View File

@ -5585,3 +5585,23 @@ efl_wl_extracted_surface_object_find(void *surface_resource)
return cs->obj;
}
Evas_Object *
efl_wl_extracted_surface_extracted_parent_get(Evas_Object *surface)
{
Comp_Surface *cs;
EINA_SAFETY_ON_NULL_RETURN_VAL(surface, NULL);
if (!eina_streq(evas_object_type_get(surface), "comp_surface")) abort();
cs = evas_object_smart_data_get(surface);
EINA_SAFETY_ON_TRUE_RETURN_VAL(!cs->extracted, NULL);
EINA_SAFETY_ON_TRUE_RETURN_VAL(cs->dead, NULL);
if (cs->parent)
{
EINA_SAFETY_ON_FALSE_RETURN_VAL(!cs->parent->extracted, NULL);
return cs->parent->obj;
}
return NULL;
}