From: SungBae, Park Date: Wed, 6 Jan 2016 04:11:49 +0000 (+0900) Subject: Aux hint api and hook add X-Git-Tag: submit/tizen/20160121.104248~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ff1c2a3a105b25481a0cb67337fd5f1535f16eb0;p=platform%2Fupstream%2Fenlightenment.git Aux hint api and hook add Change-Id: I17e3a135a827bd49d7185309c194506129dc55ed --- diff --git a/src/bin/e_client.c b/src/bin/e_client.c index 65719a864b..e1c975a598 100644 --- a/src/bin/e_client.c +++ b/src/bin/e_client.c @@ -95,6 +95,7 @@ static Eina_Inlist *_e_client_hooks[] = [E_CLIENT_HOOK_EVAL_VISIBILITY] = NULL, [E_CLIENT_HOOK_ICONIFY] = NULL, [E_CLIENT_HOOK_UNICONIFY] = NULL, + [E_CLIENT_HOOK_AUX_HINT_CHANGE] = NULL, }; /////////////////////////////////////////// @@ -2638,6 +2639,19 @@ _e_client_eval(E_Client *ec) { _e_client_event_property(ec, prop); } + +#ifdef HAVE_WAYLAND_ONLY + { + E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data*)ec->comp_data; + + if (cdata && cdata->aux_hint.changed) + { + _e_client_hook_call(E_CLIENT_HOOK_AUX_HINT_CHANGE, ec); + cdata->aux_hint.changed = 0; + } + } +#endif + _e_client_hook_call(E_CLIENT_HOOK_EVAL_END, ec); } @@ -3170,6 +3184,18 @@ e_client_new(E_Pixmap *cp, int first_map, int internal) return NULL; } +#ifdef HAVE_WAYLAND_ONLY + { + E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data*)ec->comp_data; + + if (cdata && cdata->aux_hint.changed) + { + _e_client_hook_call(E_CLIENT_HOOK_AUX_HINT_CHANGE, ec); + cdata->aux_hint.changed = 0; + } + } +#endif + if (ec->override) _e_client_zone_update(ec); else diff --git a/src/bin/e_client.h b/src/bin/e_client.h index b60f5adbb8..e05d471940 100644 --- a/src/bin/e_client.h +++ b/src/bin/e_client.h @@ -221,6 +221,7 @@ typedef enum _E_Client_Hook_Point E_CLIENT_HOOK_EVAL_VISIBILITY, E_CLIENT_HOOK_ICONIFY, E_CLIENT_HOOK_UNICONIFY, + E_CLIENT_HOOK_AUX_HINT_CHANGE, E_CLIENT_HOOK_LAST, } E_Client_Hook_Point; diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c index 31bf9dfa0a..bc08153a78 100644 --- a/src/bin/e_comp_wl.c +++ b/src/bin/e_comp_wl.c @@ -3447,7 +3447,7 @@ _e_comp_wl_client_cb_new(void *data EINA_UNUSED, E_Client *ec) EINA_SAFETY_ON_NULL_RETURN(p_cdata); ec->comp_data->accepts_focus = p_cdata->accepts_focus; ec->comp_data->conformant = p_cdata->conformant; - ec->comp_data->aux_hint.hints = p_cdata->aux_hint.hints; + ec->comp_data->aux_hint = p_cdata->aux_hint; ec->comp_data->win_type = p_cdata->win_type; ec->comp_data->layer = p_cdata->layer; ec->comp_data->fetch.win_type = p_cdata->fetch.win_type; diff --git a/src/bin/e_comp_wl.h b/src/bin/e_comp_wl.h index d83018ad88..6d3a5c6ee3 100644 --- a/src/bin/e_comp_wl.h +++ b/src/bin/e_comp_wl.h @@ -395,6 +395,7 @@ struct _E_Comp_Wl_Client_Data struct { + Eina_Bool changed : 1; Eina_List *hints; } aux_hint; diff --git a/src/bin/e_hints.c b/src/bin/e_hints.c index 7ee53c4782..0c77055f9d 100644 --- a/src/bin/e_hints.c +++ b/src/bin/e_hints.c @@ -1773,3 +1773,183 @@ e_hints_aux_hint_supported_get(void) { return aux_hints_supported; } + +EAPI Eina_Bool +e_hints_aux_hint_add(E_Client *ec, int32_t id, const char *name, const char *val) +{ + if (!ec) return EINA_FALSE; + return e_hints_aux_hint_add_with_pixmap(ec->pixmap, id, name, val); +} + +EAPI Eina_Bool +e_hints_aux_hint_change(E_Client *ec, int32_t id, const char *val) +{ + if (!ec) return EINA_FALSE; + return e_hints_aux_hint_change_with_pixmap(ec->pixmap, id, val); +} + +EAPI Eina_Bool +e_hints_aux_hint_del(E_Client *ec, int32_t id) +{ + if (!ec) return EINA_FALSE; + return e_hints_aux_hint_del_with_pixmap(ec->pixmap, id); +} + +EAPI const char * +e_hints_aux_hint_value_get(E_Client *ec, const char *name) +{ + if (!ec) return NULL; + return e_hints_aux_hint_value_get_with_pixmap(ec->pixmap, name); +} + +EAPI Eina_Bool +e_hints_aux_hint_add_with_pixmap(E_Pixmap *cp, int32_t id, const char *name, const char *val) +{ +#ifdef HAVE_WAYLAND_ONLY + E_Comp_Wl_Client_Data *cdata; + Eina_Bool found = EINA_FALSE; + E_Comp_Wl_Aux_Hint *hint; + Eina_List *l; + + if (!cp) return EINA_FALSE; + cdata = e_pixmap_cdata_get(cp); + if (!cdata) return EINA_FALSE; + + EINA_LIST_FOREACH(cdata->aux_hint.hints, l, hint) + { + if (hint->id == id) + { + if (strcmp(hint->val, val) != 0) + { + ELOGF("COMP", "AUX_HINT |Change [pixmap = %d] [%d:%s:%s -> %s]", cp, e_pixmap_client_get(cp), + id, hint->hint, hint->val, val); + eina_stringshare_del(hint->val); + hint->val = eina_stringshare_add(val); + cdata->aux_hint.changed = 1; + } + found = EINA_TRUE; + break; + } + } + + if (!found) + { + hint = E_NEW(E_Comp_Wl_Aux_Hint, 1); + memset(hint, 0, sizeof(E_Comp_Wl_Aux_Hint)); + if (hint) + { + hint->id = id; + hint->hint = eina_stringshare_add(name); + hint->val = eina_stringshare_add(val); + cdata->aux_hint.hints = eina_list_append(cdata->aux_hint.hints, hint); + cdata->aux_hint.changed = 1; + ELOGF("COMP", "AUX_HINT |Add [%d:%s:%s]", cp, e_pixmap_client_get(cp), + id, hint->hint, hint->val); + } + } + + if (!found) + return EINA_TRUE; + return EINA_FALSE; +#endif + + return EINA_FALSE; +} + +EAPI Eina_Bool +e_hints_aux_hint_change_with_pixmap(E_Pixmap *cp, int32_t id, const char *val) +{ +#ifdef HAVE_WAYLAND_ONLY + E_Comp_Wl_Client_Data *cdata; + Eina_List *l; + E_Comp_Wl_Aux_Hint *hint; + Eina_Bool found = EINA_FALSE; + + if (!cp) return EINA_FALSE; + cdata = e_pixmap_cdata_get(cp); + if (!cdata) return EINA_FALSE; + + EINA_LIST_FOREACH(cdata->aux_hint.hints, l, hint) + { + if (hint->id == id) + { + if ((hint->val) && (strcmp(hint->val, val) != 0)) + { + ELOGF("COMP", "AUX_HINT |Change [%d:%s:%s -> %s]", cp, e_pixmap_client_get(cp), + id, hint->hint, hint->val, val); + eina_stringshare_del(hint->val); + hint->val = eina_stringshare_add(val); + cdata->aux_hint.changed = 1; + } + found = EINA_TRUE; + break; + } + } + + if (found) + return EINA_TRUE; + return EINA_FALSE; +#endif + return EINA_FALSE; +} + +EAPI Eina_Bool +e_hints_aux_hint_del_with_pixmap(E_Pixmap *cp, int32_t id) +{ +#ifdef HAVE_WAYLAND_ONLY + E_Comp_Wl_Client_Data *cdata; + Eina_List *l, *ll; + E_Comp_Wl_Aux_Hint *hint; + unsigned int res = -1; + + if (!cp) return EINA_FALSE; + cdata = e_pixmap_cdata_get(cp); + if (!cdata) return EINA_FALSE; + + EINA_LIST_FOREACH_SAFE(cdata->aux_hint.hints, l, ll, hint) + { + if (hint->id == id) + { + ELOGF("COMP", "AUX_HINT |Del [%d:%s:%s]", cp, e_pixmap_client_get(cp), id, hint->hint, hint->val); + if (hint->hint) eina_stringshare_del(hint->hint); + if (hint->val) eina_stringshare_del(hint->val); + cdata->aux_hint.hints = eina_list_remove_list(cdata->aux_hint.hints, l); + cdata->aux_hint.changed = 1; + res = hint->id; + E_FREE(hint); + break; + } + } + + return !!res; +#endif + + return EINA_FALSE; +} + +EAPI const char * +e_hints_aux_hint_value_get_with_pixmap(E_Pixmap *cp, const char *name) +{ +#ifdef HAVE_WAYLAND_ONLY + E_Comp_Wl_Client_Data *cdata; + Eina_List *l; + E_Comp_Wl_Aux_Hint *hint; + const char *res = NULL; + + if (!cp) return NULL; + cdata = e_pixmap_cdata_get(cp); + if (!cdata) return NULL; + + EINA_LIST_FOREACH(cdata->aux_hint.hints, l, hint) + { + if (!strcmp(hint->hint, name)) + { + res = hint->val; + break; + } + } + + return res; +#endif + return NULL; +} diff --git a/src/bin/e_hints.h b/src/bin/e_hints.h index ffc672b4f6..f3ddf7ea7c 100644 --- a/src/bin/e_hints.h +++ b/src/bin/e_hints.h @@ -50,6 +50,16 @@ E_API const Eina_List * e_hints_aux_hint_supported_add(const char *hint); E_API const Eina_List * e_hints_aux_hint_supported_del(const char *hint); E_API const Eina_List * e_hints_aux_hint_supported_get(void); +EAPI Eina_Bool e_hints_aux_hint_add(E_Client *ec, int32_t id, const char *name, const char *val); +EAPI Eina_Bool e_hints_aux_hint_change(E_Client *ec, int32_t id, const char *val); +EAPI Eina_Bool e_hints_aux_hint_del(E_Client *ec, int32_t id); +EAPI const char * e_hints_aux_hint_value_get(E_Client *ec, const char *name); + +EAPI Eina_Bool e_hints_aux_hint_add_with_pixmap(E_Pixmap *cp, int32_t id, const char *name, const char *val); +EAPI Eina_Bool e_hints_aux_hint_change_with_pixmap(E_Pixmap *cp, int32_t id, const char *val); +EAPI Eina_Bool e_hints_aux_hint_del_with_pixmap(E_Pixmap *cp, int32_t id); +EAPI const char * e_hints_aux_hint_value_get_with_pixmap(E_Pixmap *cp, const char *name); + #ifdef E_COMP_X_H E_API void e_hints_window_state_update(E_Client *ec, int state, int action); extern E_API Ecore_X_Atom ATM__QTOPIA_SOFT_MENU;