The wl_resource_get_user_data() has been used to get the corresponding
E_Client instance. To stop using wl_resource_get_user_data() directly,
this patch introduces a wrapper API. So, from now on,
e_client_from_surface_resource() has to be used instead of
wl_resource_get_user_data().
There could be some advantages with this API.
Firstly, as long as this API keeps returning E_Client instance, we can
change user data of surface resource if necessary.
Secondly, e_client_from_surface_resource() can check given surface
resource to see if it's actually associated with E_Client. If given
wl_resource isn't the one associated with E_Client, then it could return
NULL so that the caller would fail fast. Or, the caller would end up
manipulating the returned pointer of wl_resource_get_user_data() without
knowing it's not the correct instance.
Change-Id: I7fdc19a6b4cba647c314c32ae36ab847ca459ff7
if (!ec) return EINA_FALSE;
return ec->apply_layout;
}
+
+E_API E_Client *
+e_client_from_surface_resource(struct wl_resource *surface_resource)
+{
+ return wl_resource_get_user_data(surface_resource);
+}
EINTERN void e_client_idler_before(void);
EINTERN Eina_Bool e_client_init(void);
EINTERN void e_client_shutdown(void);
+E_API E_Client *e_client_from_surface_resource(struct wl_resource *surface_resource);
E_API E_Client *e_client_new(E_Pixmap *cp, int first_map, int internal);
E_API Eina_Bool e_client_is_internal(E_Client *ec);
E_API void e_client_unignore(E_Client *ec);