elm_inwin: set this widget as a redirect
once this widget is visible, It should handle the focus of its children and leave no option to the underlaying widgets to gain focus. This is implemented by making it a redirect when it gets visible.
This commit is contained in:
parent
a7fb6e92b2
commit
94dad4c37a
|
@ -24,8 +24,13 @@ static const Elm_Layout_Part_Alias_Description _content_aliases[] =
|
|||
{NULL, NULL}
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
Efl_Ui_Focus_Manager *manager;
|
||||
Eina_Bool registered;
|
||||
} Elm_Inwin_Data;
|
||||
|
||||
EOLIAN static void
|
||||
_elm_inwin_elm_layout_sizing_eval(Eo *obj, void *_pd EINA_UNUSED)
|
||||
_elm_inwin_elm_layout_sizing_eval(Eo *obj, Elm_Inwin_Data *pd EINA_UNUSED)
|
||||
{
|
||||
Evas_Object *content;
|
||||
Evas_Coord minw = -1, minh = -1;
|
||||
|
@ -42,13 +47,13 @@ _elm_inwin_elm_layout_sizing_eval(Eo *obj, void *_pd EINA_UNUSED)
|
|||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_elm_inwin_elm_widget_focus_next_manager_is(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED)
|
||||
_elm_inwin_elm_widget_focus_next_manager_is(Eo *obj EINA_UNUSED, Elm_Inwin_Data *pd EINA_UNUSED)
|
||||
{
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_elm_inwin_elm_widget_focus_next(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, Elm_Focus_Direction dir, Evas_Object **next, Elm_Object_Item **next_item)
|
||||
_elm_inwin_elm_widget_focus_next(Eo *obj EINA_UNUSED, Elm_Inwin_Data *pd EINA_UNUSED, Elm_Focus_Direction dir, Evas_Object **next, Elm_Object_Item **next_item)
|
||||
{
|
||||
Evas_Object *content;
|
||||
|
||||
|
@ -67,7 +72,7 @@ _elm_inwin_elm_widget_focus_next(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, Elm
|
|||
}
|
||||
|
||||
EOLIAN static void
|
||||
_elm_inwin_efl_canvas_group_group_add(Eo *obj, void *_pd EINA_UNUSED)
|
||||
_elm_inwin_efl_canvas_group_group_add(Eo *obj, Elm_Inwin_Data *pd EINA_UNUSED)
|
||||
{
|
||||
efl_canvas_group_add(efl_super(obj, MY_CLASS));
|
||||
elm_widget_sub_object_parent_add(obj);
|
||||
|
@ -82,7 +87,7 @@ _elm_inwin_efl_canvas_group_group_add(Eo *obj, void *_pd EINA_UNUSED)
|
|||
}
|
||||
|
||||
EOLIAN static void
|
||||
_elm_inwin_elm_widget_widget_parent_set(Eo *obj, void *_pd EINA_UNUSED, Evas_Object *parent)
|
||||
_elm_inwin_elm_widget_widget_parent_set(Eo *obj, Elm_Inwin_Data *pd EINA_UNUSED, Evas_Object *parent)
|
||||
{
|
||||
elm_win_resize_object_add(parent, obj);
|
||||
|
||||
|
@ -90,7 +95,7 @@ _elm_inwin_elm_widget_widget_parent_set(Eo *obj, void *_pd EINA_UNUSED, Evas_Obj
|
|||
}
|
||||
|
||||
EOLIAN static const Elm_Layout_Part_Alias_Description*
|
||||
_elm_inwin_elm_layout_content_aliases_get(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED)
|
||||
_elm_inwin_elm_layout_content_aliases_get(Eo *obj EINA_UNUSED, Elm_Inwin_Data *pd EINA_UNUSED)
|
||||
{
|
||||
return _content_aliases;
|
||||
}
|
||||
|
@ -104,7 +109,7 @@ elm_win_inwin_add(Evas_Object *parent)
|
|||
}
|
||||
|
||||
EOLIAN static Eo *
|
||||
_elm_inwin_efl_object_constructor(Eo *obj, void *_pd EINA_UNUSED)
|
||||
_elm_inwin_efl_object_constructor(Eo *obj, Elm_Inwin_Data *pd EINA_UNUSED)
|
||||
{
|
||||
Evas_Object *parent = NULL;
|
||||
|
||||
|
@ -120,11 +125,17 @@ _elm_inwin_efl_object_constructor(Eo *obj, void *_pd EINA_UNUSED)
|
|||
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
|
||||
elm_interface_atspi_accessible_role_set(obj, ELM_ATSPI_ROLE_GLASS_PANE);
|
||||
|
||||
pd->manager = efl_add(EFL_UI_FOCUS_MANAGER_ROOT_FOCUS_CLASS, NULL,
|
||||
efl_ui_focus_manager_root_set(efl_added, obj)
|
||||
);
|
||||
|
||||
efl_composite_attach(obj, pd->manager);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_elm_inwin_activate(Eo *obj, void *_pd EINA_UNUSED)
|
||||
_elm_inwin_activate(Eo *obj, Elm_Inwin_Data *pd EINA_UNUSED)
|
||||
{
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||
|
||||
|
@ -137,6 +148,41 @@ _elm_inwin_activate(Eo *obj, void *_pd EINA_UNUSED)
|
|||
elm_object_focus_set(obj, EINA_TRUE);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_elm_inwin_efl_gfx_visible_set(Eo *obj, Elm_Inwin_Data *pd, Eina_Bool v)
|
||||
{
|
||||
efl_gfx_visible_set(efl_super(obj, MY_CLASS), v);
|
||||
Elm_Win *win;
|
||||
|
||||
win = elm_win_get(obj);
|
||||
|
||||
if (v && !pd->registered)
|
||||
{
|
||||
efl_ui_focus_manager_redirect_set(pd->manager, obj);
|
||||
pd->registered = EINA_TRUE;
|
||||
}
|
||||
else if (!v && pd->registered)
|
||||
{
|
||||
efl_ui_focus_manager_redirect_set(pd->manager, NULL);
|
||||
pd->registered = EINA_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Ui_Focus_Object*
|
||||
_elm_inwin_efl_ui_focus_manager_move(Eo *obj, Elm_Inwin_Data *pd, Efl_Ui_Focus_Direction direction)
|
||||
{
|
||||
Eo *ret = efl_ui_focus_manager_move(pd->manager , direction);
|
||||
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if ((direction == EFL_UI_FOCUS_DIRECTION_PREV) || (direction == EFL_UI_FOCUS_DIRECTION_NEXT))
|
||||
efl_ui_focus_manager_focus(pd->manager, obj);
|
||||
|
||||
return efl_ui_focus_manager_focused(obj);
|
||||
}
|
||||
|
||||
|
||||
EAPI void
|
||||
elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
|
||||
{
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
class Elm.Inwin (Elm.Layout)
|
||||
class Elm.Inwin (Elm.Layout, Efl.Ui.Focus.Manager)
|
||||
{
|
||||
[[Elementary inwin class]]
|
||||
legacy_prefix: elm_inwin;
|
||||
eo_prefix: elm_obj_win_inwin;
|
||||
data: null;
|
||||
methods {
|
||||
activate {
|
||||
[[Activates an inwin object, ensuring its visibility
|
||||
|
@ -27,5 +26,7 @@ class Elm.Inwin (Elm.Layout)
|
|||
Elm.Widget.focus_next;
|
||||
Elm.Layout.content_aliases { get; }
|
||||
Elm.Layout.sizing_eval;
|
||||
Efl.Gfx.visible { set; }
|
||||
Efl.Ui.Focus.Manager.move;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue