forked from enlightenment/efl
elm_popup: ensure focus is emitted on this object
Summary: This mirrors the focus property from the notify to the one from popup. This is needed to establish legacy behaviour, as earlier popup was able to get focus. ref T6707 Depends on D6510 Reviewers: zmike, devilhorns Reviewed By: zmike Subscribers: cedric, #committers Tags: #efl Maniphest Tasks: T6707 Differential Revision: https://phab.enlightenment.org/D6511
This commit is contained in:
parent
11147284fe
commit
7a8ff655c8
|
@ -224,6 +224,17 @@ _items_remove(Elm_Popup_Data *sd)
|
||||||
sd->items = NULL;
|
sd->items = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_focus_changed_popup(void *data, const Efl_Event *ev)
|
||||||
|
{
|
||||||
|
//mirror property
|
||||||
|
efl_ui_focus_object_focus_set(data, efl_ui_focus_object_focus_get(ev->object));
|
||||||
|
}
|
||||||
|
|
||||||
|
EFL_CALLBACKS_ARRAY_DEFINE(composition_cb,
|
||||||
|
{ EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_CHANGED, _focus_changed_popup },
|
||||||
|
)
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_elm_popup_efl_canvas_group_group_del(Eo *obj, Elm_Popup_Data *sd)
|
_elm_popup_efl_canvas_group_group_del(Eo *obj, Elm_Popup_Data *sd)
|
||||||
{
|
{
|
||||||
|
@ -237,6 +248,7 @@ _elm_popup_efl_canvas_group_group_del(Eo *obj, Elm_Popup_Data *sd)
|
||||||
evas_object_event_callback_del
|
evas_object_event_callback_del
|
||||||
(sd->content, EVAS_CALLBACK_DEL, _on_content_del);
|
(sd->content, EVAS_CALLBACK_DEL, _on_content_del);
|
||||||
evas_object_event_callback_del(obj, EVAS_CALLBACK_SHOW, _on_show);
|
evas_object_event_callback_del(obj, EVAS_CALLBACK_SHOW, _on_show);
|
||||||
|
efl_event_callback_array_del(sd->notify, composition_cb(), obj);
|
||||||
|
|
||||||
sd->last_button_number = 0;
|
sd->last_button_number = 0;
|
||||||
|
|
||||||
|
@ -1425,6 +1437,7 @@ _elm_popup_efl_canvas_group_group_add(Eo *obj, Elm_Popup_Data *priv)
|
||||||
elm_object_mirrored_set(priv->notify, elm_object_mirrored_get(obj));
|
elm_object_mirrored_set(priv->notify, elm_object_mirrored_get(obj));
|
||||||
|
|
||||||
evas_object_event_callback_add(priv->notify, EVAS_CALLBACK_RESIZE, _notify_resize_cb, obj);
|
evas_object_event_callback_add(priv->notify, EVAS_CALLBACK_RESIZE, _notify_resize_cb, obj);
|
||||||
|
efl_event_callback_array_add(priv->notify, composition_cb(), obj);
|
||||||
|
|
||||||
priv->main_layout = elm_layout_add(obj);
|
priv->main_layout = elm_layout_add(obj);
|
||||||
if (!elm_layout_theme_set(priv->main_layout, "popup", "base",
|
if (!elm_layout_theme_set(priv->main_layout, "popup", "base",
|
||||||
|
|
|
@ -41,8 +41,38 @@ EFL_START_TEST (elm_atspi_role_get)
|
||||||
}
|
}
|
||||||
EFL_END_TEST
|
EFL_END_TEST
|
||||||
|
|
||||||
|
static void
|
||||||
|
_focus_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
||||||
|
void *event_info EINA_UNUSED)
|
||||||
|
{
|
||||||
|
*((Eina_Bool*)data) = EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
EFL_START_TEST (elm_popup_focus_get)
|
||||||
|
{
|
||||||
|
Evas_Object *win, *popup;
|
||||||
|
Eina_Bool focused = EINA_FALSE;
|
||||||
|
|
||||||
|
win = win_add(NULL, "popup", ELM_WIN_BASIC);
|
||||||
|
|
||||||
|
popup = elm_popup_add(win);
|
||||||
|
elm_popup_scrollable_set(popup, EINA_TRUE);
|
||||||
|
elm_object_text_set(popup, "This Popup has content area and "
|
||||||
|
"timeout value is 3 seconds");
|
||||||
|
elm_popup_timeout_set(popup, 3.0);
|
||||||
|
evas_object_smart_callback_add(popup, "focused", _focus_cb, &focused);
|
||||||
|
|
||||||
|
// popup show should be called after adding all the contents and the buttons
|
||||||
|
// of popup to set the focus into popup's contents correctly.
|
||||||
|
evas_object_show(popup);
|
||||||
|
ck_assert(focused);
|
||||||
|
}
|
||||||
|
EFL_END_TEST
|
||||||
|
|
||||||
void elm_test_popup(TCase *tc)
|
void elm_test_popup(TCase *tc)
|
||||||
{
|
{
|
||||||
|
tcase_add_test(tc, elm_popup_focus_get);
|
||||||
tcase_add_test(tc, elm_popup_legacy_type_check);
|
tcase_add_test(tc, elm_popup_legacy_type_check);
|
||||||
tcase_add_test(tc, elm_atspi_role_get);
|
tcase_add_test(tc, elm_atspi_role_get);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue