typedef void (*Ecore_Evas_Drag_Finished_Cb)(Ecore_Evas *ee, unsigned int seat, void *data, Eina_Bool accepted);
/**
+ * @brief This method is called when the drag object is accepted while performing a drag operation.
+ *
+ * @param[in] ee The Ecore Evas the drag operation started on.
+ * @param[in] data The Drag and Drop data.
+ * @param[in] accepted @c EINA_TRUE if drag and drop is accepted. @c EINA_FALSE if drag and drop is not accepted.
+ */
+typedef void (*Ecore_Evas_Drag_Accepted_Cb)(Ecore_Evas *ee, unsigned int seat, void *data, Eina_Bool accepted);
+
+/**
* @brief Starts a new drag operation.
*
* @param[in] ee The Ecore Evas the drag operation started on.
* @since 1.24
*/
EAPI Eina_Bool ecore_evas_drag_start(Ecore_Evas *ee, unsigned int seat, Eina_Content *content, Ecore_Evas *drag_rep,
- const char* action, Ecore_Evas_Drag_Finished_Cb terminate_cb, void *data);
+ const char* action, Ecore_Evas_Drag_Finished_Cb terminate_cb, Ecore_Evas_Drag_Accepted_Cb accepted_cb, void *data);
/**
* @brief Cancels an ongoing drag operation.
if (buffer == ECORE_EVAS_SELECTION_BUFFER_DRAG_AND_DROP_BUFFER)
{
ee->drag.accepted = EINA_TRUE;
+
+ //TIZEN_ONLY(20201222): fix accepted callback working
+ if (ee->drag.acceptedcb)
+ ee->drag.acceptedcb(ee, seat, ee->drag.data, ee->drag.accepted);
+ //
}
free_everything:
}
EAPI Eina_Bool
-ecore_evas_drag_start(Ecore_Evas *ee, unsigned int seat, Eina_Content *content, Ecore_Evas *drag_rep, const char* action, Ecore_Evas_Drag_Finished_Cb terminate_cb, void *data)
+//TIZEN_ONLY(20201222): fix accepted callback working
+//ecore_evas_drag_start(Ecore_Evas *ee, unsigned int seat, Eina_Content *content, Ecore_Evas *drag_rep, const char* action, Ecore_Evas_Drag_Finished_Cb terminate_cb, void *data)
+//
+ecore_evas_drag_start(Ecore_Evas *ee, unsigned int seat, Eina_Content *content, Ecore_Evas *drag_rep, const char* action, Ecore_Evas_Drag_Finished_Cb terminate_cb, Ecore_Evas_Drag_Accepted_Cb accepted_cb, void *data)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(ee, EINA_FALSE);
EINA_SAFETY_ON_NULL_RETURN_VAL(content, EINA_FALSE);
ee->drag.rep = drag_rep;
ee->drag.free = terminate_cb;
ee->drag.data = data;
+ //TIZEN_ONLY(20201222): fix accepted callback working
+ ee->drag.acceptedcb = accepted_cb;
+ //
ee->drag.accepted = EINA_FALSE;
return success;
Ecore_Evas *rep;
void *data;
Ecore_Evas_Drag_Finished_Cb free;
+ //TIZEN_ONLY(20201222): fix accepted callback working
+ Ecore_Evas_Drag_Accepted_Cb acceptedcb;
+ //
Eina_Bool accepted;
} drag;
Efl_Ui_Dnd *obj;
} Efl_Ui_Drag_Start;
+//TIZEN_ONLY(20201222): fix accepted callback working
+static Eo *recent_drag_object = NULL;
+//
+
static void
_ecore_evas_drag_terminated(Ecore_Evas *ee EINA_UNUSED, unsigned int seat, void *data, Eina_Bool accepted)
{
Efl_Ui_Drag_Finished_Event ev = {seat, accepted};
efl_event_callback_call(start->obj, EFL_UI_DND_EVENT_DRAG_FINISHED, &ev);
efl_del(start->win);
+ recent_drag_object = start->obj;
free(start);
}
+//TIZEN_ONLY(20201222): fix accepted callback working
+static void
+_ecore_evas_drag_accepted(Ecore_Evas *ee EINA_UNUSED, unsigned int seat, void *data, Eina_Bool accepted)
+{
+ Efl_Ui_Drag_Accepted_Event ev = {seat, accepted};
+ efl_event_callback_call(recent_drag_object, EFL_UI_DND_EVENT_DRAG_ACCEPTED, &ev);
+ recent_drag_object = NULL;
+}
+//
+
EOLIAN static Efl_Content*
_efl_ui_dnd_drag_start(Eo *obj, Efl_Ui_Dnd_Data *pd, Eina_Content *content, const char* action, unsigned int seat)
{
elm_win_borderless_set(drag_win, EINA_TRUE);
drag_ee = ecore_evas_ecore_evas_get(evas_object_evas_get(drag_win));
- if (!ecore_evas_drag_start(pd->ee, seat, content, drag_ee, action, _ecore_evas_drag_terminated, start))
+ //TIZEN_ONLY(20201222): fix accepted callback working
+ //if (!ecore_evas_drag_start(pd->ee, seat, content, drag_ee, action, _ecore_evas_drag_terminated, start))
+ if (!ecore_evas_drag_start(pd->ee, seat, content, drag_ee, action, _ecore_evas_drag_terminated, _ecore_evas_drag_accepted, start))
+ //
{
efl_del(drag_win);
free(start);
accepted : bool; [[$true if the operation completed with a Drop, or $false if it was cancelled.]]
}
+struct @beta Efl.Ui.Drag_Accepted_Event {
+ [[Information sent along with @Efl.Ui.Drag_Accepted_Event events.]]
+ seat : uint; [[Which seat triggered the event.]]
+ accepted : bool; [[$true if the operation completed with a Drop, or $false if it was cancelled.]]
+}
+
mixin @beta Efl.Ui.Dnd requires Efl.Object {
[[This mixin provides the ability to interact with the system's Drag & Drop facilities.
drop,dropped : Efl.Ui.Drop_Dropped_Event; [[Dragged content was dropped over the window.]]
drag,started : Efl.Ui.Drag_Started_Event; [[A Drag operation started.]]
drag,finished : Efl.Ui.Drag_Finished_Event;[[A Drag operation finished.]]
+ drag,accepted : Efl.Ui.Drag_Accepted_Event;[[A Drag operation accepted.]]
}
implements {
Efl.Object.constructor;
typedef struct {
void *dragdata, *acceptdata, *donecbdata;
Elm_Drag_Pos dragposcb;
- Elm_Drag_Accept acceptcb;
+ //TIZEN_ONLY(20201222): fix accepted callback working
+ //Elm_Drag_Accept acceptcb;
+ //
Elm_Drag_State dragdonecb;
} Elm_Drag_Data;
Elm_Drag_Data *dd = data;
Eina_Bool *accepted = ev->info;
- if (dd->acceptcb)
- dd->acceptcb(dd->acceptdata, ev->object, *accepted);
+ //TIZEN_ONLY(20201222): fix accepted callback working
+ //if (dd->acceptcb)
+ // dd->acceptcb(dd->acceptdata, ev->object, *accepted);
+ //
if (dd->dragdonecb)
dd->dragdonecb(dd->donecbdata, ev->object);
free(dd);
}
+//TIZEN_ONLY(20201222): fix accepted callback working
+static void
+_drag_accepted_cb(void *data, const Efl_Event *ev)
+{
+ Elm_Drag_Accept acceptcb = data;
+ Efl_Ui_Drag_Accepted_Event *accepted_event = ev->info;
+
+ if (acceptcb)
+ acceptcb(NULL, ev->object, accepted_event->accepted);
+
+ efl_event_callback_del(ev->object, EFL_UI_DND_EVENT_DRAG_ACCEPTED, _drag_accepted_cb, acceptcb);
+}
+//
+
EAPI Eina_Bool
elm_drag_start(Evas_Object *obj, Elm_Sel_Format format,
const char *data, Elm_Xdnd_Action action,
dd = calloc(1, sizeof(Elm_Drag_Data));
dd->dragposcb = dragpos;
dd->dragdata = dragdata;
- dd->acceptcb = acceptcb;
+ //TIZEN_ONLY(20201222): fix accepted callback working
+ //dd->acceptcb = acceptcb;
+ //
dd->acceptdata = acceptdata;
dd->dragdonecb = dragdone;
dd->donecbdata = donecbdata;
eina_array_free(mime_types);
efl_event_callback_add(obj, EFL_UI_DND_EVENT_DRAG_FINISHED, _drag_finished_cb, dd);
+ //TIZEN_ONLY(20201222): fix accepted callback working
+ efl_event_callback_add(obj, EFL_UI_DND_EVENT_DRAG_ACCEPTED, _drag_accepted_cb, acceptcb);
+ //
return EINA_TRUE;
}