From a3c2025a01e7b19e3ec83fcf1f9d7ac34a02bd6b Mon Sep 17 00:00:00 2001 From: Taehyub Kim Date: Wed, 8 Dec 2021 20:34:34 +0900 Subject: [PATCH] dnd: keep the order of enter and leave event for dnd Change-Id: I97ce6ee2a26d7c24d25a403cd4e44db383a4cc53 --- src/lib/elementary/efl_ui_win.c | 50 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index ac14f70..07aa711 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c @@ -10856,6 +10856,8 @@ static void _motion_cb(Ecore_Evas *ee, unsigned int seat, Eina_Position2D p) { Efl_Ui_Win_Data *pd = _elm_win_associate_get(ee); + // TIZEN_ONLY(20211208): keep the order of enter and leave event + /* for (unsigned int i = 0; i < eina_inarray_count(pd->drop_target); ++i) { Ui_Dnd_Target *target = eina_inarray_nth(pd->drop_target, i); @@ -10882,6 +10884,43 @@ _motion_cb(Ecore_Evas *ee, unsigned int seat, Eina_Position2D p) } eina_accessor_free(ev.available_types); } + */ + for (unsigned int i = 0; i < eina_inarray_count(pd->drop_target); ++i) + { + Ui_Dnd_Target *target = eina_inarray_nth(pd->drop_target, i); + Eina_Rect rect = efl_gfx_entity_geometry_get(target->obj); + Eina_Bool inside = eina_rectangle_coords_inside(&rect.rect, p.x, p.y); + Efl_Ui_Drop_Event ev = {p, seat, ecore_evas_drop_available_types_get(ee, seat)}; + + if (target->currently_inside && !inside) + { + target->currently_inside = EINA_FALSE; + efl_event_callback_call(target->obj, EFL_UI_DND_EVENT_DROP_LEFT, &ev); + ecore_evas_dnd_mark_motion_used(ee, seat); + } + } + + for (unsigned int i = 0; i < eina_inarray_count(pd->drop_target); ++i) + { + Ui_Dnd_Target *target = eina_inarray_nth(pd->drop_target, i); + Eina_Rect rect = efl_gfx_entity_geometry_get(target->obj); + Eina_Bool inside = eina_rectangle_coords_inside(&rect.rect, p.x, p.y); + Efl_Ui_Drop_Event ev = {p, seat, ecore_evas_drop_available_types_get(ee, seat)}; + + if (!target->currently_inside && inside) + { + target->currently_inside = EINA_TRUE; + efl_event_callback_call(target->obj, EFL_UI_DND_EVENT_DROP_ENTERED, &ev); + ecore_evas_dnd_mark_motion_used(ee, seat); + } + else if (target->currently_inside && inside) + { + efl_event_callback_call(target->obj, EFL_UI_DND_EVENT_DROP_POSITION_CHANGED, &ev); + ecore_evas_dnd_mark_motion_used(ee, seat); + } + eina_accessor_free(ev.available_types); + } + // } static void @@ -10898,12 +10937,16 @@ _enter_state_change_cb(Ecore_Evas *ee, unsigned int seat EINA_UNUSED, Eina_Posit if (inside && move_inside) { target->currently_inside = EINA_TRUE; - efl_event_callback_call(target->obj, EFL_UI_DND_EVENT_DROP_ENTERED, &ev); + // TIZEN_ONLY(20211208): keep the order of enter and leave event + //efl_event_callback_call(target->obj, EFL_UI_DND_EVENT_DROP_ENTERED, &ev); + // } else if (!move_inside && !target->currently_inside) { target->currently_inside = EINA_FALSE; - efl_event_callback_call(target->obj, EFL_UI_DND_EVENT_DROP_LEFT, &ev); + // TIZEN_ONLY(20211208): keep the order of enter and leave event + //efl_event_callback_call(target->obj, EFL_UI_DND_EVENT_DROP_LEFT, &ev); + // } } } @@ -10926,6 +10969,9 @@ _drop_cb(Ecore_Evas *ee, unsigned int seat EINA_UNUSED, Eina_Position2D p, const { EINA_SAFETY_ON_FALSE_GOTO(target->currently_inside, end); eina_array_push(tmp, target->obj); + // TIZEN_ONLY(20211208): keep the order of enter and leave event + target->currently_inside = EINA_FALSE; + // } } -- 2.7.4