From e8ef45befb37d6ca5d7d209dd071ba70958966c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Briano?= Date: Mon, 4 Oct 2010 16:55:32 +0000 Subject: [PATCH] Focus highlight kinda configurable. More to come when discomfitor feels like implementing it SVN revision: 53031 --- legacy/elementary/config/default/base.src | 2 + legacy/elementary/config/illume/base.src | 2 + legacy/elementary/config/standard/base.src | 2 + legacy/elementary/src/lib/Elementary.h.in | 5 +++ legacy/elementary/src/lib/elm_config.c | 10 +++++ legacy/elementary/src/lib/elm_main.c | 52 ++++++++++++++++++++++ legacy/elementary/src/lib/elm_priv.h | 2 + legacy/elementary/src/lib/elm_win.c | 10 ++++- 8 files changed, 83 insertions(+), 2 deletions(-) diff --git a/legacy/elementary/config/default/base.src b/legacy/elementary/config/default/base.src index 183154e964..6a697443a1 100644 --- a/legacy/elementary/config/default/base.src +++ b/legacy/elementary/config/default/base.src @@ -22,4 +22,6 @@ group "Elm_Config" struct { value "modules" string: ""; value "tooltip_delay" double: 1.0; value "cursor_engine_only" int: 1; + value "focus_highlight_enable" int: 0; + value "focus_highlight_animate" int: 0; } diff --git a/legacy/elementary/config/illume/base.src b/legacy/elementary/config/illume/base.src index 183154e964..6a697443a1 100644 --- a/legacy/elementary/config/illume/base.src +++ b/legacy/elementary/config/illume/base.src @@ -22,4 +22,6 @@ group "Elm_Config" struct { value "modules" string: ""; value "tooltip_delay" double: 1.0; value "cursor_engine_only" int: 1; + value "focus_highlight_enable" int: 0; + value "focus_highlight_animate" int: 0; } diff --git a/legacy/elementary/config/standard/base.src b/legacy/elementary/config/standard/base.src index a5e24f0acb..71847582b3 100644 --- a/legacy/elementary/config/standard/base.src +++ b/legacy/elementary/config/standard/base.src @@ -22,4 +22,6 @@ group "Elm_Config" struct { value "modules" string: ""; value "tooltip_delay" double: 1.0; value "cursor_engine_only" int: 1; + value "focus_highlight_enable" int: 0; + value "focus_highlight_animate" int: 0; } diff --git a/legacy/elementary/src/lib/Elementary.h.in b/legacy/elementary/src/lib/Elementary.h.in index 11a13a476b..7b832e13ee 100644 --- a/legacy/elementary/src/lib/Elementary.h.in +++ b/legacy/elementary/src/lib/Elementary.h.in @@ -312,6 +312,11 @@ extern "C" { EAPI void elm_finger_size_set(Evas_Coord size); EAPI void elm_finger_size_all_set(Evas_Coord size); + EAPI Eina_Bool elm_focus_highlight_enable_get(void); + EAPI void elm_focus_highlight_enable_set(Eina_Bool enable); + EAPI Eina_Bool elm_focus_highlight_animate_get(void); + EAPI void elm_focus_highlight_animate_set(Eina_Bool animate); + EAPI Eina_Bool elm_object_focus_get(Evas_Object *obj); EAPI void elm_object_focus(Evas_Object *obj); EAPI void elm_object_unfocus(Evas_Object *obj); diff --git a/legacy/elementary/src/lib/elm_config.c b/legacy/elementary/src/lib/elm_config.c index 6a58a98ce6..51fc32fffe 100644 --- a/legacy/elementary/src/lib/elm_config.c +++ b/legacy/elementary/src/lib/elm_config.c @@ -226,6 +226,8 @@ _desc_init(void) EET_DATA_DESCRIPTOR_ADD_BASIC(_config_edd, Elm_Config, "modules", modules, EET_T_STRING); EET_DATA_DESCRIPTOR_ADD_BASIC(_config_edd, Elm_Config, "tooltip_delay", tooltip_delay, EET_T_DOUBLE); EET_DATA_DESCRIPTOR_ADD_BASIC(_config_edd, Elm_Config, "cursor_engine_only", cursor_engine_only, EET_T_INT); + EET_DATA_DESCRIPTOR_ADD_BASIC(_config_edd, Elm_Config, "focus_highlight_enable", focus_highlight_enable, EET_T_INT); + EET_DATA_DESCRIPTOR_ADD_BASIC(_config_edd, Elm_Config, "focus_highlight_animate", focus_highlight_animate, EET_T_INT); } static void @@ -413,6 +415,8 @@ _config_load(void) _elm_config->modules = NULL; _elm_config->tooltip_delay = 1.0; _elm_config->cursor_engine_only = 1; + _elm_config->focus_highlight_enable = 0; + _elm_config->focus_highlight_animate = 1; } static void @@ -613,6 +617,12 @@ _env_get(void) s = getenv("ELM_CURSOR_ENGINE_ONLY"); if (s) _elm_config->cursor_engine_only = atoi(s); + + s = getenv("ELM_FOCUS_HIGHLIGHT_ENABLE"); + if (s) _elm_config->focus_highlight_enable = atoi(s); + + s = getenv("ELM_FOCUS_HIGHLIGHT_ANIMATE"); + if (s) _elm_config->focus_highlight_animate = atoi(s); } void diff --git a/legacy/elementary/src/lib/elm_main.c b/legacy/elementary/src/lib/elm_main.c index ef55a31960..24dc40ee86 100644 --- a/legacy/elementary/src/lib/elm_main.c +++ b/legacy/elementary/src/lib/elm_main.c @@ -1169,6 +1169,58 @@ elm_finger_size_all_set(Evas_Coord size) #endif } +/** + * Get the enable status of the focus highlight + * + * This gets whether the highlight on focused objects is enabled or not + * @ingroup Config + */ +EAPI Eina_Bool +elm_focus_highlight_enable_get(void) +{ + return _elm_config->focus_highlight_enable; +} + +/** + * Set the enable status of the focus highlight + * + * Set whether to show or not the highlight on focused objects + * @param enable Enable highlight if EINA_TRUE, disable otherwise + * @ingroup Config + */ +EAPI void +elm_focus_highlight_enable_set(Eina_Bool enable) +{ + _elm_config->focus_highlight_enable = !!enable; +} + +/** + * Get the enable status of the highlight animation + * + * Get whether the focus highlight, if enabled, will animate its switch from + * one object to the next + * @ingroup Config + */ +EAPI Eina_Bool +elm_focus_highlight_animate_get(void) +{ + return _elm_config->focus_highlight_animate; +} + +/** + * Set the enable status of the highlight animation + * + * Set whether the focus highlight, if enabled, will animate its switch from + * one object to the next + * @param animate Enable animation if EINA_TRUE, disable otherwise + * @ingroup Config + */ +EAPI void +elm_focus_highlight_animate_set(Eina_Bool animate) +{ + _elm_config->focus_highlight_animate = !!animate; +} + /** * Adjust size of an element for finger usage * diff --git a/legacy/elementary/src/lib/elm_priv.h b/legacy/elementary/src/lib/elm_priv.h index 3e5ebdefec..7bf2f3f230 100644 --- a/legacy/elementary/src/lib/elm_priv.h +++ b/legacy/elementary/src/lib/elm_priv.h @@ -93,6 +93,8 @@ struct _Elm_Config const char *modules; double tooltip_delay; int cursor_engine_only; + int focus_highlight_enable; + int focus_highlight_animate; }; struct _Elm_Module diff --git a/legacy/elementary/src/lib/elm_win.c b/legacy/elementary/src/lib/elm_win.c index a63ecb3a4f..b65b03dece 100644 --- a/legacy/elementary/src/lib/elm_win.c +++ b/legacy/elementary/src/lib/elm_win.c @@ -809,8 +809,11 @@ _elm_win_focus_highlight_reconfigure(Elm_Win *win) "default"); /* FIXME: use style */ win->focus_highlight.changed_theme = EINA_FALSE; - str = edje_object_data_get(win->focus_highlight.top, "animate"); - win->focus_highlight.top_animate = (str && !strcmp(str, "on")); + if (_elm_config->focus_highlight_animate) + { + str = edje_object_data_get(win->focus_highlight.top, "animate"); + win->focus_highlight.top_animate = (str && !strcmp(str, "on")); + } } if (win->focus_highlight.top_animate && previous && @@ -1035,6 +1038,9 @@ elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type) break; } + if (_elm_config->focus_highlight_enable) + elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE); + return win->win_obj; }