aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lib/elementary/elm_focus_legacy.c40
-rw-r--r--src/lib/elementary/elm_gengrid.c1
-rw-r--r--src/lib/elementary/elm_genlist.c1
-rw-r--r--src/lib/elementary/elm_priv.h1
-rw-r--r--src/lib/elementary/elm_toolbar.c1
5 files changed, 44 insertions, 0 deletions
diff --git a/src/lib/elementary/elm_focus_legacy.c b/src/lib/elementary/elm_focus_legacy.c
index ca84bb09a8..2e8b90511e 100644
--- a/src/lib/elementary/elm_focus_legacy.c
+++ b/src/lib/elementary/elm_focus_legacy.c
@@ -340,3 +340,43 @@ elm_object_focus_set(Evas_Object *obj,
evas_object_focus_set(obj, focus);
}
}
+
+//legacy helpers that are used in code
+typedef struct {
+ Eina_Bool focused;
+ Eo *emittee;
+} Legacy_Manager_Focus_State;
+
+static void
+_focus_manager_focused(void *data, const Efl_Event *ev)
+{
+ Legacy_Manager_Focus_State *state = data;
+ Eina_Bool currently_focused = !!efl_ui_focus_manager_focus_get(ev->object);
+
+ if (currently_focused == state->focused) return;
+
+ if (currently_focused)
+ evas_object_smart_callback_call(state->emittee, "focused", NULL);
+ else
+ evas_object_smart_callback_call(state->emittee, "unfocused", NULL);
+
+ state->focused = currently_focused;
+}
+
+static void
+_focus_manager_del(void *data, const Efl_Event *ev EINA_UNUSED)
+{
+ free(data);
+}
+
+void
+legacy_efl_ui_focus_manager_widget_legacy_signals(Efl_Ui_Focus_Manager *manager, Efl_Ui_Focus_Manager *emittee)
+{
+ Legacy_Manager_Focus_State *state = calloc(1, sizeof(Legacy_Manager_Focus_State));
+
+ state->emittee = emittee;
+ state->focused = EINA_FALSE;
+
+ efl_event_callback_add(manager, EFL_UI_FOCUS_MANAGER_EVENT_FOCUS_CHANGED, _focus_manager_focused, state);
+ efl_event_callback_add(manager, EFL_EVENT_DEL, _focus_manager_del, state);
+}
diff --git a/src/lib/elementary/elm_gengrid.c b/src/lib/elementary/elm_gengrid.c
index 21f76315b0..08c5416b4c 100644
--- a/src/lib/elementary/elm_gengrid.c
+++ b/src/lib/elementary/elm_gengrid.c
@@ -4257,6 +4257,7 @@ _gengrid_element_focused(void *data, const Efl_Event *ev)
EOLIAN static Eo *
_elm_gengrid_efl_object_constructor(Eo *obj, Elm_Gengrid_Data *sd)
{
+ legacy_efl_ui_focus_manager_widget_legacy_signals(obj, obj);
sd->content_item_map = eina_hash_pointer_new(NULL);
sd->provider = efl_add(EFL_UI_FOCUS_PARENT_PROVIDER_GEN_CLASS, obj,
efl_ui_focus_parent_provider_gen_container_set(efl_added, obj),
diff --git a/src/lib/elementary/elm_genlist.c b/src/lib/elementary/elm_genlist.c
index b8dcd7abb7..d966024bcf 100644
--- a/src/lib/elementary/elm_genlist.c
+++ b/src/lib/elementary/elm_genlist.c
@@ -5911,6 +5911,7 @@ _genlist_element_focused(void *data, const Efl_Event *ev)
EOLIAN static Eo *
_elm_genlist_efl_object_constructor(Eo *obj, Elm_Genlist_Data *sd)
{
+ legacy_efl_ui_focus_manager_widget_legacy_signals(obj, obj);
obj = efl_constructor(efl_super(obj, MY_CLASS));
sd->content_item_map = eina_hash_pointer_new(NULL);
diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h
index d8227f45c4..b9f1113f7a 100644
--- a/src/lib/elementary/elm_priv.h
+++ b/src/lib/elementary/elm_priv.h
@@ -883,4 +883,5 @@ efl_ui_dir_is_horizontal(Efl_Ui_Dir dir, Eina_Bool def_val)
}
}
+void legacy_efl_ui_focus_manager_widget_legacy_signals(Efl_Ui_Focus_Manager *manager, Efl_Ui_Focus_Manager *emittee);
#endif
diff --git a/src/lib/elementary/elm_toolbar.c b/src/lib/elementary/elm_toolbar.c
index 95a896221d..717f5e9782 100644
--- a/src/lib/elementary/elm_toolbar.c
+++ b/src/lib/elementary/elm_toolbar.c
@@ -2981,6 +2981,7 @@ _elm_toolbar_efl_ui_widget_focus_state_apply(Eo *obj, Elm_Toolbar_Data *pd EINA_
EOLIAN static Eo *
_elm_toolbar_efl_object_constructor(Eo *obj, Elm_Toolbar_Data *_pd EINA_UNUSED)
{
+ legacy_efl_ui_focus_manager_widget_legacy_signals(obj, obj);
obj = efl_constructor(efl_super(obj, MY_CLASS));
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);