efl-wl: add function to get pid of a surface

Summary: this is useful for tracking surfaces of specific clients

Reviewers: bu5hm4n, devilhorns

Reviewed By: devilhorns

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D11438
This commit is contained in:
Mike Blumenkrantz 2020-03-03 12:27:43 -05:00
parent 146cf9da7e
commit f6f4c1fcc8
2 changed files with 23 additions and 0 deletions

View File

@ -177,6 +177,17 @@ EAPI void *efl_wl_global_add(Evas_Object *obj, const void *interface, uint32_t v
*/
EAPI Eina_Bool efl_wl_surface_extract(Evas_Object *surface);
/**
* Return the pid for the surface's client
*
* Get the pid of the underlying client that created the surface.
*
* @param surface The surface to extract
* @return The pid of the surface, or -1 on failure
* @since 1.24
*/
EAPI int32_t efl_wl_surface_pid_get(Evas_Object *surface);
/**
* Get the Evas_Object for an extracted wl_surface resource created by an efl_wl object
*

View File

@ -5909,6 +5909,18 @@ extracted_changed(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event
shell_surface_send_configure(data);
}
int32_t
efl_wl_surface_pid_get(Evas_Object *surface)
{
Comp_Surface *cs;
int32_t pid;
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->dead, -1);
wl_client_get_credentials(wl_resource_get_client(cs->res), &pid, NULL, NULL);
return pid;
}
Eina_Bool
efl_wl_surface_extract(Evas_Object *surface)
{