summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2018-07-05 15:09:21 -0400
committerMike Blumenkrantz <zmike@samsung.com>2018-07-05 15:09:21 -0400
commit7a8ff655c8c26afafadbf98d86d2bccb8c6ca3f2 (patch)
tree2b0e383787ac79b2b3b53918ee2fe9d0878c2a00
parent11147284fef1830ad7143714a04f3620a93ffba3 (diff)
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
-rw-r--r--src/lib/elementary/elc_popup.c13
-rw-r--r--src/tests/elementary/elm_test_popup.c30
2 files changed, 43 insertions, 0 deletions
diff --git a/src/lib/elementary/elc_popup.c b/src/lib/elementary/elc_popup.c
index 47a0dc1c35..504e45bba4 100644
--- a/src/lib/elementary/elc_popup.c
+++ b/src/lib/elementary/elc_popup.c
@@ -224,6 +224,17 @@ _items_remove(Elm_Popup_Data *sd)
224 sd->items = NULL; 224 sd->items = NULL;
225} 225}
226 226
227static void
228_focus_changed_popup(void *data, const Efl_Event *ev)
229{
230 //mirror property
231 efl_ui_focus_object_focus_set(data, efl_ui_focus_object_focus_get(ev->object));
232}
233
234EFL_CALLBACKS_ARRAY_DEFINE(composition_cb,
235 { EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_CHANGED, _focus_changed_popup },
236)
237
227EOLIAN static void 238EOLIAN static void
228_elm_popup_efl_canvas_group_group_del(Eo *obj, Elm_Popup_Data *sd) 239_elm_popup_efl_canvas_group_group_del(Eo *obj, Elm_Popup_Data *sd)
229{ 240{
@@ -237,6 +248,7 @@ _elm_popup_efl_canvas_group_group_del(Eo *obj, Elm_Popup_Data *sd)
237 evas_object_event_callback_del 248 evas_object_event_callback_del
238 (sd->content, EVAS_CALLBACK_DEL, _on_content_del); 249 (sd->content, EVAS_CALLBACK_DEL, _on_content_del);
239 evas_object_event_callback_del(obj, EVAS_CALLBACK_SHOW, _on_show); 250 evas_object_event_callback_del(obj, EVAS_CALLBACK_SHOW, _on_show);
251 efl_event_callback_array_del(sd->notify, composition_cb(), obj);
240 252
241 sd->last_button_number = 0; 253 sd->last_button_number = 0;
242 254
@@ -1425,6 +1437,7 @@ _elm_popup_efl_canvas_group_group_add(Eo *obj, Elm_Popup_Data *priv)
1425 elm_object_mirrored_set(priv->notify, elm_object_mirrored_get(obj)); 1437 elm_object_mirrored_set(priv->notify, elm_object_mirrored_get(obj));
1426 1438
1427 evas_object_event_callback_add(priv->notify, EVAS_CALLBACK_RESIZE, _notify_resize_cb, obj); 1439 evas_object_event_callback_add(priv->notify, EVAS_CALLBACK_RESIZE, _notify_resize_cb, obj);
1440 efl_event_callback_array_add(priv->notify, composition_cb(), obj);
1428 1441
1429 priv->main_layout = elm_layout_add(obj); 1442 priv->main_layout = elm_layout_add(obj);
1430 if (!elm_layout_theme_set(priv->main_layout, "popup", "base", 1443 if (!elm_layout_theme_set(priv->main_layout, "popup", "base",
diff --git a/src/tests/elementary/elm_test_popup.c b/src/tests/elementary/elm_test_popup.c
index 4defd3ecae..e288bab9a9 100644
--- a/src/tests/elementary/elm_test_popup.c
+++ b/src/tests/elementary/elm_test_popup.c
@@ -41,8 +41,38 @@ EFL_START_TEST (elm_atspi_role_get)
41} 41}
42EFL_END_TEST 42EFL_END_TEST
43 43
44static void
45_focus_cb(void *data, Evas_Object *obj EINA_UNUSED,
46 void *event_info EINA_UNUSED)
47{
48 *((Eina_Bool*)data) = EINA_TRUE;
49}
50
51
52EFL_START_TEST (elm_popup_focus_get)
53{
54 Evas_Object *win, *popup;
55 Eina_Bool focused = EINA_FALSE;
56
57 win = win_add(NULL, "popup", ELM_WIN_BASIC);
58
59 popup = elm_popup_add(win);
60 elm_popup_scrollable_set(popup, EINA_TRUE);
61 elm_object_text_set(popup, "This Popup has content area and "
62 "timeout value is 3 seconds");
63 elm_popup_timeout_set(popup, 3.0);
64 evas_object_smart_callback_add(popup, "focused", _focus_cb, &focused);
65
66 // popup show should be called after adding all the contents and the buttons
67 // of popup to set the focus into popup's contents correctly.
68 evas_object_show(popup);
69 ck_assert(focused);
70}
71EFL_END_TEST
72
44void elm_test_popup(TCase *tc) 73void elm_test_popup(TCase *tc)
45{ 74{
75 tcase_add_test(tc, elm_popup_focus_get);
46 tcase_add_test(tc, elm_popup_legacy_type_check); 76 tcase_add_test(tc, elm_popup_legacy_type_check);
47 tcase_add_test(tc, elm_atspi_role_get); 77 tcase_add_test(tc, elm_atspi_role_get);
48} 78}