From 6a68b6c6a023b977c6b2cec2970fca470cad6cda Mon Sep 17 00:00:00 2001 From: Shinwoo Kim Date: Thu, 9 May 2013 17:30:30 +0900 Subject: [PATCH] [access] enhancement - refine function name and more Change-Id: Id95535cf0105a18d62bcd0efef67a4743a3e35c7 --- src/lib/elm_access.c | 45 ++++++++++++++++++++++++--------------------- src/lib/elm_widget.c | 14 ++++++++++---- src/lib/elm_widget.h | 9 ++++----- 3 files changed, 38 insertions(+), 30 deletions(-) diff --git a/src/lib/elm_access.c b/src/lib/elm_access.c index bbdf0f8..2c24932 100644 --- a/src/lib/elm_access.c +++ b/src/lib/elm_access.c @@ -25,7 +25,7 @@ struct _Action_Info typedef struct _Action_Info Action_Info; static Eina_Bool mouse_event_enable = EINA_TRUE; -static Eina_Bool read_mode = EINA_FALSE; +static Eina_Bool auto_highlight = EINA_FALSE; static Evas_Coord_Point offset; static Evas_Object *s_parent; /* scrollable parent */ static Elm_Access_Action_Type action_by = ELM_ACCESS_ACTION_FIRST; @@ -307,6 +307,8 @@ static void _access_obj_mouse_in_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { Elm_Access_Info *ac; + Evas_Object *ho; + if (!mouse_event_enable) return; ac = evas_object_data_get(data, "_elm_access"); @@ -319,7 +321,12 @@ _access_obj_mouse_in_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSE } if (_elm_config->access_mode) - _elm_access_highlight_set(data); + { + ho = _access_highlight_object_get(data); + if (ho == data) return; + + _access_highlight_read(ac, data); + } } static void @@ -398,17 +405,17 @@ _elm_access_mouse_event_enabled_set(Eina_Bool enabled) } void -_elm_access_read_mode_set(Eina_Bool enabled) +_elm_access_auto_highlight_set(Eina_Bool enabled) { enabled = !!enabled; - if (read_mode == enabled) return; - read_mode = enabled; + if (auto_highlight == enabled) return; + auto_highlight = enabled; } Eina_Bool -_elm_access_read_mode_get() +_elm_access_auto_highlight_get() { - return read_mode; + return auto_highlight; } void @@ -678,7 +685,7 @@ _access_highlight_next_get(Evas_Object *obj, Elm_Focus_Direction dir) } while (parent); - _elm_access_read_mode_set(EINA_TRUE); + _elm_access_auto_highlight_set(EINA_TRUE); ret = elm_widget_focus_next_get(obj, dir, &target); if (ret && target) @@ -700,7 +707,7 @@ _access_highlight_next_get(Evas_Object *obj, Elm_Focus_Direction dir) } } - _elm_access_read_mode_set(EINA_FALSE); + _elm_access_auto_highlight_set(EINA_FALSE); return ret; } @@ -724,14 +731,12 @@ _elm_access_highlight_set(Evas_Object* obj) _access_highlight_read(ac, obj); - /* move mouse position to inside of highlight object. if an object has a - highlight by highlight_cycle();, the mouse still positions at previous - position which would be made by MOUSE_IN event. */ - if (!_elm_access_read_mode_get()) return; - evas = evas_object_evas_get(obj); if (!evas) return; + /* move mouse position to inside of highlight object. if an object has a + highlight by highlight_cycle();, the mouse still positions at previous + position which would be made by MOUSE_IN event. */ evas_object_geometry_get(obj, &ho_point.x, &ho_point.y, 0, 0); evas_event_feed_mouse_move(evas, ho_point.x, ho_point.y, 0, NULL); } @@ -808,8 +813,6 @@ _elm_access_highlight_object_activate(Evas_Object *obj, Elm_Activate act) case ELM_ACTIVATE_DEFAULT: case ELM_ACTIVATE_UP: case ELM_ACTIVATE_DOWN: - _elm_access_read_mode_set(EINA_FALSE); - if (!elm_object_focus_get(ho)) elm_object_focus_set(ho, EINA_TRUE); @@ -852,7 +855,7 @@ _elm_access_highlight_cycle(Evas_Object *obj, Elm_Focus_Direction dir) } while (parent); - _elm_access_read_mode_set(EINA_TRUE); + _elm_access_auto_highlight_set(EINA_TRUE); if (dir == ELM_FOCUS_NEXT) type = ELM_ACCESS_ACTION_HIGHLIGHT_NEXT; @@ -866,7 +869,7 @@ _elm_access_highlight_cycle(Evas_Object *obj, Elm_Focus_Direction dir) action_by = ELM_ACCESS_ACTION_FIRST; - _elm_access_read_mode_set(EINA_FALSE); + _elm_access_auto_highlight_set(EINA_FALSE); } EAPI char * @@ -1402,7 +1405,7 @@ elm_access_action(Evas_Object *obj, const Elm_Access_Action_Type type, void *act Evas *evas; Evas_Object *ho; Elm_Access_Action_Info *a; - Eina_Bool ret; + Eina_Bool ret = EINA_FALSE; a = (Elm_Access_Action_Info *) action_info; @@ -1413,9 +1416,9 @@ elm_access_action(Evas_Object *obj, const Elm_Access_Action_Type type, void *act evas = evas_object_evas_get(obj); if (!evas) return EINA_FALSE; - _elm_access_mouse_event_enabled_set(EINA_TRUE); - evas_event_feed_mouse_in(evas, 0, NULL); + + _elm_access_mouse_event_enabled_set(EINA_TRUE); evas_event_feed_mouse_move(evas, a->x, a->y, 0, NULL); _elm_access_mouse_event_enabled_set(EINA_FALSE); diff --git a/src/lib/elm_widget.c b/src/lib/elm_widget.c index 5828df3..dd85991 100644 --- a/src/lib/elm_widget.c +++ b/src/lib/elm_widget.c @@ -13,9 +13,9 @@ static const char ELM_WIDGET_SMART_NAME[] = "elm_widget"; if (!sd) \ return -#define ELM_WIDGET_FOCUS_GET(obj) \ - ((_elm_access_read_mode_get()) ? (elm_widget_highlight_get(obj)) : \ - (elm_widget_focus_get(obj))) +#define ELM_WIDGET_FOCUS_GET(obj) \ + ((_elm_access_auto_highlight_get()) ? (elm_widget_highlight_get(obj)) : \ + (elm_widget_focus_get(obj))) typedef struct _Elm_Event_Cb_Data Elm_Event_Cb_Data; typedef struct _Elm_Translate_String_Data Elm_Translate_String_Data; @@ -1814,8 +1814,14 @@ elm_widget_focus_cycle(Evas_Object *obj, if (target) { /* access */ - if (_elm_config->access_mode && _elm_access_read_mode_get()) + if (_elm_config->access_mode) { + /* highlight cycle does not steal a focus, only after window gets + the ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_ACTIVATE message, + target will steal focus, or focus its own job. */ + if (!_elm_access_auto_highlight_get()) + elm_widget_focus_steal(target); + _elm_access_highlight_set(target); _elm_widget_focus_region_show(target); } diff --git a/src/lib/elm_widget.h b/src/lib/elm_widget.h index 10d3fab..a5cb5f5 100644 --- a/src/lib/elm_widget.h +++ b/src/lib/elm_widget.h @@ -585,11 +585,10 @@ struct _Elm_Access_Info void _elm_access_shutdown(); void _elm_access_mouse_event_enabled_set(Eina_Bool enabled); -/* elm_widget_focus_list_next_get();, elm_widget_focus_next_get(); - and elm_widget_focus_cycle(); use _elm_access_read_mode to use - focus chain */ -void _elm_access_read_mode_set(Eina_Bool enabled); -Eina_Bool _elm_access_read_mode_get(); + +/* if auto_higlight is EINA_TRUE, it does not steal a focus, it just moves a highlight */ +void _elm_access_auto_highlight_set(Eina_Bool enabled); +Eina_Bool _elm_access_auto_highlight_get(); void _elm_access_widget_item_access_order_set(Elm_Widget_Item *item, Eina_List *objs); const Eina_List *_elm_access_widget_item_access_order_get(const Elm_Widget_Item *item); void _elm_access_widget_item_access_order_unset(Elm_Widget_Item *item); -- 2.7.4