bu5hm4n pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=9f758dc363f9ff2bacb84781f9dd07650a642eeb

commit 9f758dc363f9ff2bacb84781f9dd07650a642eeb
Author: Marcel Hollerbach <[email protected]>
Date:   Mon Oct 22 13:39:06 2018 +0200

    elm: update widgets that have documented focus and unfocused events
    
    this emits focus and unfocus on those widgets.
    
    fixes T7386
    
    Depends on D7124
    
    Differential Revision: https://phab.enlightenment.org/D7103
---
 src/lib/elementary/efl_ui_button.c           |  1 +
 src/lib/elementary/efl_ui_check.c            |  1 +
 src/lib/elementary/efl_ui_image_zoomable.c   |  2 +-
 src/lib/elementary/efl_ui_progressbar.c      |  1 +
 src/lib/elementary/efl_ui_radio.c            |  1 +
 src/lib/elementary/efl_ui_video.c            |  2 +
 src/lib/elementary/efl_ui_widget.c           | 11 ------
 src/lib/elementary/elc_fileselector.c        |  1 +
 src/lib/elementary/elc_fileselector_button.c |  1 +
 src/lib/elementary/elc_fileselector_entry.c  |  1 +
 src/lib/elementary/elc_hoversel.c            |  1 +
 src/lib/elementary/elc_multibuttonentry.c    | 42 +-------------------
 src/lib/elementary/elc_naviframe.c           |  1 +
 src/lib/elementary/elc_popup.c               |  1 +
 src/lib/elementary/elm_clock.c               |  1 +
 src/lib/elementary/elm_color_item.eo         |  2 +
 src/lib/elementary/elm_colorselector.c       | 16 +++++++-
 src/lib/elementary/elm_datetime.c            |  1 +
 src/lib/elementary/elm_diskselector.c        |  1 +
 src/lib/elementary/elm_entry.c               |  1 +
 src/lib/elementary/elm_flipselector.c        |  1 +
 src/lib/elementary/elm_focus_legacy.c        | 57 ++++++++++++++++++++++++++++
 src/lib/elementary/elm_glview.c              |  7 ++++
 src/lib/elementary/elm_glview.eo             |  1 +
 src/lib/elementary/elm_hover.c               |  1 +
 src/lib/elementary/elm_map.c                 |  1 +
 src/lib/elementary/elm_priv.h                | 17 +++++++++
 src/lib/elementary/elm_scroller.c            |  2 +
 src/lib/elementary/elm_slideshow.c           |  1 +
 src/lib/elementary/elm_spinner.c             |  1 +
 src/lib/elementary/elm_web2.c                |  2 +-
 31 files changed, 126 insertions(+), 54 deletions(-)

diff --git a/src/lib/elementary/efl_ui_button.c 
b/src/lib/elementary/efl_ui_button.c
index ea644b6277..a26be9ca71 100644
--- a/src/lib/elementary/efl_ui_button.c
+++ b/src/lib/elementary/efl_ui_button.c
@@ -417,6 +417,7 @@ EOLIAN static Eo *
 _efl_ui_button_legacy_efl_object_constructor(Eo *obj, void *_pd EINA_UNUSED)
 {
    obj = efl_constructor(efl_super(obj, EFL_UI_BUTTON_LEGACY_CLASS));
+   legacy_object_focus_handle(obj);
    efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
    return obj;
 }
diff --git a/src/lib/elementary/efl_ui_check.c 
b/src/lib/elementary/efl_ui_check.c
index 4e1d197cdf..a034d7d969 100644
--- a/src/lib/elementary/efl_ui_check.c
+++ b/src/lib/elementary/efl_ui_check.c
@@ -466,6 +466,7 @@ _efl_ui_check_legacy_efl_object_constructor(Eo *obj, void 
*pd EINA_UNUSED)
 {
    obj = efl_constructor(efl_super(obj, EFL_UI_CHECK_LEGACY_CLASS));
    efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
+   legacy_object_focus_handle(obj);
    return obj;
 }
 
diff --git a/src/lib/elementary/efl_ui_image_zoomable.c 
b/src/lib/elementary/efl_ui_image_zoomable.c
index 7526260747..a11f2170cf 100644
--- a/src/lib/elementary/efl_ui_image_zoomable.c
+++ b/src/lib/elementary/efl_ui_image_zoomable.c
@@ -1971,7 +1971,7 @@ _efl_ui_image_zoomable_efl_object_constructor(Eo *obj, 
Efl_Ui_Image_Zoomable_Dat
    obj = efl_constructor(efl_super(obj, MY_CLASS));
    evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
    efl_access_object_role_set(obj, EFL_ACCESS_ROLE_IMAGE);
-
+   legacy_object_focus_handle(obj);
    return obj;
 }
 
diff --git a/src/lib/elementary/efl_ui_progressbar.c 
b/src/lib/elementary/efl_ui_progressbar.c
index be7fe5df7b..efeac3d3d0 100644
--- a/src/lib/elementary/efl_ui_progressbar.c
+++ b/src/lib/elementary/efl_ui_progressbar.c
@@ -795,6 +795,7 @@ _efl_ui_progressbar_legacy_efl_object_constructor(Eo *obj, 
void *pd EINA_UNUSED)
 {
    obj = efl_constructor(efl_super(obj, EFL_UI_PROGRESSBAR_LEGACY_CLASS));
    efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
+   legacy_object_focus_handle(obj);
    return obj;
 }
 
diff --git a/src/lib/elementary/efl_ui_radio.c 
b/src/lib/elementary/efl_ui_radio.c
index 3ed97d2af8..6f3fad801e 100644
--- a/src/lib/elementary/efl_ui_radio.c
+++ b/src/lib/elementary/efl_ui_radio.c
@@ -391,6 +391,7 @@ _efl_ui_radio_legacy_efl_object_constructor(Eo *obj, void 
*_pd EINA_UNUSED)
 {
    obj = efl_constructor(efl_super(obj, EFL_UI_RADIO_LEGACY_CLASS));
    efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
+   legacy_object_focus_handle(obj);
    return obj;
 }
 
diff --git a/src/lib/elementary/efl_ui_video.c 
b/src/lib/elementary/efl_ui_video.c
index c9afad2f13..3d7bf74e5a 100644
--- a/src/lib/elementary/efl_ui_video.c
+++ b/src/lib/elementary/efl_ui_video.c
@@ -439,6 +439,8 @@ _efl_ui_video_legacy_efl_object_constructor(Eo *obj, void 
*_pd EINA_UNUSED)
 {
    obj = efl_constructor(efl_super(obj, EFL_UI_VIDEO_LEGACY_CLASS));
    efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
+   legacy_object_focus_handle(obj);
+
    return obj;
 }
 
diff --git a/src/lib/elementary/efl_ui_widget.c 
b/src/lib/elementary/efl_ui_widget.c
index b4e59134ad..717f8490c0 100644
--- a/src/lib/elementary/efl_ui_widget.c
+++ b/src/lib/elementary/efl_ui_widget.c
@@ -5345,15 +5345,6 @@ elm_widget_tree_dot_dump(const Evas_Object *top,
 #endif
 }
 
-static void
-_focus_event_changed(void *data EINA_UNUSED, const Efl_Event *event)
-{
-   if (efl_ui_focus_object_focus_get(event->object))
-     evas_object_smart_callback_call(event->object, "focused", NULL);
-   else
-     evas_object_smart_callback_call(event->object, "unfocused", NULL);
-}
-
 EOLIAN static Eo *
 _efl_ui_widget_efl_object_constructor(Eo *obj, Elm_Widget_Smart_Data *sd 
EINA_UNUSED)
 {
@@ -5370,8 +5361,6 @@ _efl_ui_widget_efl_object_constructor(Eo *obj, 
Elm_Widget_Smart_Data *sd EINA_UN
 
    efl_access_object_role_set(obj, EFL_ACCESS_ROLE_UNKNOWN);
 
-   efl_event_callback_add(obj, EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_CHANGED, 
_focus_event_changed, NULL);
-
    return obj;
 }
 
diff --git a/src/lib/elementary/elc_fileselector.c 
b/src/lib/elementary/elc_fileselector.c
index 274dcd87bd..e23dfe7326 100644
--- a/src/lib/elementary/elc_fileselector.c
+++ b/src/lib/elementary/elc_fileselector.c
@@ -1940,6 +1940,7 @@ EOLIAN static Eo *
 _elm_fileselector_efl_object_constructor(Eo *obj, Elm_Fileselector_Data *sd)
 {
    obj = efl_constructor(efl_super(obj, MY_CLASS));
+   legacy_child_focus_handle(obj);
    sd->obj = obj;
    efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
    evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
diff --git a/src/lib/elementary/elc_fileselector_button.c 
b/src/lib/elementary/elc_fileselector_button.c
index 76c60c1c38..2c86b7c0a5 100644
--- a/src/lib/elementary/elc_fileselector_button.c
+++ b/src/lib/elementary/elc_fileselector_button.c
@@ -278,6 +278,7 @@ _elm_fileselector_button_efl_object_constructor(Eo *obj, 
Elm_Fileselector_Button
    efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
    evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
    efl_access_object_role_set(obj, EFL_ACCESS_ROLE_PUSH_BUTTON);
+   legacy_object_focus_handle(obj);
 
    return obj;
 }
diff --git a/src/lib/elementary/elc_fileselector_entry.c 
b/src/lib/elementary/elc_fileselector_entry.c
index d2b3b380f2..cc980c366c 100644
--- a/src/lib/elementary/elc_fileselector_entry.c
+++ b/src/lib/elementary/elc_fileselector_entry.c
@@ -308,6 +308,7 @@ _elm_fileselector_entry_efl_object_constructor(Eo *obj, 
Elm_Fileselector_Entry_D
    efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
    evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
    efl_access_object_role_set(obj, EFL_ACCESS_ROLE_GROUPING);
+   legacy_child_focus_handle(obj);
 
    return obj;
 }
diff --git a/src/lib/elementary/elc_hoversel.c 
b/src/lib/elementary/elc_hoversel.c
index 7c8efd4eb3..061be07321 100644
--- a/src/lib/elementary/elc_hoversel.c
+++ b/src/lib/elementary/elc_hoversel.c
@@ -707,6 +707,7 @@ _elm_hoversel_efl_object_constructor(Eo *obj, 
Elm_Hoversel_Data *_pd EINA_UNUSED
    efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
    evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
    efl_access_object_role_set(obj, EFL_ACCESS_ROLE_PUSH_BUTTON);
+   legacy_object_focus_handle(obj);
 
    return obj;
 }
diff --git a/src/lib/elementary/elc_multibuttonentry.c 
b/src/lib/elementary/elc_multibuttonentry.c
index 7a011ec9ea..32df238a9d 100644
--- a/src/lib/elementary/elc_multibuttonentry.c
+++ b/src/lib/elementary/elc_multibuttonentry.c
@@ -1647,54 +1647,16 @@ elm_multibuttonentry_add(Evas_Object *parent)
    return elm_legacy_add(MY_CLASS, parent);
 }
 
-static void
-_legacy_focused(void *data, const Efl_Event *ev)
-{
-   Efl_Ui_Focus_Object *new_focus;
-   Eina_Bool meaningful_focus_in = EINA_FALSE, meaningful_focus_out = 
EINA_FALSE;
-   ELM_MULTIBUTTONENTRY_DATA_GET(data, pd);
-
-   new_focus = efl_ui_focus_manager_focus_get(ev->object);
-
-   if (efl_isa(ev->info, EFL_UI_WIDGET_CLASS) && 
elm_widget_parent_get(ev->info) == pd->box)
-     {
-        meaningful_focus_out = EINA_TRUE;
-     }
-
-   if (efl_isa(new_focus, EFL_UI_WIDGET_CLASS) && 
elm_widget_parent_get(new_focus) == pd->box)
-     {
-        meaningful_focus_in = EINA_TRUE;
-     }
-
-   if (meaningful_focus_in && !meaningful_focus_out)
-     {
-        evas_object_smart_callback_call(data, "focused", NULL);
-     }
-
-   if (!meaningful_focus_in && meaningful_focus_out)
-     {
-        evas_object_smart_callback_call(data, "unfocused", NULL);
-     }
-}
-
-static void
-_legacy_manager_changed_cb(void *data EINA_UNUSED, const Efl_Event *ev)
-{
-   efl_event_callback_del(ev->info, EFL_UI_FOCUS_MANAGER_EVENT_FOCUS_CHANGED, 
_legacy_focused, ev->object);
-   efl_event_callback_add(efl_ui_focus_object_focus_manager_get(ev->object), 
EFL_UI_FOCUS_MANAGER_EVENT_FOCUS_CHANGED, _legacy_focused, ev->object);
-}
-
 EOLIAN static Eo *
 _elm_multibuttonentry_efl_object_constructor(Eo *obj, 
Elm_Multibuttonentry_Data *sd EINA_UNUSED)
 {
+
+   legacy_child_focus_handle(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);
    efl_access_object_role_set(obj, EFL_ACCESS_ROLE_PANEL);
 
-   //listen to manager changes here
-   efl_event_callback_add(obj, EFL_UI_FOCUS_OBJECT_EVENT_MANAGER_CHANGED, 
_legacy_manager_changed_cb, NULL);
-
    return obj;
 }
 
diff --git a/src/lib/elementary/elc_naviframe.c 
b/src/lib/elementary/elc_naviframe.c
index b16f2c116a..25966925d6 100644
--- a/src/lib/elementary/elc_naviframe.c
+++ b/src/lib/elementary/elc_naviframe.c
@@ -1608,6 +1608,7 @@ _elm_naviframe_efl_object_constructor(Eo *obj, 
Elm_Naviframe_Data *sd)
 {
    obj = efl_constructor(efl_super(obj, MY_CLASS));
    sd->obj = obj;
+   legacy_child_focus_handle(obj);
    efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
    evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
    efl_access_object_role_set(obj, EFL_ACCESS_ROLE_PAGE_TAB_LIST);
diff --git a/src/lib/elementary/elc_popup.c b/src/lib/elementary/elc_popup.c
index 048e778108..fa6091cc5e 100644
--- a/src/lib/elementary/elc_popup.c
+++ b/src/lib/elementary/elc_popup.c
@@ -1548,6 +1548,7 @@ _elm_popup_efl_object_constructor(Eo *obj, Elm_Popup_Data 
*_pd EINA_UNUSED)
    efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
    evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
    efl_access_object_role_set(obj, EFL_ACCESS_ROLE_DIALOG);
+   legacy_object_focus_handle(obj);
 
    return obj;
 }
diff --git a/src/lib/elementary/elm_clock.c b/src/lib/elementary/elm_clock.c
index db851796f7..3fd8178bae 100644
--- a/src/lib/elementary/elm_clock.c
+++ b/src/lib/elementary/elm_clock.c
@@ -808,6 +808,7 @@ _elm_clock_efl_object_constructor(Eo *obj, Elm_Clock_Data 
*_pd EINA_UNUSED)
    efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
    evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
    efl_access_object_role_set(obj, EFL_ACCESS_ROLE_TEXT);
+   legacy_child_focus_handle(obj);
 
    return obj;
 }
diff --git a/src/lib/elementary/elm_color_item.eo 
b/src/lib/elementary/elm_color_item.eo
index ba473f207f..c784d1f9db 100644
--- a/src/lib/elementary/elm_color_item.eo
+++ b/src/lib/elementary/elm_color_item.eo
@@ -44,6 +44,8 @@ class Elm.Color.Item(Elm.Widget.Item, Efl.Ui.Focus.Object, 
Efl.Access.Widget.Act
       Elm.Widget.Item.item_focus { get; set; }
       Efl.Ui.Focus.Object.focus { set; }
       Efl.Ui.Focus.Object.focus_geometry { get; }
+      Efl.Ui.Focus.Object.focus_parent { get; }
+      Efl.Ui.Focus.Object.focus_manager { get; }
       Efl.Access.Object.state_set { get; }
       Efl.Access.Object.i18n_name { get; }
       Efl.Access.Widget.Action.elm_actions { get; }
diff --git a/src/lib/elementary/elm_colorselector.c 
b/src/lib/elementary/elm_colorselector.c
index 72d1a040b1..8021754bcb 100644
--- a/src/lib/elementary/elm_colorselector.c
+++ b/src/lib/elementary/elm_colorselector.c
@@ -1771,7 +1771,7 @@ _elm_color_item_efl_object_constructor(Eo *eo_item, 
Elm_Color_Item_Data *item)
 
    Evas_Object *obj;
    obj = efl_parent_get(eo_item);
-
+   WIDGET(item) = obj;
    VIEW_SET(item, elm_layout_add(obj));
    if (!elm_layout_theme_set
        (VIEW(item), "colorselector", "item", elm_widget_style_get(obj)))
@@ -2282,6 +2282,7 @@ _elm_colorselector_efl_object_constructor(Eo *obj, 
Elm_Colorselector_Data *_pd E
    efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
    evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
    efl_access_object_role_set(obj, EFL_ACCESS_ROLE_COLOR_CHOOSER);
+   legacy_child_focus_handle(obj);
 
    return obj;
 }
@@ -2723,6 +2724,19 @@ _elm_color_item_efl_ui_focus_object_focus_set(Eo *obj, 
Elm_Color_Item_Data *pd,
    elm_object_item_focus_set(obj, focus);
 }
 
+EOLIAN static Efl_Ui_Focus_Object*
+_elm_color_item_efl_ui_focus_object_focus_parent_get(const Eo *obj 
EINA_UNUSED, Elm_Color_Item_Data *pd)
+{
+   return WIDGET(pd);
+}
+
+EOLIAN static Efl_Ui_Focus_Manager*
+_elm_color_item_efl_ui_focus_object_focus_manager_get(const Eo *obj, 
Elm_Color_Item_Data *pd)
+{
+   return efl_ui_focus_object_focus_manager_get(WIDGET(pd));
+}
+
+
 /* Standard widget overrides */
 
 ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(elm_colorselector, 
Elm_Colorselector_Data)
diff --git a/src/lib/elementary/elm_datetime.c 
b/src/lib/elementary/elm_datetime.c
index 97fc763291..3ea11e0ece 100644
--- a/src/lib/elementary/elm_datetime.c
+++ b/src/lib/elementary/elm_datetime.c
@@ -32,6 +32,7 @@ _efl_ui_clock_legacy_efl_object_constructor(Eo *obj, void *pd 
EINA_UNUSED)
 {
    obj = efl_constructor(efl_super(obj, EFL_UI_CLOCK_LEGACY_CLASS));
    efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
+   legacy_child_focus_handle(obj);
    return obj;
 }
 
diff --git a/src/lib/elementary/elm_diskselector.c 
b/src/lib/elementary/elm_diskselector.c
index 1c6d3493b8..ce2e9d5cf8 100644
--- a/src/lib/elementary/elm_diskselector.c
+++ b/src/lib/elementary/elm_diskselector.c
@@ -1417,6 +1417,7 @@ _elm_diskselector_efl_object_constructor(Eo *obj, 
Elm_Diskselector_Data *_pd EIN
    efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
    evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
    efl_access_object_role_set(obj, EFL_ACCESS_ROLE_LIST);
+   legacy_object_focus_handle(obj);
 
    return obj;
 }
diff --git a/src/lib/elementary/elm_entry.c b/src/lib/elementary/elm_entry.c
index 4a33ff230e..c4a4344967 100644
--- a/src/lib/elementary/elm_entry.c
+++ b/src/lib/elementary/elm_entry.c
@@ -4127,6 +4127,7 @@ _elm_entry_efl_object_constructor(Eo *obj, Elm_Entry_Data 
*_pd EINA_UNUSED)
    efl_access_object_role_set(obj, EFL_ACCESS_ROLE_ENTRY);
    efl_event_callback_add(obj, EFL_EVENT_CALLBACK_ADD, _cb_added, NULL);
    efl_event_callback_add(obj, EFL_EVENT_CALLBACK_DEL, _cb_deleted, NULL);
+   legacy_object_focus_handle(obj);
 
    return obj;
 }
diff --git a/src/lib/elementary/elm_flipselector.c 
b/src/lib/elementary/elm_flipselector.c
index a059e9db62..459f4cc2a1 100644
--- a/src/lib/elementary/elm_flipselector.c
+++ b/src/lib/elementary/elm_flipselector.c
@@ -665,6 +665,7 @@ _elm_flipselector_efl_object_constructor(Eo *obj, 
Elm_Flipselector_Data *sd)
    efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
    evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
    efl_access_object_role_set(obj, EFL_ACCESS_ROLE_LIST);
+   legacy_object_focus_handle(obj);
 
    return obj;
 }
diff --git a/src/lib/elementary/elm_focus_legacy.c 
b/src/lib/elementary/elm_focus_legacy.c
index 2e8b90511e..e3de5a97a6 100644
--- a/src/lib/elementary/elm_focus_legacy.c
+++ b/src/lib/elementary/elm_focus_legacy.c
@@ -380,3 +380,60 @@ 
legacy_efl_ui_focus_manager_widget_legacy_signals(Efl_Ui_Focus_Manager *manager,
    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);
 }
+
+typedef struct {
+  Eina_Bool focused;
+  Efl_Ui_Focus_Manager *registered_manager;
+  Eo *emittee;
+} Legacy_Object_Focus_State;
+
+static void
+_manager_focus_changed(void *data, const Efl_Event *ev EINA_UNUSED)
+{
+   Legacy_Object_Focus_State *state = data;
+   Eina_Bool currently_focused = 
efl_ui_focus_object_child_focus_get(state->emittee);
+
+   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
+_manager_focus_object_changed(void *data, const Efl_Event *ev EINA_UNUSED)
+{
+   Legacy_Object_Focus_State *state = data;
+   if (state->registered_manager)
+     efl_event_callback_del(state->registered_manager, 
EFL_UI_FOCUS_MANAGER_EVENT_FOCUS_CHANGED, _manager_focus_changed, state);
+   state->registered_manager = 
efl_ui_focus_object_focus_manager_get(state->emittee);
+   if (state->registered_manager)
+     efl_event_callback_add(state->registered_manager, 
EFL_UI_FOCUS_MANAGER_EVENT_FOCUS_CHANGED, _manager_focus_changed, state);
+}
+
+void
+legacy_child_focus_handle(Efl_Ui_Focus_Object *object)
+{
+   Legacy_Object_Focus_State *state = calloc(1, 
sizeof(Legacy_Object_Focus_State));
+   state->emittee = object;
+
+   efl_event_callback_add(object, EFL_UI_FOCUS_OBJECT_EVENT_MANAGER_CHANGED, 
_manager_focus_object_changed, state);
+   efl_event_callback_add(object, EFL_EVENT_DEL, _focus_manager_del, state);
+}
+
+static void
+_focus_event_changed(void *data EINA_UNUSED, const Efl_Event *event)
+{
+   if (efl_ui_focus_object_focus_get(event->object))
+     evas_object_smart_callback_call(event->object, "focused", NULL);
+   else
+     evas_object_smart_callback_call(event->object, "unfocused", NULL);
+}
+
+void
+legacy_object_focus_handle(Efl_Ui_Focus_Object *object)
+{
+   efl_event_callback_add(object, EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_CHANGED, 
_focus_event_changed, NULL);
+}
diff --git a/src/lib/elementary/elm_glview.c b/src/lib/elementary/elm_glview.c
index 4ae1da51dc..8f61da8645 100644
--- a/src/lib/elementary/elm_glview.c
+++ b/src/lib/elementary/elm_glview.c
@@ -362,6 +362,13 @@ _elm_glview_version_constructor(Eo *obj, Elm_Glview_Data 
*sd,
    efl_event_callback_add(obj, EFL_EVENT_CALLBACK_ADD, _cb_added, NULL);
 }
 
+EOLIAN static Efl_Object*
+_elm_glview_efl_object_constructor(Eo *obj, Elm_Glview_Data *pd)
+{
+   legacy_object_focus_handle(obj);
+   return efl_constructor(efl_super(obj, MY_CLASS));
+}
+
 EOLIAN static Eo *
 _elm_glview_efl_object_finalize(Eo *obj, Elm_Glview_Data *sd)
 {
diff --git a/src/lib/elementary/elm_glview.eo b/src/lib/elementary/elm_glview.eo
index 74cc36fd45..05c5498b53 100644
--- a/src/lib/elementary/elm_glview.eo
+++ b/src/lib/elementary/elm_glview.eo
@@ -188,6 +188,7 @@ class Elm.Glview (Efl.Ui.Widget, Efl.Gfx.View, 
Efl.Ui.Legacy)
    }
    implements {
       class.constructor;
+      Efl.Object.constructor;
       Efl.Object.finalize;
       Efl.Gfx.Entity.size { set; }
       Efl.Ui.Focus.Object.on_focus_update;
diff --git a/src/lib/elementary/elm_hover.c b/src/lib/elementary/elm_hover.c
index 5a3a814058..21815f7482 100644
--- a/src/lib/elementary/elm_hover.c
+++ b/src/lib/elementary/elm_hover.c
@@ -697,6 +697,7 @@ _elm_hover_efl_object_constructor(Eo *obj, Elm_Hover_Data 
*pd EINA_UNUSED)
    efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
    evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
    efl_access_object_role_set(obj, EFL_ACCESS_ROLE_POPUP_MENU);
+   legacy_child_focus_handle(obj);
 
    return obj;
 }
diff --git a/src/lib/elementary/elm_map.c b/src/lib/elementary/elm_map.c
index 1da9859998..0a72dd980f 100644
--- a/src/lib/elementary/elm_map.c
+++ b/src/lib/elementary/elm_map.c
@@ -4300,6 +4300,7 @@ _elm_map_efl_object_constructor(Eo *obj, Elm_Map_Data *sd)
    efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
    evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
    efl_access_object_role_set(obj, EFL_ACCESS_ROLE_IMAGE_MAP);
+   legacy_object_focus_handle(obj);
 
    return obj;
 }
diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h
index b9f1113f7a..9a17e09697 100644
--- a/src/lib/elementary/elm_priv.h
+++ b/src/lib/elementary/elm_priv.h
@@ -883,5 +883,22 @@ efl_ui_dir_is_horizontal(Efl_Ui_Dir dir, Eina_Bool def_val)
      }
 }
 
+/**
+ * This function sets up handlers for emitting "unfocused" / "focused" events.
+ * Once the passed manager object is active, "focused" is emitted, if it gets 
inactive "unfocused" is emitted
+ */
 void legacy_efl_ui_focus_manager_widget_legacy_signals(Efl_Ui_Focus_Manager 
*manager, Efl_Ui_Focus_Manager *emittee);
+
+/**
+ * This function sets up handlers for emitting "unfocused" / "focused" events.
+ * Once the children of the passed object are getting focus, "focused" will be 
emitted on the object, "unfocused" otherwise.
+ */
+void legacy_child_focus_handle(Efl_Ui_Focus_Object *object);
+
+/**
+ * This function sets up handlers for emitting "unfocused" / "focused" events.
+ * Once the passed object is getting focus, "focused" will be emitted on the 
object, "unfocused" otherwise.
+ */
+void legacy_object_focus_handle(Efl_Ui_Focus_Object *object);
+
 #endif
diff --git a/src/lib/elementary/elm_scroller.c 
b/src/lib/elementary/elm_scroller.c
index 345f5f84cf..580d4d2257 100644
--- a/src/lib/elementary/elm_scroller.c
+++ b/src/lib/elementary/elm_scroller.c
@@ -889,6 +889,8 @@ _elm_scroller_efl_object_constructor(Eo *obj, 
Elm_Scroller_Data *_pd EINA_UNUSED
    evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
    efl_access_object_role_set(obj, EFL_ACCESS_ROLE_SCROLL_PANE);
    efl_event_callback_add(obj, EFL_UI_FOCUS_MANAGER_EVENT_FOCUS_CHANGED, 
_focused_element, obj);
+   legacy_efl_ui_focus_manager_widget_legacy_signals(obj, obj);
+
    return obj;
 }
 
diff --git a/src/lib/elementary/elm_slideshow.c 
b/src/lib/elementary/elm_slideshow.c
index 24d82883d8..925930b758 100644
--- a/src/lib/elementary/elm_slideshow.c
+++ b/src/lib/elementary/elm_slideshow.c
@@ -377,6 +377,7 @@ _elm_slideshow_efl_object_constructor(Eo *obj, 
Elm_Slideshow_Data *_pd EINA_UNUS
    efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
    evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
    efl_access_object_role_set(obj, EFL_ACCESS_ROLE_DOCUMENT_PRESENTATION);
+   legacy_object_focus_handle(obj);
 
    return obj;
 }
diff --git a/src/lib/elementary/elm_spinner.c b/src/lib/elementary/elm_spinner.c
index 3c2c08c727..e5d7cbfe77 100644
--- a/src/lib/elementary/elm_spinner.c
+++ b/src/lib/elementary/elm_spinner.c
@@ -1410,6 +1410,7 @@ EOLIAN static Eo *
 _elm_spinner_efl_object_constructor(Eo *obj, Elm_Spinner_Data *_pd EINA_UNUSED)
 {
    obj = efl_constructor(efl_super(obj, MY_CLASS));
+   legacy_child_focus_handle(obj);
    efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
    evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
    efl_access_object_role_set(obj, EFL_ACCESS_ROLE_SPIN_BUTTON);
diff --git a/src/lib/elementary/elm_web2.c b/src/lib/elementary/elm_web2.c
index 1339a5c6d1..3c82d927f7 100644
--- a/src/lib/elementary/elm_web2.c
+++ b/src/lib/elementary/elm_web2.c
@@ -100,7 +100,7 @@ _elm_web_efl_object_constructor(Eo *obj, Elm_Web_Data *sd)
    efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
    evas_object_smart_callbacks_descriptions_set(obj, _elm_web_smart_callbacks);
    efl_access_object_role_set(obj, EFL_ACCESS_ROLE_HTML_CONTAINER);
-
+   legacy_object_focus_handle(obj);
    return obj;
 }
 

-- 


Reply via email to