summaryrefslogtreecommitdiff
path: root/src/lib/elementary/efl_ui_win.c
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>2017-09-27 01:07:20 +0200
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>2017-10-10 19:28:48 +0200
commit17e730e8e01837655f30ca75ca3c4b70cae66b3b (patch)
tree8451160bc10b1538e17ca58b04d65c989a59dc2b /src/lib/elementary/efl_ui_win.c
parent76c202c3e5ed11a7b17c0d17b2df090e1a0e30ca (diff)
efl_ui_win: port to new focus api!
Diffstat (limited to '')
-rw-r--r--src/lib/elementary/efl_ui_win.c113
1 files changed, 26 insertions, 87 deletions
diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c
index 9f39bc4e42..1b341ffe01 100644
--- a/src/lib/elementary/efl_ui_win.c
+++ b/src/lib/elementary/efl_ui_win.c
@@ -1223,23 +1223,14 @@ _elm_win_focus_in(Ecore_Evas *ee)
1223 ELM_WIN_DATA_ALIVE_CHECK(obj, sd); 1223 ELM_WIN_DATA_ALIVE_CHECK(obj, sd);
1224 if (sd->type != ELM_WIN_FAKE) 1224 if (sd->type != ELM_WIN_FAKE)
1225 { 1225 {
1226 if (!elm_obj_widget_focus_order_get(obj)) 1226 Efl_Ui_Focus_Manager *man = sd->obj;
1227 while(efl_ui_focus_manager_redirect_get(man))
1227 { 1228 {
1228 elm_obj_widget_focus_steal(obj, NULL); 1229 man = efl_ui_focus_manager_redirect_get(man);
1229 } 1230 }
1230 else
1231 {
1232 Evas_Object *newest = NULL;
1233 unsigned int newest_focus_order = 0;
1234 1231
1235 newest = elm_widget_newest_focus_order_get 1232 Evas_Object *focused = efl_ui_focus_manager_focus_get(man);
1236 (obj, &newest_focus_order, EINA_TRUE); 1233 elm_obj_widget_on_focus_update(focused, NULL);
1237 if (newest &&
1238 (_elm_widget_onscreen_is(newest) || (newest == obj)))
1239 elm_obj_widget_focus_restore(obj);
1240 else
1241 evas_object_focus_set(obj, EINA_TRUE);
1242 }
1243 } 1234 }
1244 1235
1245 evas_object_smart_callback_call(obj, SIG_FOCUS_IN, NULL); 1236 evas_object_smart_callback_call(obj, SIG_FOCUS_IN, NULL);
@@ -1635,68 +1626,6 @@ _elm_win_state_change(Ecore_Evas *ee)
1635} 1626}
1636 1627
1637EOLIAN static Eina_Bool 1628EOLIAN static Eina_Bool
1638_efl_ui_win_elm_widget_focus_next_manager_is(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *_pd EINA_UNUSED)
1639{
1640 return EINA_TRUE;
1641}
1642
1643EOLIAN static Eina_Bool
1644_efl_ui_win_elm_widget_focus_next(Eo *obj, Efl_Ui_Win_Data *_pd EINA_UNUSED, Elm_Focus_Direction dir, Evas_Object **next, Elm_Object_Item **next_item)
1645{
1646 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
1647
1648 const Eina_List *items;
1649 void *(*list_data_get)(const Eina_List *list);
1650
1651 /* Focus chain */
1652 if (wd->subobjs)
1653 {
1654 if (!(items = elm_obj_widget_focus_custom_chain_get(obj)))
1655 {
1656 items = wd->subobjs;
1657 if (!items)
1658 return EINA_FALSE;
1659 }
1660 list_data_get = eina_list_data_get;
1661
1662 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next, next_item);
1663
1664 if (*next) return EINA_TRUE;
1665 }
1666 *next = (Evas_Object *)obj;
1667 return EINA_FALSE;
1668}
1669
1670EOLIAN static Eina_Bool
1671_efl_ui_win_elm_widget_focus_direction_manager_is(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *_pd EINA_UNUSED)
1672{
1673 return EINA_TRUE;
1674}
1675
1676EOLIAN static Eina_Bool
1677_efl_ui_win_elm_widget_focus_direction(Eo *obj, Efl_Ui_Win_Data *_pd EINA_UNUSED, const Evas_Object *base, double degree, Evas_Object **direction, Elm_Object_Item **direction_item, double *weight)
1678{
1679 const Eina_List *items;
1680 void *(*list_data_get)(const Eina_List *list);
1681
1682 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
1683
1684 /* Focus chain */
1685 if (wd->subobjs)
1686 {
1687 if (!(items = elm_obj_widget_focus_custom_chain_get(obj)))
1688 items = wd->subobjs;
1689
1690 list_data_get = eina_list_data_get;
1691
1692 return elm_widget_focus_list_direction_get
1693 (obj, base, items, list_data_get, degree, direction, direction_item, weight);
1694 }
1695
1696 return EINA_FALSE;
1697}
1698
1699EOLIAN static Eina_Bool
1700_efl_ui_win_elm_widget_on_focus_update(Eo *obj, Efl_Ui_Win_Data *sd, Elm_Object_Item *item EINA_UNUSED) 1629_efl_ui_win_elm_widget_on_focus_update(Eo *obj, Efl_Ui_Win_Data *sd, Elm_Object_Item *item EINA_UNUSED)
1701{ 1630{
1702 if (!elm_obj_widget_on_focus_update(efl_super(obj, MY_CLASS), NULL)) 1631 if (!elm_obj_widget_on_focus_update(efl_super(obj, MY_CLASS), NULL))
@@ -2758,7 +2687,8 @@ _win_img_hide(void *data,
2758 Evas_Object *obj EINA_UNUSED, 2687 Evas_Object *obj EINA_UNUSED,
2759 void *event_info EINA_UNUSED) 2688 void *event_info EINA_UNUSED)
2760{ 2689{
2761 elm_obj_widget_focus_hide_handle(data); 2690 Efl_Ui_Win *real_win = elm_widget_top_get(data);
2691 efl_ui_focus_manager_redirect_set(real_win, NULL);
2762} 2692}
2763 2693
2764static void 2694static void
@@ -2778,7 +2708,9 @@ _win_img_focus_in(void *data,
2778 Evas_Object *obj EINA_UNUSED, 2708 Evas_Object *obj EINA_UNUSED,
2779 void *event_info EINA_UNUSED) 2709 void *event_info EINA_UNUSED)
2780{ 2710{
2781 elm_obj_widget_focus_steal(data, NULL); 2711 Efl_Ui_Win *real_win = elm_widget_top_get(data);
2712 efl_ui_focus_manager_redirect_set(real_win, data);
2713 efl_ui_focus_manager_focus_set(data, efl_ui_focus_manager_root_get(data));
2782} 2714}
2783 2715
2784static void 2716static void
@@ -2787,7 +2719,8 @@ _win_img_focus_out(void *data,
2787 Evas_Object *obj EINA_UNUSED, 2719 Evas_Object *obj EINA_UNUSED,
2788 void *event_info EINA_UNUSED) 2720 void *event_info EINA_UNUSED)
2789{ 2721{
2790 elm_obj_widget_focused_object_clear(data); 2722 Efl_Ui_Win *real_win = elm_widget_top_get(data);
2723 efl_ui_focus_manager_redirect_set(real_win, NULL);
2791} 2724}
2792 2725
2793static void 2726static void
@@ -3679,11 +3612,7 @@ _elm_win_translate(void)
3679void 3612void
3680_elm_win_focus_reconfigure(void) 3613_elm_win_focus_reconfigure(void)
3681{ 3614{
3682 const Eina_List *l; 3615 /* FOCUS-FIXME */
3683 Evas_Object *obj;
3684
3685 EINA_LIST_FOREACH(_elm_win_list, l, obj)
3686 elm_obj_widget_focus_reconfigure(obj);
3687} 3616}
3688 3617
3689#ifdef HAVE_ELEMENTARY_X 3618#ifdef HAVE_ELEMENTARY_X
@@ -5041,6 +4970,8 @@ _elm_win_finalize_internal(Eo *obj, Efl_Ui_Win_Data *sd, const char *name, Elm_W
5041 efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY); 4970 efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
5042 evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks); 4971 evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
5043 4972
4973 evas_object_focus_set(obj, EINA_TRUE);
4974
5044 if (getenv("ELM_FIRST_FRAME")) 4975 if (getenv("ELM_FIRST_FRAME"))
5045 evas_event_callback_add(ecore_evas_get(tmp_sd.ee), EVAS_CALLBACK_RENDER_POST, 4976 evas_event_callback_add(ecore_evas_get(tmp_sd.ee), EVAS_CALLBACK_RENDER_POST,
5046 _elm_win_first_frame_do, getenv("ELM_FIRST_FRAME")); 4977 _elm_win_first_frame_do, getenv("ELM_FIRST_FRAME"));
@@ -6692,12 +6623,20 @@ _on_atspi_bus_connected(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUS
6692 efl_access_window_created_signal_emit(win); 6623 efl_access_window_created_signal_emit(win);
6693 if (elm_win_focus_get(win)) 6624 if (elm_win_focus_get(win))
6694 { 6625 {
6626 Evas_Object *target;
6695 efl_access_window_activated_signal_emit(win); 6627 efl_access_window_activated_signal_emit(win);
6696 /** Reemit focused event to inform atspi clients about currently 6628 /** Reemit focused event to inform atspi clients about currently
6697 * focused object **/ 6629 * focused object **/
6698 unsigned int order = 0; 6630 {
6699 Evas_Object *target; 6631 Efl_Ui_Focus_Manager *m;
6700 target = elm_widget_newest_focus_order_get(win, &order, EINA_TRUE); 6632
6633 m = win;
6634
6635 while (efl_ui_focus_manager_redirect_get(m))
6636 m = efl_ui_focus_manager_redirect_get(m);
6637
6638 target = efl_ui_focus_manager_focus_get(m);
6639 }
6701 if (target) 6640 if (target)
6702 elm_interface_atspi_accessible_state_changed_signal_emit(target, ELM_ATSPI_STATE_FOCUSED, EINA_TRUE); 6641 elm_interface_atspi_accessible_state_changed_signal_emit(target, ELM_ATSPI_STATE_FOCUSED, EINA_TRUE);
6703 } 6642 }