From: Carsten Haitzler (Rasterman) Date: Thu, 10 Sep 2015 09:29:24 +0000 (+0900) Subject: elm autofocus show - fix cases where focus is inside containers X-Git-Tag: v1.16.0-alpha1~88 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aa5b83d76aa371e6de4e0a1c45cc31e72646ecdf;p=platform%2Fupstream%2Felementary.git elm autofocus show - fix cases where focus is inside containers i found that the focus doesnt auto-show when focusing things inside scrollers and so on. i had to add more points to trigger auto show. this fixes that @fix --- diff --git a/src/lib/elc_ctxpopup.c b/src/lib/elc_ctxpopup.c index d371459..73954d4 100644 --- a/src/lib/elc_ctxpopup.c +++ b/src/lib/elc_ctxpopup.c @@ -115,6 +115,7 @@ _key_action_move(Evas_Object *obj, const char *params) if (!sd->box) return EINA_FALSE; + _elm_widget_focus_auto_show(obj); if (!strcmp(dir, "previous")) elm_widget_focus_cycle(sd->box, ELM_FOCUS_PREVIOUS); else if (!strcmp(dir, "next")) diff --git a/src/lib/elc_hoversel.c b/src/lib/elc_hoversel.c index c25fb6a..b828931 100644 --- a/src/lib/elc_hoversel.c +++ b/src/lib/elc_hoversel.c @@ -677,6 +677,7 @@ _key_action_move(Evas_Object *obj, const char *params) eo_litem = eina_list_last_data_get(sd->items); eo_fitem = eina_list_data_get(sd->items); + _elm_widget_focus_auto_show(obj); if (!strcmp(dir, "down")) { if ((!sd->horizontal) && diff --git a/src/lib/elc_player.c b/src/lib/elc_player.c index 91e38ed..1eeb35d 100644 --- a/src/lib/elc_player.c +++ b/src/lib/elc_player.c @@ -72,6 +72,7 @@ _key_action_move(Evas_Object *obj, const char *params) ELM_PLAYER_DATA_GET(obj, sd); const char *dir = params; + _elm_widget_focus_auto_show(obj); if (!strcmp(dir, "left")) { double current, last; diff --git a/src/lib/elc_popup.c b/src/lib/elc_popup.c index ed9cc85..7e56946 100644 --- a/src/lib/elc_popup.c +++ b/src/lib/elc_popup.c @@ -1419,6 +1419,7 @@ _key_action_move(Evas_Object *obj, const char *params) { const char *dir = params; + _elm_widget_focus_auto_show(obj); if (!strcmp(dir, "previous")) elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS); else if (!strcmp(dir, "next")) diff --git a/src/lib/elm_calendar.c b/src/lib/elm_calendar.c index fe0102a..4ecfb49 100644 --- a/src/lib/elm_calendar.c +++ b/src/lib/elm_calendar.c @@ -933,6 +933,7 @@ _key_action_move(Evas_Object *obj, const char *params) ELM_CALENDAR_DATA_GET(obj, sd); const char *dir = params; + _elm_widget_focus_auto_show(obj); if (!strcmp(dir, "prior")) { if (_update_data(obj, EINA_TRUE, -1)) _populate(obj); diff --git a/src/lib/elm_colorselector.c b/src/lib/elm_colorselector.c index f53548e..ee9a96f 100644 --- a/src/lib/elm_colorselector.c +++ b/src/lib/elm_colorselector.c @@ -1829,11 +1829,12 @@ _key_action_move(Evas_Object *obj, const char *params) char colorbar_s[128]; const char *dir = params; + _elm_widget_focus_auto_show(obj); if (!strcmp(dir, "left")) { if (sd->focused == ELM_COLORSELECTOR_PALETTE && sd->selected) cl = eina_list_prev(sd->selected); - else if (sd->focused == ELM_COLORSELECTOR_COMPONENTS) + else if (sd->focused == ELM_COLORSELECTOR_COMPONENTS) _button_clicked_cb(sd->cb_data[sd->sel_color_type], sd->cb_data[sd->sel_color_type]->lbt, NULL, NULL); else return EINA_FALSE; diff --git a/src/lib/elm_diskselector.c b/src/lib/elm_diskselector.c index 70d5f3b..54fe8c5 100644 --- a/src/lib/elm_diskselector.c +++ b/src/lib/elm_diskselector.c @@ -962,6 +962,7 @@ _key_action_move(Evas_Object *obj, const char *params) Eina_List *l = NULL; const char *dir = params; + _elm_widget_focus_auto_show(obj); if (!strcmp(dir, "prev")) { l = sd->selected_item->node->prev; diff --git a/src/lib/elm_gengrid.c b/src/lib/elm_gengrid.c index 66a8eff..d351b53 100644 --- a/src/lib/elm_gengrid.c +++ b/src/lib/elm_gengrid.c @@ -3054,6 +3054,7 @@ _key_action_move(Evas_Object *obj, const char *params) if (sd->reorder_mode && sd->reorder.running) return EINA_TRUE; + _elm_widget_focus_auto_show(obj); if ((!strcmp(dir, "left") && !mirrored) || (!strcmp(dir, "right") && mirrored)) { diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c index e620c47..a839fc1 100644 --- a/src/lib/elm_genlist.c +++ b/src/lib/elm_genlist.c @@ -2894,6 +2894,7 @@ _key_action_move(Evas_Object *obj, const char *params) elm_interface_scrollable_content_viewport_geometry_get (NULL, NULL, &v_w, &v_h)); + _elm_widget_focus_auto_show(obj); if (!strcmp(dir, "left")) { x -= step_x; diff --git a/src/lib/elm_list.c b/src/lib/elm_list.c index dddd7b4..498a79e 100644 --- a/src/lib/elm_list.c +++ b/src/lib/elm_list.c @@ -474,6 +474,7 @@ static Eina_Bool _key_action_move(Evas_Object *obj, const char *params) elm_interface_scrollable_content_viewport_geometry_get (NULL, NULL, &v_w, &v_h)); + _elm_widget_focus_auto_show(obj); /* TODO: fix logic for horizontal mode */ if (!strcmp(dir, "left")) { diff --git a/src/lib/elm_priv.h b/src/lib/elm_priv.h index 61bba21..0b03d54 100644 --- a/src/lib/elm_priv.h +++ b/src/lib/elm_priv.h @@ -402,6 +402,7 @@ void _elm_module_unload(Elm_Module *m); const void *_elm_module_symbol_get(Elm_Module *m, const char *name); +void _elm_widget_focus_auto_show(Evas_Object *obj); void _elm_widget_top_win_focused_set(Evas_Object *obj, Eina_Bool top_win_focused); Eina_Bool _elm_widget_top_win_focused_get(const Evas_Object *obj); diff --git a/src/lib/elm_scroller.c b/src/lib/elm_scroller.c index e041a44..22e0684 100644 --- a/src/lib/elm_scroller.c +++ b/src/lib/elm_scroller.c @@ -113,6 +113,8 @@ _key_action_move(Evas_Object *obj, const char *params) (&v_x, &v_y, &v_w, &v_h)); evas_object_geometry_get(sd->content, &c_x, &c_y, &max_x, &max_y); + _elm_widget_focus_auto_show(obj); + current_focus = elm_widget_focused_object_get(obj); evas_object_geometry_get(current_focus, &f_x, &f_y, &f_w, &f_h); can_focus_list = elm_widget_can_focus_child_list_get(obj); diff --git a/src/lib/elm_slideshow.c b/src/lib/elm_slideshow.c index 7d9c454..ae8146c 100644 --- a/src/lib/elm_slideshow.c +++ b/src/lib/elm_slideshow.c @@ -43,6 +43,7 @@ _key_action_move(Evas_Object *obj, const char *params) { const char *dir = params; + _elm_widget_focus_auto_show(obj); if (!strcmp(dir, "left")) { elm_slideshow_previous(obj); diff --git a/src/lib/elm_toolbar.c b/src/lib/elm_toolbar.c index 0061934..4b3841e 100644 --- a/src/lib/elm_toolbar.c +++ b/src/lib/elm_toolbar.c @@ -912,6 +912,7 @@ _key_action_move(Evas_Object *obj, const char *params) { const char *dir = params; + _elm_widget_focus_auto_show(obj); if (!strcmp(dir, "left")) { if (!_item_focused_next(obj, EINA_TRUE, ELM_FOCUS_LEFT)) diff --git a/src/lib/elm_video.c b/src/lib/elm_video.c index 80aa739..3502971 100644 --- a/src/lib/elm_video.c +++ b/src/lib/elm_video.c @@ -41,6 +41,7 @@ _key_action_move(Evas_Object *obj, const char *params) { const char *dir = params; + _elm_widget_focus_auto_show(obj); if (!strcmp(dir, "left")) { double current, last; diff --git a/src/lib/elm_widget.c b/src/lib/elm_widget.c index db963b7..49fe1ac 100644 --- a/src/lib/elm_widget.c +++ b/src/lib/elm_widget.c @@ -1845,6 +1845,7 @@ EOLIAN static void _elm_widget_focus_cycle(Eo *obj, Elm_Widget_Smart_Data *_pd EINA_UNUSED, Elm_Focus_Direction dir) { Evas_Object *target = NULL; + if (!_elm_widget_is(obj)) return; focus_origin = dir; @@ -2890,6 +2891,13 @@ _elm_widget_focus_restore(Eo *obj, Elm_Widget_Smart_Data *_pd EINA_UNUSED) } void +_elm_widget_focus_auto_show(Evas_Object *obj) +{ + Evas_Object *top = elm_widget_top_get(obj); + if (top && eo_isa(top, ELM_WIN_CLASS)) _elm_win_focus_auto_show(top); +} + +void _elm_widget_top_win_focused_set(Evas_Object *obj, Eina_Bool top_win_focused) { diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c index e75ee1d..453bb2f 100644 --- a/src/lib/elm_win.c +++ b/src/lib/elm_win.c @@ -1507,10 +1507,8 @@ static Eina_Bool _key_action_move(Evas_Object *obj, const char *params) { const char *dir = params; - Evas_Object *top; - top = elm_widget_top_get(obj); - if (top && eo_isa(top, ELM_WIN_CLASS)) _elm_win_focus_auto_show(top); + _elm_widget_focus_auto_show(obj); if (!strcmp(dir, "previous")) elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS); else if (!strcmp(dir, "next"))