aboutsummaryrefslogtreecommitdiffstats
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
parentelm_access: Port to the new focus api (diff)
downloadefl-17e730e8e01837655f30ca75ca3c4b70cae66b3b.tar.gz
efl_ui_win: port to new focus api!
Diffstat (limited to 'src/lib/elementary/efl_ui_win.c')
-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)
ELM_WIN_DATA_ALIVE_CHECK(obj, sd);
if (sd->type != ELM_WIN_FAKE)
{
- if (!elm_obj_widget_focus_order_get(obj))
+ Efl_Ui_Focus_Manager *man = sd->obj;
+ while(efl_ui_focus_manager_redirect_get(man))
{
- elm_obj_widget_focus_steal(obj, NULL);
+ man = efl_ui_focus_manager_redirect_get(man);
}
- else
- {
- Evas_Object *newest = NULL;
- unsigned int newest_focus_order = 0;
- newest = elm_widget_newest_focus_order_get
- (obj, &newest_focus_order, EINA_TRUE);
- if (newest &&
- (_elm_widget_onscreen_is(newest) || (newest == obj)))
- elm_obj_widget_focus_restore(obj);
- else
- evas_object_focus_set(obj, EINA_TRUE);
- }
+ Evas_Object *focused = efl_ui_focus_manager_focus_get(man);
+ elm_obj_widget_on_focus_update(focused, NULL);
}
evas_object_smart_callback_call(obj, SIG_FOCUS_IN, NULL);
@@ -1635,68 +1626,6 @@ _elm_win_state_change(Ecore_Evas *ee)
}
EOLIAN static Eina_Bool
-_efl_ui_win_elm_widget_focus_next_manager_is(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *_pd EINA_UNUSED)
-{
- return EINA_TRUE;
-}
-
-EOLIAN static Eina_Bool
-_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)
-{
- ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
-
- const Eina_List *items;
- void *(*list_data_get)(const Eina_List *list);
-
- /* Focus chain */
- if (wd->subobjs)
- {
- if (!(items = elm_obj_widget_focus_custom_chain_get(obj)))
- {
- items = wd->subobjs;
- if (!items)
- return EINA_FALSE;
- }
- list_data_get = eina_list_data_get;
-
- elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next, next_item);
-
- if (*next) return EINA_TRUE;
- }
- *next = (Evas_Object *)obj;
- return EINA_FALSE;
-}
-
-EOLIAN static Eina_Bool
-_efl_ui_win_elm_widget_focus_direction_manager_is(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *_pd EINA_UNUSED)
-{
- return EINA_TRUE;
-}
-
-EOLIAN static Eina_Bool
-_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)
-{
- const Eina_List *items;
- void *(*list_data_get)(const Eina_List *list);
-
- ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
-
- /* Focus chain */
- if (wd->subobjs)
- {
- if (!(items = elm_obj_widget_focus_custom_chain_get(obj)))
- items = wd->subobjs;
-
- list_data_get = eina_list_data_get;
-
- return elm_widget_focus_list_direction_get
- (obj, base, items, list_data_get, degree, direction, direction_item, weight);
- }
-
- return EINA_FALSE;
-}
-
-EOLIAN static Eina_Bool
_efl_ui_win_elm_widget_on_focus_update(Eo *obj, Efl_Ui_Win_Data *sd, Elm_Object_Item *item EINA_UNUSED)
{
if (!elm_obj_widget_on_focus_update(efl_super(obj, MY_CLASS), NULL))
@@ -2758,7 +2687,8 @@ _win_img_hide(void *data,
Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
- elm_obj_widget_focus_hide_handle(data);
+ Efl_Ui_Win *real_win = elm_widget_top_get(data);
+ efl_ui_focus_manager_redirect_set(real_win, NULL);
}
static void
@@ -2778,7 +2708,9 @@ _win_img_focus_in(void *data,
Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
- elm_obj_widget_focus_steal(data, NULL);
+ Efl_Ui_Win *real_win = elm_widget_top_get(data);
+ efl_ui_focus_manager_redirect_set(real_win, data);
+ efl_ui_focus_manager_focus_set(data, efl_ui_focus_manager_root_get(data));
}
static void
@@ -2787,7 +2719,8 @@ _win_img_focus_out(void *data,
Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
- elm_obj_widget_focused_object_clear(data);
+ Efl_Ui_Win *real_win = elm_widget_top_get(data);
+ efl_ui_focus_manager_redirect_set(real_win, NULL);
}
static void
@@ -3679,11 +3612,7 @@ _elm_win_translate(void)
void
_elm_win_focus_reconfigure(void)
{
- const Eina_List *l;
- Evas_Object *obj;
-
- EINA_LIST_FOREACH(_elm_win_list, l, obj)
- elm_obj_widget_focus_reconfigure(obj);
+ /* FOCUS-FIXME */
}
#ifdef HAVE_ELEMENTARY_X
@@ -5041,6 +4970,8 @@ _elm_win_finalize_internal(Eo *obj, Efl_Ui_Win_Data *sd, const char *name, Elm_W
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
+ evas_object_focus_set(obj, EINA_TRUE);
+
if (getenv("ELM_FIRST_FRAME"))
evas_event_callback_add(ecore_evas_get(tmp_sd.ee), EVAS_CALLBACK_RENDER_POST,
_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
efl_access_window_created_signal_emit(win);
if (elm_win_focus_get(win))
{
+ Evas_Object *target;
efl_access_window_activated_signal_emit(win);
/** Reemit focused event to inform atspi clients about currently
* focused object **/
- unsigned int order = 0;
- Evas_Object *target;
- target = elm_widget_newest_focus_order_get(win, &order, EINA_TRUE);
+ {
+ Efl_Ui_Focus_Manager *m;
+
+ m = win;
+
+ while (efl_ui_focus_manager_redirect_get(m))
+ m = efl_ui_focus_manager_redirect_get(m);
+
+ target = efl_ui_focus_manager_focus_get(m);
+ }
if (target)
elm_interface_atspi_accessible_state_changed_signal_emit(target, ELM_ATSPI_STATE_FOCUSED, EINA_TRUE);
}