dnd: keep the order of enter and leave event for dnd 71/267671/2 accepted/tizen/unified/20211210.115209 submit/tizen/20211209.063123
authorTaehyub Kim <taehyub.kim@samsung.com>
Wed, 8 Dec 2021 11:34:34 +0000 (20:34 +0900)
committerTaehyub Kim <taehyub.kim@samsung.com>
Wed, 8 Dec 2021 11:56:01 +0000 (11:56 +0000)
Change-Id: I97ce6ee2a26d7c24d25a403cd4e44db383a4cc53

src/lib/elementary/efl_ui_win.c

index ac14f70..07aa711 100644 (file)
@@ -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;
+             //
           }
      }