e_dnd: use given drag object when the drag end 56/295556/1
authorJunseok Kim <juns.kim@samsung.com>
Mon, 10 Jul 2023 07:12:44 +0000 (16:12 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Tue, 11 Jul 2023 00:28:25 +0000 (09:28 +0900)
Change-Id: I60a0503b5d297e9a2a6bb547cb43c37b9fb701b5

src/bin/e_dnd.c

index dd02f16..bac79b6 100644 (file)
@@ -2,7 +2,7 @@
 
 /* local subsystem functions */
 
-static void           _e_drag_end(void);
+static void           _e_drag_end(E_Drag *drag);
 static void           _e_drag_free(E_Drag *drag);
 
 static Eina_Bool      _e_dnd_cb_mouse_up(void *data, int type, void *event);
@@ -160,17 +160,15 @@ e_drag_start(E_Drag *drag, int x, int y)
 
 /* local subsystem functions */
 static void
-_e_drag_end(void)
+_e_drag_end(E_Drag *drag)
 {
-   if (!_drag_current) return;
-
-   evas_object_hide(_drag_current->comp_object);
+   evas_object_hide(drag->comp_object);
 
-   if (_drag_current->cb.finished)
-     _drag_current->cb.finished(_drag_current);
-   _drag_current->cb.finished = NULL;
+   if (drag->cb.finished)
+     drag->cb.finished(drag);
+   drag->cb.finished = NULL;
 
-   e_object_del(E_OBJECT(_drag_current));
+   e_object_del(E_OBJECT(drag));
 
    e_comp_ungrab_input(1, 1);
 }
@@ -202,18 +200,19 @@ _e_dnd_cb_mouse_up(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
    Ecore_Event_Mouse_Button *ev = event;
    int device_id = e_comp_wl_data_current_device_id_get();
 
+   if (!_drag_current) return ECORE_CALLBACK_PASS_ON;
    if (ev->window != _drag_win) return ECORE_CALLBACK_PASS_ON;
    if ((device_id >= 0) &&
        (ev->multi.device != device_id))
      return ECORE_CALLBACK_PASS_ON;
 
-   if (_drag_current && _drag_current->button_mask)
+   if (_drag_current->button_mask)
      {
         _drag_current->button_mask &= ~(1 << (ev->buttons - 1));
         if (_drag_current->button_mask) return ECORE_CALLBACK_RENEW;
      }
 
-   _e_drag_end();
+   _e_drag_end(_drag_current);
 
    return ECORE_CALLBACK_PASS_ON;
 }
@@ -239,7 +238,7 @@ _e_dnd_cb_zone_display_rotation_change_end(void *data EINA_UNUSED, int type EINA
 
    source = e_comp_wl->drag_source;
    source->accepted = EINA_FALSE;
-   _e_drag_end();
+   _e_drag_end(_drag_current);
    E_FREE(e_comp_wl->drag);
 
    return ECORE_CALLBACK_PASS_ON;