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) else if (array[i].desc == EFL_CANVAS_SCENE_EVENT_SCENE_FOCUS_IN) { if (!(sd->event_forward.focus_in++)) - evas_event_callback_add(sd->evas, EVAS_CALLBACK_FOCUS_IN, + evas_event_callback_add(sd->evas, EVAS_CALLBACK_CANVAS_FOCUS_IN, _elm_win_evas_focus_in, win); } else if (array[i].desc == EFL_CANVAS_SCENE_EVENT_SCENE_FOCUS_OUT) { if (!(sd->event_forward.focus_out++)) - evas_event_callback_add(sd->evas, EVAS_CALLBACK_FOCUS_OUT, + evas_event_callback_add(sd->evas, EVAS_CALLBACK_CANVAS_FOCUS_OUT, _elm_win_evas_focus_out, win); } 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[] = { { "efl_ui_active_view", efl_ui_test_active_view}, { "efl_ui_check", efl_ui_test_check }, { "efl_ui_radio_group", efl_ui_test_radio_group }, + { "efl_ui_win", efl_ui_test_win }, { NULL, NULL } }; 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); void efl_ui_test_active_view(TCase *tc); void efl_ui_test_check(TCase *tc); void efl_ui_test_radio_group(TCase *tc); +void efl_ui_test_win(TCase *tc); void loop_timer_interval_set(Eo *obj, double in); 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 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif + +#include +#include "efl_ui_suite.h" + +static void +_boolean_flag_set(void *data, const Efl_Event *ev EINA_UNUSED) +{ + Eina_Bool *flag = data; + *flag = EINA_TRUE; + + efl_loop_quit(efl_main_loop_get(), EINA_VALUE_EMPTY); +} + +EFL_START_TEST(efl_ui_win_test_scene_focus) +{ + Efl_Ui_Win *win1; + Ecore_Evas *ee; + + Eina_Bool win1_focus_in = EINA_FALSE; + Eina_Bool win1_focus_out = EINA_FALSE; + + win1 = efl_new(EFL_UI_WIN_CLASS); + + //we want to test here the correct propagation of events from ecore_evas to the win object + //in order to ensure that we are resetting ee focus first here. + ee = ecore_evas_ecore_evas_get(evas_object_evas_get(win1)); + ecore_evas_focus_set(ee, EINA_TRUE); + ecore_evas_focus_set(ee, EINA_FALSE); + efl_event_callback_add(win1, EFL_CANVAS_SCENE_EVENT_SCENE_FOCUS_IN, _boolean_flag_set, &win1_focus_in); + efl_event_callback_add(win1, EFL_CANVAS_SCENE_EVENT_SCENE_FOCUS_OUT, _boolean_flag_set, &win1_focus_out); + + //focus in check + ecore_evas_focus_set(ee, EINA_TRUE); + if (!win1_focus_in) + efl_loop_begin(efl_main_loop_get()); + ck_assert_int_eq(win1_focus_in, EINA_TRUE); + ck_assert_int_eq(win1_focus_out, EINA_FALSE); + win1_focus_in = EINA_FALSE; + + //focus out check + ecore_evas_focus_set(ee, EINA_FALSE); + if (!win1_focus_out) + efl_loop_begin(efl_main_loop_get()); + + ck_assert_int_eq(win1_focus_out, EINA_TRUE); + ck_assert_int_eq(win1_focus_in, EINA_FALSE); + + efl_unref(win1); +} +EFL_END_TEST +void +efl_ui_test_win(TCase *tc) +{ + tcase_add_test(tc, efl_ui_win_test_scene_focus); +} 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 = [ 'suite_helpers.c', 'suite_helpers.h', 'elm_test_init.c', + 'efl_ui_test_win.c', 'efl_ui_test_atspi.c', 'efl_ui_test_callback.c', 'efl_ui_test_focus_common.c',