bu5hm4n pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=1ecf648dd809953dc398ba21362f10a343589db8

commit 1ecf648dd809953dc398ba21362f10a343589db8
Author: Marcel Hollerbach <[email protected]>
Date:   Tue Dec 20 17:28:36 2016 +0100

    elm_hover: migrate to new focus system
    
    the hover will set itself as redirect once it is visible. And unset
    itself once it is hidden.
---
 src/lib/elementary/elm_hover.c        | 23 +++++++++++++++++++----
 src/lib/elementary/elm_hover.eo       |  2 +-
 src/lib/elementary/elm_widget_hover.h |  2 ++
 3 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/src/lib/elementary/elm_hover.c b/src/lib/elementary/elm_hover.c
index f39711f..d6d1f52 100644
--- a/src/lib/elementary/elm_hover.c
+++ b/src/lib/elementary/elm_hover.c
@@ -646,14 +646,20 @@ _elm_hover_efl_gfx_size_set(Eo *obj, Elm_Hover_Data *_pd 
EINA_UNUSED, Evas_Coord
 }
 
 EOLIAN static void
-_elm_hover_efl_gfx_visible_set(Eo *obj, Elm_Hover_Data *_pd EINA_UNUSED, 
Eina_Bool vis)
+_elm_hover_efl_gfx_visible_set(Eo *obj, Elm_Hover_Data *pd, Eina_Bool vis)
 {
    if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_VISIBLE, 0, 
vis))
      return;
 
    efl_gfx_visible_set(efl_super(obj, MY_CLASS), vis);
 
-   if (vis) _hov_show_do(obj);
+   if (vis)
+     {
+        _hov_show_do(obj);
+        //we just set ourself as redirect in the next upper manager
+        pd->redirected = efl_ui_focus_user_manager_get(pd->target);
+        efl_ui_focus_manager_redirect_set(pd->redirected, obj);
+     }
    else
      {
         // for backward compatibility
@@ -661,6 +667,9 @@ _elm_hover_efl_gfx_visible_set(Eo *obj, Elm_Hover_Data *_pd 
EINA_UNUSED, Eina_Bo
 
         if (!eina_streq(dismissstr, "on"))
           _hide_signals_emit(obj);
+
+        efl_ui_focus_manager_redirect_set(pd->redirected, NULL);
+        pd->redirected = NULL;
      }
 }
 
@@ -679,13 +688,19 @@ elm_hover_add(Evas_Object *parent)
 }
 
 EOLIAN static Eo *
-_elm_hover_efl_object_constructor(Eo *obj, Elm_Hover_Data *_pd EINA_UNUSED)
+_elm_hover_efl_object_constructor(Eo *obj, Elm_Hover_Data *pd)
 {
    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);
    elm_interface_atspi_accessible_role_set(obj, ELM_ATSPI_ROLE_POPUP_MENU);
 
+   pd->manager = efl_add(EFL_UI_FOCUS_MANAGER_CLASS, NULL,
+    efl_ui_focus_manager_root_set(efl_added, obj)
+   );
+
+   efl_composite_attach(obj, pd->manager);
+
    return obj;
 }
 
@@ -716,8 +731,8 @@ _elm_hover_target_set(Eo *obj, Elm_Hover_Data *sd, 
Evas_Object *target)
         elm_widget_hover_object_set(target, obj);
         elm_layout_sizing_eval(obj);
      }
-}
 
+}
 EAPI void
 elm_hover_parent_set(Evas_Object *obj,
                      Evas_Object *parent)
diff --git a/src/lib/elementary/elm_hover.eo b/src/lib/elementary/elm_hover.eo
index ec9e77e..49c5568 100644
--- a/src/lib/elementary/elm_hover.eo
+++ b/src/lib/elementary/elm_hover.eo
@@ -7,7 +7,7 @@ enum Elm.Hover.Axis
    both [[ELM_HOVER_AXIS_BOTH -- both.]]
 }
 
-class Elm.Hover (Elm.Layout, Efl.Ui.Clickable, 
Elm.Interface.Atspi_Widget_Action)
+class Elm.Hover (Elm.Layout, Efl.Ui.Clickable, 
Elm.Interface.Atspi_Widget_Action, Efl.Ui.Focus.Manager)
 {
    [[Elementary hover class]]
    legacy_prefix: elm_hover;
diff --git a/src/lib/elementary/elm_widget_hover.h 
b/src/lib/elementary/elm_widget_hover.h
index 25fbe25..05b531c 100644
--- a/src/lib/elementary/elm_widget_hover.h
+++ b/src/lib/elementary/elm_widget_hover.h
@@ -46,6 +46,8 @@ struct _Elm_Hover_Data
                               sizeof(_content_aliases[0]) - 1];
 
    Eina_Bool             on_del : 1;
+   Efl_Ui_Focus_Manager *manager;
+   Efl_Ui_Focus_Manager *redirected;
 };
 
 /**

-- 


Reply via email to