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.
This commit is contained in:
Marcel Hollerbach 2016-12-20 17:28:36 +01:00
parent ef8aed0385
commit 1ecf648dd8
3 changed files with 22 additions and 5 deletions

View File

@ -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)

View File

@ -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;

View File

@ -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;
};
/**