remote_surface: added a way to get a list of tizen remote surface providers 38/197638/3
authorGwanglim Lee <gl77.lee@samsung.com>
Tue, 15 Jan 2019 00:54:59 +0000 (09:54 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Fri, 18 Jan 2019 06:57:40 +0000 (06:57 +0000)
Change-Id: I99fcb17424d3c03c8c79dd06144c15d9b52074cd

src/bin/e_comp_wl_rsm.c
src/bin/e_comp_wl_rsm.h

index 66679cf32c94c2acc0099524d0e5245b923ec6fa..de9891e73ac373d20f0b8a1c5a1deedf0dcaa435 100644 (file)
@@ -3886,6 +3886,62 @@ e_comp_wl_remote_surface_debug_info_get(Eldbus_Message_Iter *iter)
 #endif
 }
 
+/**
+ * Get a list of e_clients of tizen remote surface providers which is used in given ec
+ * NB: caller must free returned Eina_List object after using it.
+ */
+E_API Eina_List *
+e_comp_wl_remote_surface_providers_get(E_Client *ec)
+{
+   E_Comp_Wl_Remote_Provider *prov;
+   E_Comp_Wl_Remote_Source *src;
+   E_Comp_Wl_Remote_Surface *rs;
+   Eina_Iterator *it;
+   Eina_List *l;
+   Eina_List *provs = NULL; /* result list */
+   E_Client *owner_ec;
+
+   /* remote surface providers */
+   it = eina_hash_iterator_data_new(_rsm->provider_hash);
+   EINA_ITERATOR_FOREACH(it, prov)
+     {
+        EINA_LIST_FOREACH(prov->common.surfaces, l, rs)
+          {
+             owner_ec = rs->owner;
+             if (!owner_ec) owner_ec = rs->bind_ec;
+
+             if (!owner_ec) continue;
+             if (owner_ec != ec) continue;
+
+             /* append provider's ec to result list */
+             provs = eina_list_append(provs, prov->common.ec);
+             break;
+          }
+     }
+   eina_iterator_free(it);
+
+   /* remote sources i.e., normal window */
+   it = eina_hash_iterator_data_new(_rsm->source_hash);
+   EINA_ITERATOR_FOREACH(it, src)
+     {
+        EINA_LIST_FOREACH(src->common.surfaces, l, rs)
+          {
+             owner_ec = rs->owner;
+             if (!owner_ec) owner_ec = rs->bind_ec;
+
+             if (!owner_ec) continue;
+             if (owner_ec != ec) continue;
+
+             /* append source's ec to result list */
+             provs = eina_list_append(provs, src->common.ec);
+             break;
+          }
+     }
+   eina_iterator_free(it);
+
+   return provs;
+}
+
 #undef E_CLIENT_HOOK_APPEND
 #define E_CLIENT_HOOK_APPEND(l, t, cb, d) \
   do                                      \
index 29e3e38604628b8bad188edbc193627e414d2224..18bf6534c264461116f8311c52c0bdf4595b47cc 100644 (file)
@@ -4,14 +4,20 @@ typedef struct _E_Event_Remote_Surface_Provider E_Event_Remote_Surface_Provider;
 # ifndef E_COMP_WL_RSM_H
 #  define E_COMP_WL_RSM_H
 
-EINTERN void             e_comp_wl_remote_surface_init(void);
-EINTERN void             e_comp_wl_remote_surface_shutdown(void);
-EINTERN Eina_Bool        e_comp_wl_remote_surface_commit(E_Client *ec);
-E_API   void             e_comp_wl_remote_surface_image_save(E_Client *ec);
-E_API   void             e_comp_wl_remote_surface_image_save_skip_set(E_Client *ec, Eina_Bool set);
-E_API   Eina_Bool        e_comp_wl_remote_surface_image_save_skip_get(E_Client *ec);
-EINTERN void             e_comp_wl_remote_surface_debug_info_get(Eldbus_Message_Iter *iter);
-E_API   E_Client        *e_comp_wl_remote_surface_bound_provider_ec_get(E_Client *ec);
+EINTERN void       e_comp_wl_remote_surface_init(void);
+EINTERN void       e_comp_wl_remote_surface_shutdown(void);
+EINTERN Eina_Bool  e_comp_wl_remote_surface_commit(E_Client *ec);
+E_API   void       e_comp_wl_remote_surface_image_save(E_Client *ec);
+E_API   void       e_comp_wl_remote_surface_image_save_skip_set(E_Client *ec, Eina_Bool set);
+E_API   Eina_Bool  e_comp_wl_remote_surface_image_save_skip_get(E_Client *ec);
+EINTERN void       e_comp_wl_remote_surface_debug_info_get(Eldbus_Message_Iter *iter);
+E_API   E_Client  *e_comp_wl_remote_surface_bound_provider_ec_get(E_Client *ec);
+
+/**
+ * Get a list of e_clients of tizen remote surface providers which is used in given ec
+ * NB: caller must free returned Eina_List object after using it.
+ */
+E_API   Eina_List *e_comp_wl_remote_surface_providers_get(E_Client *ec);
 
 E_API extern int E_EVENT_REMOTE_SURFACE_PROVIDER_VISIBILITY_CHANGE;