summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>2016-12-20 17:28:36 +0100
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>2017-04-20 14:38:58 +0200
commit1ecf648dd809953dc398ba21362f10a343589db8 (patch)
tree0591a4787e3d9a1e1ea5c0bf5db7c86b57235028
parentef8aed03854dabe9f7bb6d8689cd9f211bb1fd1c (diff)
downloadefl-1ecf648dd809953dc398ba21362f10a343589db8.tar.gz
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.
-rw-r--r--src/lib/elementary/elm_hover.c23
-rw-r--r--src/lib/elementary/elm_hover.eo2
-rw-r--r--src/lib/elementary/elm_widget_hover.h2
3 files changed, 22 insertions, 5 deletions
diff --git a/src/lib/elementary/elm_hover.c b/src/lib/elementary/elm_hover.c
index f39711fee8..d6d1f526ff 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 ec9e77e3f1..49c55682a9 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 25fbe25a23..05b531c371 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;
};
/**