From fdc3045369b73432f95cbfc167307d28337ee858 Mon Sep 17 00:00:00 2001 From: Shinwoo Kim Date: Fri, 15 Feb 2013 10:39:00 +0000 Subject: [PATCH] [popup] popup is now a focusable object!! [access] omit an object on the focus cycle which does not have access information. SVN revision: 83943 --- legacy/elementary/ChangeLog | 4 ++ legacy/elementary/NEWS | 1 + legacy/elementary/src/lib/elc_popup.c | 81 ++++++++++++++++++++++++---------- legacy/elementary/src/lib/elm_widget.c | 8 ++++ 4 files changed, 71 insertions(+), 23 deletions(-) diff --git a/legacy/elementary/ChangeLog b/legacy/elementary/ChangeLog index cad4977..929a339 100644 --- a/legacy/elementary/ChangeLog +++ b/legacy/elementary/ChangeLog @@ -1013,3 +1013,7 @@ 2013-02-15 Jaehwan Kim * Add the reorder effect in toolbar. + +2013-02-15 Shinwoo Kim + + * Popup is now a focusable object. diff --git a/legacy/elementary/NEWS b/legacy/elementary/NEWS index 78fdd48..e1a14a9 100644 --- a/legacy/elementary/NEWS +++ b/legacy/elementary/NEWS @@ -68,6 +68,7 @@ Improvements: * Expand elm_transit_tween_mode ELM_TRANSIT_TWEEN_MODE_DIVISOR_INTERP, ELM_TRANSIT_TWEEN_MODE_BOUNCE, ELM_TRANSIT_TWEEN_MODE_SPRING * Added new APIs elm_transit_tween_mode_facator_set()/get() * Ctxpopup will be dismissed when language is changed. + * Popup is now a focusable object. Fixes: diff --git a/legacy/elementary/src/lib/elc_popup.c b/legacy/elementary/src/lib/elc_popup.c index 56b9fdd..bc83f7c 100644 --- a/legacy/elementary/src/lib/elc_popup.c +++ b/legacy/elementary/src/lib/elc_popup.c @@ -76,8 +76,6 @@ _on_show(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) { - Evas_Object *ao; - ELM_POPUP_DATA_GET(obj, sd); evas_object_show(sd->notify); @@ -85,12 +83,7 @@ _on_show(void *data __UNUSED__, /* yeah, ugly, but again, this widget needs a rewrite */ elm_object_content_set(sd->notify, obj); - /* access */ - if (_elm_config->access_mode) - { - ao = _access_object_get(obj, ACCESS_TITLE_PART); - _elm_access_highlight_set(ao); - } + elm_object_focus_set(obj, EINA_TRUE); } static void @@ -191,6 +184,7 @@ _elm_popup_smart_del(Eo *obj, void *_pd, va_list *list EINA_UNUSED) evas_object_event_callback_del (sd->content, EVAS_CALLBACK_DEL, _on_content_del); evas_object_event_callback_del(obj, EVAS_CALLBACK_SHOW, _on_show); + sd->button_count = 0; for (i = 0; i < ELM_POPUP_ACTION_BUTTON_MAX; i++) @@ -925,6 +919,9 @@ _content_text_set(Evas_Object *obj, /* access */ if (_elm_config->access_mode) { + /* unregister label, ACCESS_BODY_PART will register */ + elm_access_object_unregister(sd->text_content_obj); + ao = _access_object_get(obj, ACCESS_BODY_PART); if (!ao) { @@ -1308,6 +1305,9 @@ _elm_popup_smart_focus_next_manager_is(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSE static void _elm_popup_smart_focus_next(Eo *obj EINA_UNUSED, void *_pd, va_list *list) { + Evas_Object *ao; + Eina_List *items = NULL; + Elm_Popup_Smart_Data *sd = _pd; Elm_Focus_Direction dir = va_arg(*list, Elm_Focus_Direction); @@ -1315,24 +1315,29 @@ _elm_popup_smart_focus_next(Eo *obj EINA_UNUSED, void *_pd, va_list *list) Eina_Bool *ret = va_arg(*list, Eina_Bool *); if (ret) *ret = EINA_TRUE; - if (!elm_widget_focus_next_get(sd->content_area, dir, next) && - !elm_widget_focus_next_get(sd->action_area, dir, next) - ) + /* access */ + if (_elm_config->access_mode) { - /* access */ - if (_elm_config->access_mode) - { - *next = _access_object_get(obj, ACCESS_TITLE_PART); - return; - } - elm_widget_focused_object_clear((Evas_Object *)obj); - if (!elm_widget_focus_next_get(sd->content_area, dir, next)) + if (sd->title_text) { - Eina_Bool int_ret = elm_widget_focus_next_get(sd->action_area, dir, next); - if (ret) *ret = int_ret; + ao = _access_object_get(obj, ACCESS_TITLE_PART); + items = eina_list_append(items, ao); } - return; + + ao = _access_object_get(obj, ACCESS_BODY_PART); + if (ao) items = eina_list_append(items, ao); } + + /* content area */ + if (sd->content) items = eina_list_append(items, sd->content_area); + + /* action area */ + if (sd->button_count) items = eina_list_append(items, sd->action_area); + + elm_widget_focus_list_next_get + (obj, items, eina_list_data_get, dir, next); + + return; } static void @@ -1360,6 +1365,35 @@ _elm_popup_smart_focus_direction(Eo *obj EINA_UNUSED, void *_pd, va_list *list) } static void +_elm_popup_smart_event(Eo *obj, void *_pd EINA_UNUSED, va_list *list) +{ + Evas_Object *src = va_arg(*list, Evas_Object *); + (void)src; + Evas_Callback_Type type = va_arg(*list, Evas_Callback_Type); + void *event_info = va_arg(*list, void *); + Eina_Bool *ret = va_arg(*list, Eina_Bool *); + if (ret) *ret = EINA_FALSE; + + Evas_Event_Key_Down *ev = event_info; + + if (elm_widget_disabled_get(obj)) return; + if (type != EVAS_CALLBACK_KEY_DOWN) return; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; + + if (!strcmp(ev->keyname, "Tab")) + { + if (evas_key_modifier_is_set(ev->modifiers, "Shift")) + elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS); + else + elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT); + + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + if (ret) *ret = EINA_TRUE; + return; + } +} + +static void _elm_popup_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED) { Elm_Popup_Smart_Data *priv = _pd; @@ -1419,7 +1453,7 @@ _elm_popup_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED) evas_object_smart_callback_add(priv->notify, "timeout", _timeout_cb, obj); - elm_widget_can_focus_set(obj, EINA_FALSE); + elm_widget_can_focus_set(obj, EINA_TRUE); _visuals_set(obj); edje_object_message_signal_process(wd->resize_obj); @@ -1769,6 +1803,7 @@ _class_constructor(Eo_Class *klass) EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_DEL), _elm_popup_smart_del), EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_PARENT_SET), _elm_popup_smart_parent_set), + EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_EVENT), _elm_popup_smart_event), EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_THEME), _elm_popup_smart_theme), EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_NEXT_MANAGER_IS), _elm_popup_smart_focus_next_manager_is), EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_NEXT), _elm_popup_smart_focus_next), diff --git a/legacy/elementary/src/lib/elm_widget.c b/legacy/elementary/src/lib/elm_widget.c index 5ce264b..0c75880 100644 --- a/legacy/elementary/src/lib/elm_widget.c +++ b/legacy/elementary/src/lib/elm_widget.c @@ -2643,6 +2643,14 @@ _elm_widget_focus_next_get(Eo *obj, void *_pd EINA_UNUSED, va_list *list) if (!elm_widget_can_focus_get(obj)) return; + /* focusable object but does not have access info */ + if (_elm_config->access_mode) + { + Elm_Access_Info *ac; + ac= _elm_access_object_get(obj); + if (!ac) return; + } + /* Return */ *next = (Evas_Object *)obj; *ret = !ELM_WIDGET_FOCUS_GET(obj); -- 2.7.4