elm: add unfocus / focus signals to gen* and toolbar
this adds back unfocus / focus emitting when items in those containers are getting focus. Differential Revision: https://phab.enlightenment.org/D7100
This commit is contained in:
parent
295418ed59
commit
c5add3ef40
|
@ -340,3 +340,43 @@ elm_object_focus_set(Evas_Object *obj,
|
||||||
evas_object_focus_set(obj, focus);
|
evas_object_focus_set(obj, focus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//legacy helpers that are used in code
|
||||||
|
typedef struct {
|
||||||
|
Eina_Bool focused;
|
||||||
|
Eo *emittee;
|
||||||
|
} Legacy_Manager_Focus_State;
|
||||||
|
|
||||||
|
static void
|
||||||
|
_focus_manager_focused(void *data, const Efl_Event *ev)
|
||||||
|
{
|
||||||
|
Legacy_Manager_Focus_State *state = data;
|
||||||
|
Eina_Bool currently_focused = !!efl_ui_focus_manager_focus_get(ev->object);
|
||||||
|
|
||||||
|
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
|
||||||
|
_focus_manager_del(void *data, const Efl_Event *ev EINA_UNUSED)
|
||||||
|
{
|
||||||
|
free(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
legacy_efl_ui_focus_manager_widget_legacy_signals(Efl_Ui_Focus_Manager *manager, Efl_Ui_Focus_Manager *emittee)
|
||||||
|
{
|
||||||
|
Legacy_Manager_Focus_State *state = calloc(1, sizeof(Legacy_Manager_Focus_State));
|
||||||
|
|
||||||
|
state->emittee = emittee;
|
||||||
|
state->focused = EINA_FALSE;
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
|
@ -4257,6 +4257,7 @@ _gengrid_element_focused(void *data, const Efl_Event *ev)
|
||||||
EOLIAN static Eo *
|
EOLIAN static Eo *
|
||||||
_elm_gengrid_efl_object_constructor(Eo *obj, Elm_Gengrid_Data *sd)
|
_elm_gengrid_efl_object_constructor(Eo *obj, Elm_Gengrid_Data *sd)
|
||||||
{
|
{
|
||||||
|
legacy_efl_ui_focus_manager_widget_legacy_signals(obj, obj);
|
||||||
sd->content_item_map = eina_hash_pointer_new(NULL);
|
sd->content_item_map = eina_hash_pointer_new(NULL);
|
||||||
sd->provider = efl_add(EFL_UI_FOCUS_PARENT_PROVIDER_GEN_CLASS, obj,
|
sd->provider = efl_add(EFL_UI_FOCUS_PARENT_PROVIDER_GEN_CLASS, obj,
|
||||||
efl_ui_focus_parent_provider_gen_container_set(efl_added, obj),
|
efl_ui_focus_parent_provider_gen_container_set(efl_added, obj),
|
||||||
|
|
|
@ -5911,6 +5911,7 @@ _genlist_element_focused(void *data, const Efl_Event *ev)
|
||||||
EOLIAN static Eo *
|
EOLIAN static Eo *
|
||||||
_elm_genlist_efl_object_constructor(Eo *obj, Elm_Genlist_Data *sd)
|
_elm_genlist_efl_object_constructor(Eo *obj, Elm_Genlist_Data *sd)
|
||||||
{
|
{
|
||||||
|
legacy_efl_ui_focus_manager_widget_legacy_signals(obj, obj);
|
||||||
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
||||||
|
|
||||||
sd->content_item_map = eina_hash_pointer_new(NULL);
|
sd->content_item_map = eina_hash_pointer_new(NULL);
|
||||||
|
|
|
@ -883,4 +883,5 @@ efl_ui_dir_is_horizontal(Efl_Ui_Dir dir, Eina_Bool def_val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void legacy_efl_ui_focus_manager_widget_legacy_signals(Efl_Ui_Focus_Manager *manager, Efl_Ui_Focus_Manager *emittee);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2981,6 +2981,7 @@ _elm_toolbar_efl_ui_widget_focus_state_apply(Eo *obj, Elm_Toolbar_Data *pd EINA_
|
||||||
EOLIAN static Eo *
|
EOLIAN static Eo *
|
||||||
_elm_toolbar_efl_object_constructor(Eo *obj, Elm_Toolbar_Data *_pd EINA_UNUSED)
|
_elm_toolbar_efl_object_constructor(Eo *obj, Elm_Toolbar_Data *_pd EINA_UNUSED)
|
||||||
{
|
{
|
||||||
|
legacy_efl_ui_focus_manager_widget_legacy_signals(obj, obj);
|
||||||
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
||||||
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
|
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
|
||||||
evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
|
evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
|
||||||
|
|
Loading…
Reference in New Issue