From: MinJeong Kim Date: Wed, 30 Oct 2019 06:49:51 +0000 (+0900) Subject: e_appinfo : renamed e_policy_appinfo X-Git-Tag: submit/tizen/20191107.035437^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c7e1abe247ed1759909c74444758aa81fc142748;p=platform%2Fupstream%2Fenlightenment.git e_appinfo : renamed e_policy_appinfo e_policy_appinfo is renamed as e_appinfo. And we added USE_E_APPINFO macro for supporting outdated API of e_policy_appinfo to prevent build break. Change-Id: I9dff93b78e6186b2812ee6b11ef90846437f00d8 Signed-off-by: MinJeong Kim --- diff --git a/packaging/enlightenment.spec b/packaging/enlightenment.spec index c5c1728d39..160fdb5a0a 100644 --- a/packaging/enlightenment.spec +++ b/packaging/enlightenment.spec @@ -76,7 +76,7 @@ cp %{SOURCE1001} . %build %if "%{tizen_profile_name}" != "tv" -export CFLAGS+=" -fPIE " +export CFLAGS+=" -fPIE -DUSE_E_APPINFO" export LDFLAGS+=" -pie " %endif %autogen \ diff --git a/src/bin/Makefile.mk b/src/bin/Makefile.mk index 3497674745..cff8d69607 100644 --- a/src/bin/Makefile.mk +++ b/src/bin/Makefile.mk @@ -130,6 +130,7 @@ src/bin/e_policy_private_data.h \ src/bin/e_policy_wl.h \ src/bin/e_policy_wl_display.h \ src/bin/e_policy_appinfo.h \ +src/bin/e_appinfo.h \ src/bin/e_magnifier.h \ src/bin/e_process.h \ src/bin/e_privilege.h \ @@ -253,7 +254,7 @@ src/bin/e_policy_stack.c \ src/bin/e_policy_visibility.c \ src/bin/e_policy_wl.c \ src/bin/e_policy_wl_display.c \ -src/bin/e_policy_appinfo.c \ +src/bin/e_appinfo.c \ src/bin/e_magnifier.c \ src/bin/e_process.c \ src/bin/e_privilege.c \ diff --git a/src/bin/e.h b/src/bin/e.h index e5a032a8ec..8b012b4c56 100644 --- a/src/bin/e.h +++ b/src/bin/e.h @@ -403,4 +403,10 @@ extern E_API Eina_Bool stopping; # define DELD(obj, num) #endif +#ifndef USE_E_APPINFO + #define e_policy_appinfo_find_with_pid e_appinfo_find_with_pid + #define e_policy_appinfo_base_output_resolution_set e_appinfo_base_output_resolution_set + #define E_Policy_Appinfo E_Appinfo +#endif + #endif diff --git a/src/bin/e_appinfo.c b/src/bin/e_appinfo.c new file mode 100644 index 0000000000..e400a445b8 --- /dev/null +++ b/src/bin/e_appinfo.c @@ -0,0 +1,239 @@ +#include "e.h" +#include "e_appinfo.h" + +static Eina_List *appinfo_list; + +static int _appinfo_hooks_walking = 0; +static int _appinfo_hooks_delete = 0; + +static Eina_Inlist *_appinfo_hooks[] = +{ + [E_APPINFO_HOOK_APPID_SET] = NULL, + [E_APPINFO_HOOK_PID_SET] = NULL, + [E_APPINFO_HOOK_METADATA_READY] = NULL, +}; + +struct _E_Appinfo +{ + pid_t pid; + Eina_Stringshare *appid; + Eina_Bool base_output_available; + int base_output_width; + int base_output_height; +}; + +static void +_e_appinfo_hooks_clean(void) +{ + Eina_Inlist *l; + E_Appinfo_Hook *hook; + unsigned int x; + + for (x = 0; x < E_APPINFO_HOOK_LAST; x++) + EINA_INLIST_FOREACH_SAFE(_appinfo_hooks[x], l, hook) + { + if (!hook->delete_me) continue; + _appinfo_hooks[x] = eina_inlist_remove(_appinfo_hooks[x], EINA_INLIST_GET(hook)); + free(hook); + } +} + +static void +_e_appinfo_hook_call(E_Appinfo_Hook_Point hookpoint, const char* appid, pid_t pid) +{ + E_Appinfo_Hook *hook; + + _appinfo_hooks_walking++; + EINA_INLIST_FOREACH(_appinfo_hooks[hookpoint], hook) + { + if (hook->delete_me) continue; + hook->func(appid, pid, hook->data); + } + _appinfo_hooks_walking--; + if ((_appinfo_hooks_walking == 0) && (_appinfo_hooks_delete) > 0) + _e_appinfo_hooks_clean(); +} + + +EINTERN E_Appinfo * +e_appinfo_new(void) +{ + E_Appinfo *epai = NULL; + + epai = E_NEW(E_Appinfo, 1); + EINA_SAFETY_ON_NULL_RETURN_VAL(epai, NULL); + + epai->pid = -1; + epai->appid = NULL; + + appinfo_list = eina_list_append(appinfo_list, epai); + + ELOGF("POL_APPINFO", "appinfo(%p) create", NULL, epai); + + return epai; +} + +EINTERN void +e_appinfo_del(E_Appinfo *epai) +{ + EINA_SAFETY_ON_NULL_RETURN(epai); + + ELOGF("POL_APPINFO", "appinfo(%p) delete", NULL, epai); + + if (epai->appid) + eina_stringshare_del(epai->appid); + + appinfo_list = eina_list_remove(appinfo_list, epai); + + E_FREE(epai); +} + +EINTERN Eina_Bool +e_appinfo_pid_set(E_Appinfo *epai, pid_t pid) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(epai, EINA_FALSE); + EINA_SAFETY_ON_TRUE_RETURN_VAL(pid <= 0, EINA_FALSE); + + epai->pid = pid; + + ELOGF("POL_APPINFO", "appinfo(%p) set pid(%u)", NULL, epai, pid); + + _e_appinfo_hook_call(E_APPINFO_HOOK_PID_SET, epai->appid, pid); + + return EINA_TRUE; +} + +EINTERN Eina_Bool +e_appinfo_appid_set(E_Appinfo *epai, const char *appid) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(epai, EINA_FALSE); + EINA_SAFETY_ON_NULL_RETURN_VAL(appid, EINA_FALSE); + + if (epai->appid) + eina_stringshare_del(epai->appid); + + epai->appid = eina_stringshare_add(appid); + + ELOGF("POL_APPINFO", "appinfo(%p) set appid(%s)", NULL, epai, appid); + + _e_appinfo_hook_call(E_APPINFO_HOOK_PID_SET, epai->appid, epai->pid); + + return EINA_TRUE; +} + +EINTERN void +e_appinfo_ready_metadata(E_Appinfo *epai, pid_t pid) +{ + EINA_SAFETY_ON_NULL_RETURN(epai); + EINA_SAFETY_ON_TRUE_RETURN(pid < 0); + + if (epai->pid != pid) + e_appinfo_pid_set(epai, pid); + + _e_appinfo_hook_call(E_APPINFO_HOOK_METADATA_READY, epai->appid, epai->pid); +} + +EINTERN Eina_Bool +e_appinfo_base_output_resolution_get(E_Appinfo *epai, int *width, int *height) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(epai, EINA_FALSE); + EINA_SAFETY_ON_NULL_RETURN_VAL(width, EINA_FALSE); + EINA_SAFETY_ON_NULL_RETURN_VAL(height, EINA_FALSE); + + if (!epai->base_output_available) + { + *width = 0; + *height = 0; + return EINA_FALSE; + } + + *width = epai->base_output_width; + *height = epai->base_output_height; + + return EINA_TRUE; +} + +E_API E_Appinfo * +e_appinfo_find_with_pid(pid_t pid) +{ + E_Appinfo *epai = NULL; + Eina_List *l = NULL; + + EINA_SAFETY_ON_TRUE_RETURN_VAL(pid <= 0, NULL); + + EINA_LIST_FOREACH(appinfo_list, l, epai) + { + if (epai->pid == pid) + return epai; + } + + return NULL; +} + +E_API E_Appinfo * +e_appinfo_find_with_appid(const char *appid) +{ + E_Appinfo *epai = NULL; + Eina_List *l = NULL; + + EINA_SAFETY_ON_NULL_RETURN_VAL(appid, NULL); + + EINA_LIST_FOREACH(appinfo_list, l, epai) + { + if (!e_util_strcmp(epai->appid, appid)) + return epai; + } + + return NULL; +} + +E_API Eina_Bool +e_appinfo_base_output_resolution_set(E_Appinfo *epai, int width, int height) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(epai, EINA_FALSE); + EINA_SAFETY_ON_TRUE_RETURN_VAL(width < 0, EINA_FALSE); + EINA_SAFETY_ON_TRUE_RETURN_VAL(height < 0, EINA_FALSE); + + epai->base_output_width = width; + epai->base_output_height = height; + epai->base_output_available = EINA_TRUE; + + ELOGF("POL_APPINFO", "appinfo(%p) set base_output_resolution(%d, %d):(pid,%u)", NULL, epai, width, height, epai->pid); + + return EINA_TRUE; +} + +E_API E_Appinfo_Hook * +e_appinfo_hook_add(E_Appinfo_Hook_Point hookpoint, E_Appinfo_Hook_Cb cb, const void *data) +{ + E_Appinfo_Hook *hook; + + EINA_SAFETY_ON_TRUE_RETURN_VAL(hookpoint < 0, NULL); + EINA_SAFETY_ON_TRUE_RETURN_VAL(hookpoint >= E_APPINFO_HOOK_LAST, NULL); + + hook = E_NEW(E_Appinfo_Hook, 1); + EINA_SAFETY_ON_NULL_RETURN_VAL(hook, NULL); + + hook->hookpoint = hookpoint; + hook->func = cb; + hook->data = (void*)data; + + _appinfo_hooks[hookpoint] = eina_inlist_append(_appinfo_hooks[hookpoint], EINA_INLIST_GET(hook)); + + return hook; +} + +E_API void +e_appinfo_hook_del(E_Appinfo_Hook *hook) +{ + EINA_SAFETY_ON_NULL_RETURN(hook); + + hook->delete_me = 1; + if (_appinfo_hooks_walking == 0) + { + _appinfo_hooks[hook->hookpoint] = eina_inlist_remove(_appinfo_hooks[hook->hookpoint], EINA_INLIST_GET(hook)); + free(hook); + } + else + _appinfo_hooks_delete++; +} diff --git a/src/bin/e_appinfo.h b/src/bin/e_appinfo.h new file mode 100644 index 0000000000..efe7429664 --- /dev/null +++ b/src/bin/e_appinfo.h @@ -0,0 +1,41 @@ +#ifdef E_TYPEDEFS +typedef struct _E_Appinfo E_Appinfo; +#else +# ifndef E_APPINFO_H +# define E_APPINFO_H +typedef struct _E_Appinfo_Hook E_Appinfo_Hook; + +typedef enum _E_Appinfo_Hook_Point +{ + E_APPINFO_HOOK_APPID_SET, + E_APPINFO_HOOK_PID_SET, + E_APPINFO_HOOK_METADATA_READY, + E_APPINFO_HOOK_LAST, +} E_Appinfo_Hook_Point; + +typedef void (*E_Appinfo_Hook_Cb)(const char *appid, pid_t pid, void *data); + +struct _E_Appinfo_Hook +{ + EINA_INLIST; + E_Appinfo_Hook_Point hookpoint; + E_Appinfo_Hook_Cb func; + void *data; + unsigned char delete_me : 1; +}; + +EINTERN E_Appinfo *e_appinfo_new(void); +EINTERN void e_appinfo_del(E_Appinfo *epai); +EINTERN Eina_Bool e_appinfo_pid_set(E_Appinfo *epai, pid_t pid); +EINTERN Eina_Bool e_appinfo_appid_set(E_Appinfo *epai, const char *appid); +EINTERN void e_appinfo_ready_metadata(E_Appinfo *epai, pid_t pid); +EINTERN Eina_Bool e_appinfo_base_output_resolution_get(E_Appinfo *epai, int *width, int *height); + +E_API E_Appinfo *e_appinfo_find_with_pid(pid_t pid); +E_API E_Appinfo *e_appinfo_find_with_appid(const char *appid); +E_API Eina_Bool e_appinfo_base_output_resolution_set(E_Appinfo *epai, int width, int height); + +E_API E_Appinfo_Hook *e_appinfo_hook_add(E_Appinfo_Hook_Point point, E_Appinfo_Hook_Cb cb, const void *data); +E_API void e_appinfo_hook_del(E_Appinfo_Hook *hook); +# endif +#endif diff --git a/src/bin/e_client.c b/src/bin/e_client.c index 5f92aa5360..d05b685277 100644 --- a/src/bin/e_client.c +++ b/src/bin/e_client.c @@ -7467,7 +7467,7 @@ e_client_base_output_resolution_transform_adjust(E_Client *ec) E_API Eina_Bool e_client_base_output_resolution_update(E_Client *ec) { - E_Policy_Appinfo *epai = NULL; + E_Appinfo *epai = NULL; int configured_width, configured_height; int width, height; @@ -7493,7 +7493,7 @@ e_client_base_output_resolution_update(E_Client *ec) goto use_configured; } - epai = e_policy_appinfo_find_with_pid(ec->netwm.pid); + epai = e_appinfo_find_with_pid(ec->netwm.pid); if (!epai) { ELOGF("POL_APPINFO", "NO APPINFO... USE configured_output_resolution(%d,%d) pid:%d", ec, @@ -7501,7 +7501,7 @@ e_client_base_output_resolution_update(E_Client *ec) goto use_configured; } - if (!e_policy_appinfo_base_output_resolution_get(epai, &width, &height)) + if (!e_appinfo_base_output_resolution_get(epai, &width, &height)) { ELOGF("POL_APPINFO", "NO BASE SCREEN RESOLUTION... USE configured_output_resolution(%d,%d) pid:%d", ec, configured_width, configured_height, ec->netwm.pid); diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c index 4e508cac35..a3c739d7a6 100644 --- a/src/bin/e_comp_wl.c +++ b/src/bin/e_comp_wl.c @@ -3618,7 +3618,7 @@ _e_comp_wl_cb_output_bind(struct wl_client *client, void *data, uint32_t version { E_Comp_Wl_Output *output; struct wl_resource *resource; - E_Policy_Appinfo *epai = NULL; + E_Appinfo *epai = NULL; pid_t pid = 0; int res_w, res_h; @@ -3652,7 +3652,7 @@ _e_comp_wl_cb_output_bind(struct wl_client *client, void *data, uint32_t version goto send_info; } - epai = e_policy_appinfo_find_with_pid(pid); + epai = e_appinfo_find_with_pid(pid); if (!epai) { res_w = e_config->configured_output_resolution.w; @@ -3660,7 +3660,7 @@ _e_comp_wl_cb_output_bind(struct wl_client *client, void *data, uint32_t version goto send_info; } - if (!e_policy_appinfo_base_output_resolution_get(epai, &res_w, &res_h)) + if (!e_appinfo_base_output_resolution_get(epai, &res_w, &res_h)) { res_w = e_config->configured_output_resolution.w; res_h = e_config->configured_output_resolution.h; diff --git a/src/bin/e_includes.h b/src/bin/e_includes.h index b36ee1f36d..1e5d3e70be 100644 --- a/src/bin/e_includes.h +++ b/src/bin/e_includes.h @@ -71,7 +71,7 @@ #include "e_policy.h" #include "e_policy_conformant.h" #include "e_policy_visibility.h" -#include "e_policy_appinfo.h" +#include "e_appinfo.h" #include "e_magnifier.h" #include "e_process.h" #include "e_splitlayout.h" diff --git a/src/bin/e_policy_appinfo.c b/src/bin/e_policy_appinfo.c deleted file mode 100644 index 0c18bcf248..0000000000 --- a/src/bin/e_policy_appinfo.c +++ /dev/null @@ -1,239 +0,0 @@ -#include "e.h" -#include "e_policy_appinfo.h" - -static Eina_List *appinfo_list; - -static int _appinfo_hooks_walking = 0; -static int _appinfo_hooks_delete = 0; - -static Eina_Inlist *_appinfo_hooks[] = -{ - [E_POLICY_APPINFO_HOOK_APPID_SET] = NULL, - [E_POLICY_APPINFO_HOOK_PID_SET] = NULL, - [E_POLICY_APPINFO_HOOK_METADATA_READY] = NULL, -}; - -struct _E_Policy_Appinfo -{ - pid_t pid; - Eina_Stringshare *appid; - Eina_Bool base_output_available; - int base_output_width; - int base_output_height; -}; - -static void -_e_policy_appinfo_hooks_clean(void) -{ - Eina_Inlist *l; - E_Policy_Appinfo_Hook *hook; - unsigned int x; - - for (x = 0; x < E_POLICY_APPINFO_HOOK_LAST; x++) - EINA_INLIST_FOREACH_SAFE(_appinfo_hooks[x], l, hook) - { - if (!hook->delete_me) continue; - _appinfo_hooks[x] = eina_inlist_remove(_appinfo_hooks[x], EINA_INLIST_GET(hook)); - free(hook); - } -} - -static void -_e_policy_appinfo_hook_call(E_Policy_Appinfo_Hook_Point hookpoint, const char* appid, pid_t pid) -{ - E_Policy_Appinfo_Hook *hook; - - _appinfo_hooks_walking++; - EINA_INLIST_FOREACH(_appinfo_hooks[hookpoint], hook) - { - if (hook->delete_me) continue; - hook->func(appid, pid, hook->data); - } - _appinfo_hooks_walking--; - if ((_appinfo_hooks_walking == 0) && (_appinfo_hooks_delete) > 0) - _e_policy_appinfo_hooks_clean(); -} - - -EINTERN E_Policy_Appinfo * -e_policy_appinfo_new(void) -{ - E_Policy_Appinfo *epai = NULL; - - epai = E_NEW(E_Policy_Appinfo, 1); - EINA_SAFETY_ON_NULL_RETURN_VAL(epai, NULL); - - epai->pid = -1; - epai->appid = NULL; - - appinfo_list = eina_list_append(appinfo_list, epai); - - ELOGF("POL_APPINFO", "appinfo(%p) create", NULL, epai); - - return epai; -} - -EINTERN void -e_policy_appinfo_del(E_Policy_Appinfo *epai) -{ - EINA_SAFETY_ON_NULL_RETURN(epai); - - ELOGF("POL_APPINFO", "appinfo(%p) delete", NULL, epai); - - if (epai->appid) - eina_stringshare_del(epai->appid); - - appinfo_list = eina_list_remove(appinfo_list, epai); - - E_FREE(epai); -} - -EINTERN Eina_Bool -e_policy_appinfo_pid_set(E_Policy_Appinfo *epai, pid_t pid) -{ - EINA_SAFETY_ON_NULL_RETURN_VAL(epai, EINA_FALSE); - EINA_SAFETY_ON_TRUE_RETURN_VAL(pid <= 0, EINA_FALSE); - - epai->pid = pid; - - ELOGF("POL_APPINFO", "appinfo(%p) set pid(%u)", NULL, epai, pid); - - _e_policy_appinfo_hook_call(E_POLICY_APPINFO_HOOK_PID_SET, epai->appid, pid); - - return EINA_TRUE; -} - -EINTERN Eina_Bool -e_policy_appinfo_appid_set(E_Policy_Appinfo *epai, const char *appid) -{ - EINA_SAFETY_ON_NULL_RETURN_VAL(epai, EINA_FALSE); - EINA_SAFETY_ON_NULL_RETURN_VAL(appid, EINA_FALSE); - - if (epai->appid) - eina_stringshare_del(epai->appid); - - epai->appid = eina_stringshare_add(appid); - - ELOGF("POL_APPINFO", "appinfo(%p) set appid(%s)", NULL, epai, appid); - - _e_policy_appinfo_hook_call(E_POLICY_APPINFO_HOOK_PID_SET, epai->appid, epai->pid); - - return EINA_TRUE; -} - -EINTERN void -e_policy_appinfo_ready_metadata(E_Policy_Appinfo *epai, pid_t pid) -{ - EINA_SAFETY_ON_NULL_RETURN(epai); - EINA_SAFETY_ON_TRUE_RETURN(pid < 0); - - if (epai->pid != pid) - e_policy_appinfo_pid_set(epai, pid); - - _e_policy_appinfo_hook_call(E_POLICY_APPINFO_HOOK_METADATA_READY, epai->appid, epai->pid); -} - -EINTERN Eina_Bool -e_policy_appinfo_base_output_resolution_get(E_Policy_Appinfo *epai, int *width, int *height) -{ - EINA_SAFETY_ON_NULL_RETURN_VAL(epai, EINA_FALSE); - EINA_SAFETY_ON_NULL_RETURN_VAL(width, EINA_FALSE); - EINA_SAFETY_ON_NULL_RETURN_VAL(height, EINA_FALSE); - - if (!epai->base_output_available) - { - *width = 0; - *height = 0; - return EINA_FALSE; - } - - *width = epai->base_output_width; - *height = epai->base_output_height; - - return EINA_TRUE; -} - -E_API E_Policy_Appinfo * -e_policy_appinfo_find_with_pid(pid_t pid) -{ - E_Policy_Appinfo *epai = NULL; - Eina_List *l = NULL; - - EINA_SAFETY_ON_TRUE_RETURN_VAL(pid <= 0, NULL); - - EINA_LIST_FOREACH(appinfo_list, l, epai) - { - if (epai->pid == pid) - return epai; - } - - return NULL; -} - -E_API E_Policy_Appinfo * -e_policy_appinfo_find_with_appid(const char *appid) -{ - E_Policy_Appinfo *epai = NULL; - Eina_List *l = NULL; - - EINA_SAFETY_ON_NULL_RETURN_VAL(appid, NULL); - - EINA_LIST_FOREACH(appinfo_list, l, epai) - { - if (!e_util_strcmp(epai->appid, appid)) - return epai; - } - - return NULL; -} - -E_API Eina_Bool -e_policy_appinfo_base_output_resolution_set(E_Policy_Appinfo *epai, int width, int height) -{ - EINA_SAFETY_ON_NULL_RETURN_VAL(epai, EINA_FALSE); - EINA_SAFETY_ON_TRUE_RETURN_VAL(width < 0, EINA_FALSE); - EINA_SAFETY_ON_TRUE_RETURN_VAL(height < 0, EINA_FALSE); - - epai->base_output_width = width; - epai->base_output_height = height; - epai->base_output_available = EINA_TRUE; - - ELOGF("POL_APPINFO", "appinfo(%p) set base_output_resolution(%d, %d):(pid,%u)", NULL, epai, width, height, epai->pid); - - return EINA_TRUE; -} - -E_API E_Policy_Appinfo_Hook * -e_policy_appinfo_hook_add(E_Policy_Appinfo_Hook_Point hookpoint, E_Policy_Appinfo_Hook_Cb cb, const void *data) -{ - E_Policy_Appinfo_Hook *hook; - - EINA_SAFETY_ON_TRUE_RETURN_VAL(hookpoint < 0, NULL); - EINA_SAFETY_ON_TRUE_RETURN_VAL(hookpoint >= E_POLICY_APPINFO_HOOK_LAST, NULL); - - hook = E_NEW(E_Policy_Appinfo_Hook, 1); - EINA_SAFETY_ON_NULL_RETURN_VAL(hook, NULL); - - hook->hookpoint = hookpoint; - hook->func = cb; - hook->data = (void*)data; - - _appinfo_hooks[hookpoint] = eina_inlist_append(_appinfo_hooks[hookpoint], EINA_INLIST_GET(hook)); - - return hook; -} - -E_API void -e_policy_appinfo_hook_del(E_Policy_Appinfo_Hook *hook) -{ - EINA_SAFETY_ON_NULL_RETURN(hook); - - hook->delete_me = 1; - if (_appinfo_hooks_walking == 0) - { - _appinfo_hooks[hook->hookpoint] = eina_inlist_remove(_appinfo_hooks[hook->hookpoint], EINA_INLIST_GET(hook)); - free(hook); - } - else - _appinfo_hooks_delete++; -} diff --git a/src/bin/e_policy_appinfo.h b/src/bin/e_policy_appinfo.h index 1cc41e1443..a6ded0019b 100644 --- a/src/bin/e_policy_appinfo.h +++ b/src/bin/e_policy_appinfo.h @@ -1,41 +1,4 @@ -#ifdef E_TYPEDEFS -typedef struct _E_Policy_Appinfo E_Policy_Appinfo; -#else -# ifndef E_POLICY_APPINFO_H -# define E_POLICY_APPINFO_H -typedef struct _E_Policy_Appinfo_Hook E_Policy_Appinfo_Hook; - -typedef enum _E_Policy_Appinfo_Hook_Point -{ - E_POLICY_APPINFO_HOOK_APPID_SET, - E_POLICY_APPINFO_HOOK_PID_SET, - E_POLICY_APPINFO_HOOK_METADATA_READY, - E_POLICY_APPINFO_HOOK_LAST, -} E_Policy_Appinfo_Hook_Point; - -typedef void (*E_Policy_Appinfo_Hook_Cb)(const char *appid, pid_t pid, void *data); - -struct _E_Policy_Appinfo_Hook -{ - EINA_INLIST; - E_Policy_Appinfo_Hook_Point hookpoint; - E_Policy_Appinfo_Hook_Cb func; - void *data; - unsigned char delete_me : 1; -}; - -EINTERN E_Policy_Appinfo *e_policy_appinfo_new(void); -EINTERN void e_policy_appinfo_del(E_Policy_Appinfo *epai); -EINTERN Eina_Bool e_policy_appinfo_pid_set(E_Policy_Appinfo *epai, pid_t pid); -EINTERN Eina_Bool e_policy_appinfo_appid_set(E_Policy_Appinfo *epai, const char *appid); -EINTERN void e_policy_appinfo_ready_metadata(E_Policy_Appinfo *epai, pid_t pid); -EINTERN Eina_Bool e_policy_appinfo_base_output_resolution_get(E_Policy_Appinfo *epai, int *width, int *height); - -E_API E_Policy_Appinfo *e_policy_appinfo_find_with_pid(pid_t pid); -E_API E_Policy_Appinfo *e_policy_appinfo_find_with_appid(const char *appid); -E_API Eina_Bool e_policy_appinfo_base_output_resolution_set(E_Policy_Appinfo *epai, int width, int height); - -E_API E_Policy_Appinfo_Hook *e_policy_appinfo_hook_add(E_Policy_Appinfo_Hook_Point point, E_Policy_Appinfo_Hook_Cb cb, const void *data); -E_API void e_policy_appinfo_hook_del(E_Policy_Appinfo_Hook *hook); -# endif +#ifndef _E_POLICY_APPINFO_H +# define _E_POLICY_APPINFO_H +# include "e_appinfo.h" #endif diff --git a/src/bin/e_policy_wl.c b/src/bin/e_policy_wl.c index 7de1af135c..8318e99262 100644 --- a/src/bin/e_policy_wl.c +++ b/src/bin/e_policy_wl.c @@ -11,7 +11,7 @@ #include "e_policy_wl_display.h" #include "e_policy_conformant_internal.h" #include "e_policy_visibility.h" -#include "e_policy_appinfo.h" +#include "e_appinfo.h" #include #include @@ -3318,21 +3318,21 @@ static void _tzpol_iface_cb_set_appid(struct wl_client *client, struct wl_resource *res_tzpol, int32_t pid, const char *appid) { E_Policy_Wl_Tzpol *tzpol; - E_Policy_Appinfo *appinfo; + E_Appinfo *appinfo; tzpol = _e_policy_wl_tzpol_get(res_tzpol); EINA_SAFETY_ON_NULL_RETURN(tzpol); ELOGF("TZPOL", "Set appid(%s) pid(%d)", NULL, appid, pid); - if (!(appinfo = e_policy_appinfo_find_with_appid(appid))) + if (!(appinfo = e_appinfo_find_with_appid(appid))) { - appinfo = e_policy_appinfo_new(); - e_policy_appinfo_appid_set(appinfo, appid); + appinfo = e_appinfo_new(); + e_appinfo_appid_set(appinfo, appid); } EINA_SAFETY_ON_NULL_RETURN(appinfo); - e_policy_appinfo_pid_set(appinfo, pid); + e_appinfo_pid_set(appinfo, pid); } // -------------------------------------------------------- @@ -6642,7 +6642,7 @@ _tzlaunch_appinfo_iface_cb_register_pid(struct wl_client *client, struct wl_reso uint32_t pid) { E_Policy_Wl_Tzlaunch_Appinfo *appinfo = NULL; - E_Policy_Appinfo *epai = NULL; + E_Appinfo *epai = NULL; appinfo = wl_resource_get_user_data(res_tzlaunch_appinfo); if (!appinfo) @@ -6659,13 +6659,13 @@ _tzlaunch_appinfo_iface_cb_register_pid(struct wl_client *client, struct wl_reso return; } - epai = e_policy_appinfo_new(); + epai = e_appinfo_new(); EINA_SAFETY_ON_NULL_RETURN(epai); - if (!e_policy_appinfo_pid_set(epai, pid)) + if (!e_appinfo_pid_set(epai, pid)) { ELOGF("TZ_APPINFO", "failed to set pid is invalid. pid:%u", NULL, pid); - e_policy_appinfo_del(epai); + e_appinfo_del(epai); return; } } @@ -6675,7 +6675,7 @@ _tzlaunch_appinfo_iface_cb_deregister_pid(struct wl_client *client, struct wl_re uint32_t pid) { E_Policy_Wl_Tzlaunch_Appinfo *appinfo = NULL; - E_Policy_Appinfo *epai = NULL; + E_Appinfo *epai = NULL; appinfo = wl_resource_get_user_data(res_tzlaunch_appinfo); if (!appinfo) @@ -6686,10 +6686,10 @@ _tzlaunch_appinfo_iface_cb_deregister_pid(struct wl_client *client, struct wl_re return; } - epai = e_policy_appinfo_find_with_pid(pid); + epai = e_appinfo_find_with_pid(pid); EINA_SAFETY_ON_NULL_RETURN(epai); - e_policy_appinfo_del(epai); + e_appinfo_del(epai); } static void @@ -6697,7 +6697,7 @@ _tzlaunch_appinfo_iface_cb_set_appid(struct wl_client *client, struct wl_resourc uint32_t pid, const char *appid) { E_Policy_Wl_Tzlaunch_Appinfo *tzlaunch_appinfo = NULL; - E_Policy_Appinfo *epai = NULL; + E_Appinfo *epai = NULL; int width = 0; int height = 0; @@ -6716,10 +6716,10 @@ _tzlaunch_appinfo_iface_cb_set_appid(struct wl_client *client, struct wl_resourc return; } - epai = e_policy_appinfo_find_with_pid(pid); + epai = e_appinfo_find_with_pid(pid); EINA_SAFETY_ON_NULL_RETURN(epai); - if (!e_policy_appinfo_appid_set(epai, appid)) + if (!e_appinfo_appid_set(epai, appid)) { ELOGF("TZ_APPINFO", "failed to set appid, appid:%s", NULL, appid); return; @@ -6728,12 +6728,12 @@ _tzlaunch_appinfo_iface_cb_set_appid(struct wl_client *client, struct wl_resourc // 1. send HOOK with pid _e_policy_wl_hook_call(E_POLICY_WL_HOOK_BASE_OUTPUT_RESOLUTION_GET, pid); // 2. module must set the base_output_resolution. - if (!e_policy_appinfo_base_output_resolution_get(epai, &width, &height)) + if (!e_appinfo_base_output_resolution_get(epai, &width, &height)) { ELOGF("TZ_APPINFO", "failed to set base_output_resolution in module, pid:%u, appid:%s", NULL, pid, appid); return; } - // 3. server has to get the base_screern_resolution via e_policy_appinfo_base_output_resolution_get. + // 3. server has to get the base_screern_resolution via e_appinfo_base_output_resolution_get. // 3-1. if success, use the base_rescreen_resolution // 3-2. if fail, get the base_output_resolution from the E_Comp_Wl_Output. @@ -6757,7 +6757,7 @@ static void _tzlaunch_appinfo_iface_cb_get_base_output_resolution(struct wl_client *client, struct wl_resource *res_tzlaunch_appinfo, uint32_t pid) { - E_Policy_Appinfo *epai = NULL; + E_Appinfo *epai = NULL; int width = 0, height = 0; if (pid <= 0) @@ -6766,14 +6766,14 @@ _tzlaunch_appinfo_iface_cb_get_base_output_resolution(struct wl_client *client, goto err; } - epai = e_policy_appinfo_find_with_pid(pid); + epai = e_appinfo_find_with_pid(pid); if (!epai) { ELOGF("TZ_APPINFO", "cannot find pid. pid:%u", NULL, pid); goto err; } - if (!e_policy_appinfo_base_output_resolution_get(epai, &width, &height)) + if (!e_appinfo_base_output_resolution_get(epai, &width, &height)) { ELOGF("TZ_APPINFO", "cannot read size. pid:%u", NULL, pid); goto err; @@ -6799,7 +6799,7 @@ _tzlaunch_appinfo_iface_cb_register_appid(struct wl_client *client, struct wl_re const char *appid) { E_Policy_Wl_Tzlaunch_Appinfo *appinfo = NULL; - E_Policy_Appinfo *epai = NULL; + E_Appinfo *epai = NULL; appinfo = wl_resource_get_user_data(res_tzlaunch_appinfo); if (!appinfo) @@ -6810,19 +6810,19 @@ _tzlaunch_appinfo_iface_cb_register_appid(struct wl_client *client, struct wl_re return; } - if ((epai = e_policy_appinfo_find_with_appid(appid))) + if ((epai = e_appinfo_find_with_appid(appid))) { ELOGF("TZ_APPINFO", "appid:%s is already registered!", NULL, appid); return; } - epai = e_policy_appinfo_new(); + epai = e_appinfo_new(); EINA_SAFETY_ON_NULL_RETURN(epai); - if (!e_policy_appinfo_appid_set(epai, appid)) + if (!e_appinfo_appid_set(epai, appid)) { ELOGF("TZ_APPINFO", "Failed to register appid:%s", NULL, appid); - e_policy_appinfo_del(epai); + e_appinfo_del(epai); return; } } @@ -6832,7 +6832,7 @@ _tzlaunch_appinfo_iface_cb_deregister_appid(struct wl_client *client, struct wl_ const char *appid) { E_Policy_Wl_Tzlaunch_Appinfo *appinfo = NULL; - E_Policy_Appinfo *epai = NULL; + E_Appinfo *epai = NULL; appinfo = wl_resource_get_user_data(res_tzlaunch_appinfo); if (!appinfo) @@ -6843,10 +6843,10 @@ _tzlaunch_appinfo_iface_cb_deregister_appid(struct wl_client *client, struct wl_ return; } - epai = e_policy_appinfo_find_with_appid(appid); + epai = e_appinfo_find_with_appid(appid); EINA_SAFETY_ON_NULL_RETURN(epai); - e_policy_appinfo_del(epai); + e_appinfo_del(epai); } static void @@ -6854,7 +6854,7 @@ _tzlaunch_appinfo_iface_cb_set_pid(struct wl_client *client, struct wl_resource const char *appid, uint32_t pid) { E_Policy_Wl_Tzlaunch_Appinfo *appinfo = NULL; - E_Policy_Appinfo *epai = NULL; + E_Appinfo *epai = NULL; appinfo = wl_resource_get_user_data(res_tzlaunch_appinfo); if (!appinfo) @@ -6865,10 +6865,10 @@ _tzlaunch_appinfo_iface_cb_set_pid(struct wl_client *client, struct wl_resource return; } - epai = e_policy_appinfo_find_with_appid(appid); + epai = e_appinfo_find_with_appid(appid); EINA_SAFETY_ON_NULL_RETURN(epai); - if (!e_policy_appinfo_pid_set(epai, pid)) + if (!e_appinfo_pid_set(epai, pid)) { ELOGF("TZ_APPINFO", "Failed to set pid:%u for appid:%s", NULL, pid, appid); return; @@ -6880,7 +6880,7 @@ _tzlaunch_appinfo_iface_cb_ready_metadata(struct wl_client *client, struct wl_re const char *appid, uint32_t pid) { E_Policy_Wl_Tzlaunch_Appinfo *appinfo = NULL; - E_Policy_Appinfo *epai = NULL; + E_Appinfo *epai = NULL; int width = 0, height = 0; appinfo = wl_resource_get_user_data(res_tzlaunch_appinfo); @@ -6892,22 +6892,22 @@ _tzlaunch_appinfo_iface_cb_ready_metadata(struct wl_client *client, struct wl_re return; } - epai = e_policy_appinfo_find_with_appid(appid); + epai = e_appinfo_find_with_appid(appid); EINA_SAFETY_ON_NULL_RETURN(epai); - e_policy_appinfo_ready_metadata(epai, pid); + e_appinfo_ready_metadata(epai, pid); /* about base output resolution */ // 1. send HOOK with pid _e_policy_wl_hook_call(E_POLICY_WL_HOOK_BASE_OUTPUT_RESOLUTION_GET, pid); // 2. module must set the base_output_resolution. - if (!e_policy_appinfo_base_output_resolution_get(epai, &width, &height)) + if (!e_appinfo_base_output_resolution_get(epai, &width, &height)) { ELOGF("TZ_APPINFO", "failed to set base_output_resolution in module, pid:%u, appid:%s", NULL, pid, appid); return; } - // 3. server has to get the base_screern_resolution via e_policy_appinfo_base_output_resolution_get. + // 3. server has to get the base_screern_resolution via e_appinfo_base_output_resolution_get. // 3-1. if success, use the base_rescreen_resolution // 3-2. if fail, get the base_output_resolution from the E_Comp_Wl_Output. diff --git a/src/bin/services/e_service_launcher.c b/src/bin/services/e_service_launcher.c index 622b395127..91ee84db81 100644 --- a/src/bin/services/e_service_launcher.c +++ b/src/bin/services/e_service_launcher.c @@ -57,7 +57,7 @@ struct _E_Service_Launcher_Handler Eina_List *hooks_ec; //hook list for E_CLIENT_HOOK_* Eina_List *hooks_vis; //hook list for E_POL_VIS_HOOK_TYPE_* Eina_List *hooks_co; //hook list for E_COMP_OBJECT_INTERCEPT_HOOK_* - Eina_List *hooks_appinfo; //hook list for E_POLICY_APPINFO_HOOK_* + Eina_List *hooks_appinfo; //hook list for E_APPINFO_HOOK_* Eina_List *hdlrs_ev; //handler list for ecore event E_Service_Launcher *runner; //current runner(running launcher) @@ -1721,8 +1721,8 @@ _launcher_handler_create(void) _launcher_handler_cb_hook_intercept_show_helper, NULL); LAUNCHER_HANDLER_CB_ADD(laundler->hooks_appinfo, - e_policy_appinfo_hook_add, - E_POLICY_APPINFO_HOOK_PID_SET, + e_appinfo_hook_add, + E_APPINFO_HOOK_PID_SET, _launcher_handler_cb_hook_appinfo_pid_set, NULL); LAUNCHER_HANDLER_CB_ADD(laundler->hdlrs_ev, @@ -1741,7 +1741,7 @@ _launcher_handler_destroy(E_Service_Launcher_Handler *laundler) EINA_SAFETY_ON_NULL_RETURN(laundler); E_FREE_LIST(laundler->hdlrs_ev, ecore_event_handler_del); - E_FREE_LIST(laundler->hooks_appinfo, e_policy_appinfo_hook_del); + E_FREE_LIST(laundler->hooks_appinfo, e_appinfo_hook_del); E_FREE_LIST(laundler->hooks_co, e_comp_object_intercept_hook_del); E_FREE_LIST(laundler->hooks_ec, e_client_hook_del); E_FREE_LIST(laundler->hooks_vis, e_policy_visibility_hook_del);