forked from enlightenment/efl
efl_ui_win: fix emitting of object focus events
Summary: the event type was wrong. This is now fixed and works correctly. Reviewers: stefan_schmidt, zmike, segfaultxavi Reviewed By: zmike Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9144
This commit is contained in:
parent
ccecfb05a6
commit
0c4c74b5f7
|
@ -2044,26 +2044,14 @@ _elm_win_evas_focus_out(void *data,
|
|||
}
|
||||
|
||||
static void
|
||||
_elm_win_evas_object_focus_in(void *data,
|
||||
Evas *e EINA_UNUSED,
|
||||
void *event_info)
|
||||
_evas_event_focus_object_cb(void *data, const Efl_Event *ev)
|
||||
{
|
||||
Eo *object = event_info;
|
||||
Eo *win = data;
|
||||
|
||||
if (ev->desc == EFL_CANVAS_SCENE_EVENT_OBJECT_FOCUS_IN)
|
||||
_elm_win_throttle_ok = EINA_TRUE;
|
||||
efl_event_callback_call(win, EFL_CANVAS_SCENE_EVENT_OBJECT_FOCUS_IN, object);
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_win_evas_object_focus_out(void *data,
|
||||
Evas *e EINA_UNUSED,
|
||||
void *event_info)
|
||||
{
|
||||
Eo *object = event_info;
|
||||
Eo *win = data;
|
||||
|
||||
efl_event_callback_call(win, EFL_CANVAS_SCENE_EVENT_OBJECT_FOCUS_OUT, object);
|
||||
efl_event_callback_call(win, ev->desc, ev->info);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2190,14 +2178,14 @@ _win_event_add_cb(void *data, const Efl_Event *ev)
|
|||
else if (array[i].desc == EFL_CANVAS_SCENE_EVENT_OBJECT_FOCUS_IN)
|
||||
{
|
||||
if (!(sd->event_forward.object_focus_in++))
|
||||
evas_event_callback_add(sd->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
|
||||
_elm_win_evas_object_focus_in, win);
|
||||
efl_event_callback_add(sd->evas, EFL_CANVAS_SCENE_EVENT_OBJECT_FOCUS_IN,
|
||||
_evas_event_focus_object_cb, win);
|
||||
}
|
||||
else if (array[i].desc == EFL_CANVAS_SCENE_EVENT_OBJECT_FOCUS_OUT)
|
||||
{
|
||||
if (!(sd->event_forward.object_focus_out++))
|
||||
evas_event_callback_add(sd->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
|
||||
_elm_win_evas_object_focus_out, win);
|
||||
efl_event_callback_add(sd->evas, EFL_CANVAS_SCENE_EVENT_OBJECT_FOCUS_OUT,
|
||||
_evas_event_focus_object_cb, win);
|
||||
}
|
||||
else if (array[i].desc == EFL_CANVAS_SCENE_EVENT_DEVICE_CHANGED)
|
||||
{
|
||||
|
@ -2321,14 +2309,14 @@ _win_event_del_cb(void *data, const Efl_Event *ev)
|
|||
else if (array[i].desc == EFL_CANVAS_SCENE_EVENT_OBJECT_FOCUS_IN)
|
||||
{
|
||||
if (!(--sd->event_forward.object_focus_in))
|
||||
evas_event_callback_del_full(sd->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
|
||||
_elm_win_evas_object_focus_in, win);
|
||||
efl_event_callback_del(sd->evas, EFL_CANVAS_SCENE_EVENT_OBJECT_FOCUS_IN,
|
||||
_evas_event_focus_object_cb, win);
|
||||
}
|
||||
else if (array[i].desc == EFL_CANVAS_SCENE_EVENT_OBJECT_FOCUS_OUT)
|
||||
{
|
||||
if (!(--sd->event_forward.object_focus_out))
|
||||
evas_event_callback_del_full(sd->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
|
||||
_elm_win_evas_object_focus_out, win);
|
||||
efl_event_callback_del(sd->evas, EFL_CANVAS_SCENE_EVENT_OBJECT_FOCUS_OUT,
|
||||
_evas_event_focus_object_cb, win);
|
||||
}
|
||||
else if (array[i].desc == EFL_CANVAS_SCENE_EVENT_DEVICE_CHANGED)
|
||||
{
|
||||
|
|
|
@ -51,8 +51,52 @@ EFL_START_TEST(efl_ui_win_test_scene_focus)
|
|||
efl_unref(win1);
|
||||
}
|
||||
EFL_END_TEST
|
||||
|
||||
static void
|
||||
_check_focus_event(void *data, const Efl_Event *ev)
|
||||
{
|
||||
void **tmp = data;
|
||||
|
||||
*tmp = efl_input_focus_object_get(ev->info);
|
||||
}
|
||||
|
||||
EFL_START_TEST(efl_ui_win_test_object_focus)
|
||||
{
|
||||
Efl_Ui_Win *win1;
|
||||
|
||||
void *win1_focus_in = NULL;
|
||||
void *win1_focus_out = NULL;
|
||||
|
||||
win1 = efl_new(EFL_UI_WIN_CLASS);
|
||||
|
||||
efl_event_callback_add(win1, EFL_CANVAS_SCENE_EVENT_OBJECT_FOCUS_IN, _check_focus_event, &win1_focus_in);
|
||||
efl_event_callback_add(win1, EFL_CANVAS_SCENE_EVENT_OBJECT_FOCUS_OUT, _check_focus_event, &win1_focus_out);
|
||||
|
||||
Eo *r1 = efl_add(EFL_CANVAS_RECTANGLE_CLASS, evas_object_evas_get(win1));
|
||||
efl_canvas_object_seat_focus_add(r1, NULL);
|
||||
ck_assert_ptr_eq(win1_focus_in, r1);
|
||||
ck_assert_ptr_eq(win1_focus_out, NULL);
|
||||
win1_focus_in = NULL;
|
||||
win1_focus_out = NULL;
|
||||
|
||||
Eo *r2 = efl_add(EFL_CANVAS_RECTANGLE_CLASS, evas_object_evas_get(win1));
|
||||
efl_canvas_object_seat_focus_add(r2, NULL);
|
||||
ck_assert_ptr_eq(win1_focus_in, r2);
|
||||
ck_assert_ptr_eq(win1_focus_out, r1);
|
||||
win1_focus_in = NULL;
|
||||
win1_focus_out = NULL;
|
||||
|
||||
efl_canvas_object_seat_focus_del(r2, NULL);
|
||||
ck_assert_ptr_eq(win1_focus_in, NULL);
|
||||
ck_assert_ptr_eq(win1_focus_out, r2);
|
||||
|
||||
efl_unref(win1);
|
||||
}
|
||||
EFL_END_TEST
|
||||
|
||||
void
|
||||
efl_ui_test_win(TCase *tc)
|
||||
{
|
||||
tcase_add_test(tc, efl_ui_win_test_scene_focus);
|
||||
tcase_add_test(tc, efl_ui_win_test_object_focus);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue