summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYeongJong Lee <yj34.lee@samsung.com>2018-04-25 20:34:15 +0900
committerSangHyeon Lee <sh10233.lee@samsung.com>2018-04-25 20:34:15 +0900
commit2553a7c2f004a0013896cf797f1fbc1f1280d93b (patch)
tree6ba0d1e143b3706e5045792969080f8337e609e7
parent61a83b6949dfd7ac2d211bd055a47cb8b6aecb37 (diff)
elm_genlist: focus last item on focusdevs/woohyun/elm_widget_focus
Reviewers: woohyun Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D6003
-rw-r--r--src/lib/elementary/elm_genlist.c51
1 files changed, 32 insertions, 19 deletions
diff --git a/src/lib/elementary/elm_genlist.c b/src/lib/elementary/elm_genlist.c
index 3f2af635cf..133581e095 100644
--- a/src/lib/elementary/elm_genlist.c
+++ b/src/lib/elementary/elm_genlist.c
@@ -2047,13 +2047,12 @@ _item_realize(Elm_Gen_Item *it, const int index, Eina_Bool calc)
2047 2047
2048 edje_object_message_signal_process(VIEW(it)); 2048 edje_object_message_signal_process(VIEW(it));
2049 2049
2050 if (sd->focus_on_realization == it) 2050 if (!elm_widget_is_legacy(WIDGET(it)) && sd->focus_on_realization == it)
2051 { 2051 {
2052 _elm_widget_item_highlight_in_theme(WIDGET(it), EO_OBJ(it)); 2052 _elm_widget_item_highlight_in_theme(WIDGET(it), EO_OBJ(it));
2053 _elm_widget_highlight_in_theme_update(WIDGET(it)); 2053 _elm_widget_highlight_in_theme_update(WIDGET(it));
2054 _elm_widget_focus_highlight_start(WIDGET(it)); 2054 _elm_widget_focus_highlight_start(WIDGET(it));
2055 if (!elm_widget_is_legacy(WIDGET(it))) 2055 efl_ui_focus_manager_focus_set(WIDGET(it), EO_OBJ(it));
2056 efl_ui_focus_manager_focus_set(WIDGET(it), EO_OBJ(it));
2057 sd->focus_on_realization = NULL; 2056 sd->focus_on_realization = NULL;
2058 } 2057 }
2059} 2058}
@@ -3432,20 +3431,23 @@ _elm_genlist_efl_ui_focus_object_on_focus_update(Eo *obj, Elm_Genlist_Data *sd)
3432 Eina_Bool int_ret = EINA_FALSE; 3431 Eina_Bool int_ret = EINA_FALSE;
3433 Elm_Object_Item *eo_it = NULL; 3432 Elm_Object_Item *eo_it = NULL;
3434 Eina_Bool is_sel = EINA_FALSE; 3433 Eina_Bool is_sel = EINA_FALSE;
3434 Eina_Bool focused;
3435 3435
3436 int_ret = efl_ui_focus_object_on_focus_update(efl_super(obj, MY_CLASS)); 3436 int_ret = efl_ui_focus_object_on_focus_update(efl_super(obj, MY_CLASS));
3437 if (!int_ret) return EINA_FALSE; 3437 if (!int_ret) return EINA_FALSE;
3438 3438
3439 if (efl_ui_focus_object_focus_get(obj) && (sd->items) && (sd->selected) && 3439 if (elm_widget_is_legacy(obj))
3440 focused = elm_widget_focus_get(obj);
3441 else
3442 focused = efl_ui_focus_object_focus_get(obj);
3443
3444 if (focused && (sd->items) && (sd->selected) &&
3440 (!sd->last_selected_item)) 3445 (!sd->last_selected_item))
3441 { 3446 {
3442 sd->last_selected_item = eina_list_data_get(sd->selected); 3447 sd->last_selected_item = eina_list_data_get(sd->selected);
3443 } 3448 }
3444 3449
3445 // Fallback Legacy Focus 3450 if (focused && !sd->mouse_down)
3446 if (!elm_widget_is_legacy(obj)) return EINA_TRUE;
3447
3448 if (efl_ui_focus_object_focus_get(obj) && !sd->mouse_down)
3449 { 3451 {
3450 if (sd->last_focused_item) 3452 if (sd->last_focused_item)
3451 eo_it = sd->last_focused_item; 3453 eo_it = sd->last_focused_item;
@@ -3453,14 +3455,22 @@ _elm_genlist_efl_ui_focus_object_on_focus_update(Eo *obj, Elm_Genlist_Data *sd)
3453 eo_it = sd->last_selected_item; 3455 eo_it = sd->last_selected_item;
3454 else if (_elm_config->first_item_focus_on_first_focus_in) 3456 else if (_elm_config->first_item_focus_on_first_focus_in)
3455 { 3457 {
3456 if (!_elm_config->item_select_on_focus_disable && is_sel) 3458 if (!elm_widget_is_legacy(obj))
3457 elm_genlist_item_selected_set(eo_it, EINA_TRUE); 3459 {
3460 if (!_elm_config->item_select_on_focus_disable && is_sel)
3461 elm_genlist_item_selected_set(eo_it, EINA_TRUE);
3462 else
3463 elm_object_item_focus_set(eo_it, EINA_TRUE);
3464 _elm_widget_focus_highlight_start(obj);
3465 //set it again in the manager, there might be the case that the manager focus history and internal item foused logic are in different states
3466 if (!elm_widget_is_legacy(obj) && efl_ui_focus_manager_request_subchild(obj, eo_it))
3467 efl_ui_focus_manager_focus_set(obj, eo_it);
3468 }
3458 else 3469 else
3459 elm_object_item_focus_set(eo_it, EINA_TRUE); 3470 {
3460 _elm_widget_focus_highlight_start(obj); 3471 eo_it = elm_genlist_first_item_get(obj);
3461 //set it again in the manager, there might be the case that the manager focus history and internal item foused logic are in different states 3472 is_sel = EINA_TRUE;
3462 if (!elm_widget_is_legacy(obj) && efl_ui_focus_manager_request_subchild(obj, eo_it)) 3473 }
3463 efl_ui_focus_manager_focus_set(obj, eo_it);
3464 } 3474 }
3465 3475
3466 while (eo_it) 3476 while (eo_it)
@@ -6333,7 +6343,12 @@ _elm_genlist_item_elm_widget_item_item_focus_set(Eo *eo_it, Elm_Gen_Item *it, Ei
6333 } 6343 }
6334 else 6344 else
6335 { 6345 {
6336 if (!efl_ui_focus_object_focus_get(obj)) 6346 Eina_Bool focused;
6347 if (elm_widget_is_legacy(obj))
6348 focused = elm_widget_focus_get(obj);
6349 else
6350 focused = efl_ui_focus_object_focus_get(obj);
6351 if (!focused)
6337 return; 6352 return;
6338 _elm_genlist_item_unfocused(eo_it); 6353 _elm_genlist_item_unfocused(eo_it);
6339 } 6354 }
@@ -6408,9 +6423,7 @@ _elm_genlist_item_new(Elm_Genlist_Data *sd,
6408 it->item->expanded_depth = depth; 6423 it->item->expanded_depth = depth;
6409 sd->item_count++; 6424 sd->item_count++;
6410 6425
6411 //Fallback Legacy Focus 6426 efl_ui_focus_composition_dirty(sd->obj);
6412 if (elm_widget_is_legacy(sd->obj))
6413 efl_ui_focus_composition_dirty(sd->obj);
6414 6427
6415 return it; 6428 return it;
6416} 6429}