summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-06-20 13:33:03 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-06-20 17:14:57 +0200
commit1e86c2bf9367d21eab70a0fa29762b98e39c7c03 (patch)
tree39e3687bc4d3ad06764020163378097757ae8386
parent8127f29c466e2e028b2067d438b77e119e410b41 (diff)
efl_ui_win: repair scene event emission
It appears that EVAS_CALLBACK_FOCUS_IN / OUT is wrong here, as this is for when a object gets focus but not the scene. However, the inital event emission still does not work correctly, this needs some further investigation. Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Differential Revision: https://phab.enlightenment.org/D9138
-rw-r--r--src/lib/elementary/efl_ui_win.c4
-rw-r--r--src/tests/elementary/efl_ui_suite.c1
-rw-r--r--src/tests/elementary/efl_ui_suite.h1
-rw-r--r--src/tests/elementary/efl_ui_test_win.c58
-rw-r--r--src/tests/elementary/meson.build1
5 files changed, 63 insertions, 2 deletions
diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c
index 508083098b..ebf381477f 100644
--- a/src/lib/elementary/efl_ui_win.c
+++ b/src/lib/elementary/efl_ui_win.c
@@ -2178,13 +2178,13 @@ _win_event_add_cb(void *data, const Efl_Event *ev)
2178 else if (array[i].desc == EFL_CANVAS_SCENE_EVENT_SCENE_FOCUS_IN) 2178 else if (array[i].desc == EFL_CANVAS_SCENE_EVENT_SCENE_FOCUS_IN)
2179 { 2179 {
2180 if (!(sd->event_forward.focus_in++)) 2180 if (!(sd->event_forward.focus_in++))
2181 evas_event_callback_add(sd->evas, EVAS_CALLBACK_FOCUS_IN, 2181 evas_event_callback_add(sd->evas, EVAS_CALLBACK_CANVAS_FOCUS_IN,
2182 _elm_win_evas_focus_in, win); 2182 _elm_win_evas_focus_in, win);
2183 } 2183 }
2184 else if (array[i].desc == EFL_CANVAS_SCENE_EVENT_SCENE_FOCUS_OUT) 2184 else if (array[i].desc == EFL_CANVAS_SCENE_EVENT_SCENE_FOCUS_OUT)
2185 { 2185 {
2186 if (!(sd->event_forward.focus_out++)) 2186 if (!(sd->event_forward.focus_out++))
2187 evas_event_callback_add(sd->evas, EVAS_CALLBACK_FOCUS_OUT, 2187 evas_event_callback_add(sd->evas, EVAS_CALLBACK_CANVAS_FOCUS_OUT,
2188 _elm_win_evas_focus_out, win); 2188 _elm_win_evas_focus_out, win);
2189 } 2189 }
2190 else if (array[i].desc == EFL_CANVAS_SCENE_EVENT_OBJECT_FOCUS_IN) 2190 else if (array[i].desc == EFL_CANVAS_SCENE_EVENT_OBJECT_FOCUS_IN)
diff --git a/src/tests/elementary/efl_ui_suite.c b/src/tests/elementary/efl_ui_suite.c
index 66395696bc..e25c4aa688 100644
--- a/src/tests/elementary/efl_ui_suite.c
+++ b/src/tests/elementary/efl_ui_suite.c
@@ -28,6 +28,7 @@ static const Efl_Test_Case etc[] = {
28 { "efl_ui_active_view", efl_ui_test_active_view}, 28 { "efl_ui_active_view", efl_ui_test_active_view},
29 { "efl_ui_check", efl_ui_test_check }, 29 { "efl_ui_check", efl_ui_test_check },
30 { "efl_ui_radio_group", efl_ui_test_radio_group }, 30 { "efl_ui_radio_group", efl_ui_test_radio_group },
31 { "efl_ui_win", efl_ui_test_win },
31 { NULL, NULL } 32 { NULL, NULL }
32}; 33};
33 34
diff --git a/src/tests/elementary/efl_ui_suite.h b/src/tests/elementary/efl_ui_suite.h
index b5aec1b098..fff7c6566f 100644
--- a/src/tests/elementary/efl_ui_suite.h
+++ b/src/tests/elementary/efl_ui_suite.h
@@ -37,6 +37,7 @@ void efl_ui_test_widget(TCase *tc);
37void efl_ui_test_active_view(TCase *tc); 37void efl_ui_test_active_view(TCase *tc);
38void efl_ui_test_check(TCase *tc); 38void efl_ui_test_check(TCase *tc);
39void efl_ui_test_radio_group(TCase *tc); 39void efl_ui_test_radio_group(TCase *tc);
40void efl_ui_test_win(TCase *tc);
40 41
41void loop_timer_interval_set(Eo *obj, double in); 42void loop_timer_interval_set(Eo *obj, double in);
42 43
diff --git a/src/tests/elementary/efl_ui_test_win.c b/src/tests/elementary/efl_ui_test_win.c
new file mode 100644
index 0000000000..d7deb293f7
--- /dev/null
+++ b/src/tests/elementary/efl_ui_test_win.c
@@ -0,0 +1,58 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4
5#include <Elementary.h>
6#include "efl_ui_suite.h"
7
8static void
9_boolean_flag_set(void *data, const Efl_Event *ev EINA_UNUSED)
10{
11 Eina_Bool *flag = data;
12 *flag = EINA_TRUE;
13
14 efl_loop_quit(efl_main_loop_get(), EINA_VALUE_EMPTY);
15}
16
17EFL_START_TEST(efl_ui_win_test_scene_focus)
18{
19 Efl_Ui_Win *win1;
20 Ecore_Evas *ee;
21
22 Eina_Bool win1_focus_in = EINA_FALSE;
23 Eina_Bool win1_focus_out = EINA_FALSE;
24
25 win1 = efl_new(EFL_UI_WIN_CLASS);
26
27 //we want to test here the correct propagation of events from ecore_evas to the win object
28 //in order to ensure that we are resetting ee focus first here.
29 ee = ecore_evas_ecore_evas_get(evas_object_evas_get(win1));
30 ecore_evas_focus_set(ee, EINA_TRUE);
31 ecore_evas_focus_set(ee, EINA_FALSE);
32 efl_event_callback_add(win1, EFL_CANVAS_SCENE_EVENT_SCENE_FOCUS_IN, _boolean_flag_set, &win1_focus_in);
33 efl_event_callback_add(win1, EFL_CANVAS_SCENE_EVENT_SCENE_FOCUS_OUT, _boolean_flag_set, &win1_focus_out);
34
35 //focus in check
36 ecore_evas_focus_set(ee, EINA_TRUE);
37 if (!win1_focus_in)
38 efl_loop_begin(efl_main_loop_get());
39 ck_assert_int_eq(win1_focus_in, EINA_TRUE);
40 ck_assert_int_eq(win1_focus_out, EINA_FALSE);
41 win1_focus_in = EINA_FALSE;
42
43 //focus out check
44 ecore_evas_focus_set(ee, EINA_FALSE);
45 if (!win1_focus_out)
46 efl_loop_begin(efl_main_loop_get());
47
48 ck_assert_int_eq(win1_focus_out, EINA_TRUE);
49 ck_assert_int_eq(win1_focus_in, EINA_FALSE);
50
51 efl_unref(win1);
52}
53EFL_END_TEST
54void
55efl_ui_test_win(TCase *tc)
56{
57 tcase_add_test(tc, efl_ui_win_test_scene_focus);
58}
diff --git a/src/tests/elementary/meson.build b/src/tests/elementary/meson.build
index 43b3ca1cfe..5835b2cdc4 100644
--- a/src/tests/elementary/meson.build
+++ b/src/tests/elementary/meson.build
@@ -120,6 +120,7 @@ efl_ui_suite_src = [
120 'suite_helpers.c', 120 'suite_helpers.c',
121 'suite_helpers.h', 121 'suite_helpers.h',
122 'elm_test_init.c', 122 'elm_test_init.c',
123 'efl_ui_test_win.c',
123 'efl_ui_test_atspi.c', 124 'efl_ui_test_atspi.c',
124 'efl_ui_test_callback.c', 125 'efl_ui_test_callback.c',
125 'efl_ui_test_focus_common.c', 126 'efl_ui_test_focus_common.c',