diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c index 75a0de18a6..f06c189ad9 100644 --- a/src/lib/ecore_evas/ecore_evas.c +++ b/src/lib/ecore_evas/ecore_evas.c @@ -5699,6 +5699,7 @@ ecore_evas_callback_drop_drop_set(Ecore_Evas *ee, Ecore_Evas_Drop_Cb cb) typedef struct { Eina_Array *available_mime_types; Eina_Position2D pos; + Eina_Bool last_motion_was_used; } Ecore_Evas_Active_Dnd; static void @@ -5734,18 +5735,34 @@ ecore_evas_dnd_enter(Ecore_Evas *ee, unsigned int seat, Eina_Iterator *available ee->func.fn_dnd_state_change(ee, seat, pos, EINA_TRUE); } -EAPI void +EAPI Eina_Bool ecore_evas_dnd_position_set(Ecore_Evas *ee, unsigned int seat, Eina_Position2D pos) { Ecore_Evas_Active_Dnd *dnd; + ECORE_EVAS_CHECK_GOTO(ee, err); + EINA_SAFETY_ON_NULL_GOTO(ee->active_drags, err); + dnd = eina_hash_find(ee->active_drags, &seat); + EINA_SAFETY_ON_NULL_GOTO(dnd, err); + dnd->pos = pos; + dnd->last_motion_was_used = EINA_FALSE; + if (ee->func.fn_dnd_motion) + ee->func.fn_dnd_motion(ee, seat, pos); + return dnd->last_motion_was_used; +err: + return EINA_FALSE; +} + +EAPI void +ecore_evas_dnd_mark_motion_used(Ecore_Evas *ee, unsigned int seat) +{ + Ecore_Evas_Active_Dnd *dnd; + ECORE_EVAS_CHECK(ee); EINA_SAFETY_ON_NULL_RETURN(ee->active_drags); dnd = eina_hash_find(ee->active_drags, &seat); EINA_SAFETY_ON_NULL_RETURN(dnd); - dnd->pos = pos; - if (ee->func.fn_dnd_motion) - ee->func.fn_dnd_motion(ee, seat, pos); + dnd->last_motion_was_used = EINA_TRUE; } EAPI void diff --git a/src/lib/ecore_evas/ecore_evas_private.h b/src/lib/ecore_evas/ecore_evas_private.h index 6fb2c988b5..aba98b4a10 100644 --- a/src/lib/ecore_evas/ecore_evas_private.h +++ b/src/lib/ecore_evas/ecore_evas_private.h @@ -522,8 +522,8 @@ EAPI Eina_Bool ecore_evas_render(Ecore_Evas *ee); EAPI Evas *ecore_evas_evas_new(Ecore_Evas *ee, int w, int h); EAPI void ecore_evas_done(Ecore_Evas *ee, Eina_Bool single_window); - -EAPI void ecore_evas_dnd_position_set(Ecore_Evas *ee, unsigned int seat, Eina_Position2D pos); +EAPI void ecore_evas_dnd_mark_motion_used(Ecore_Evas *ee, unsigned int seat); +EAPI Eina_Bool ecore_evas_dnd_position_set(Ecore_Evas *ee, unsigned int seat, Eina_Position2D pos); EAPI void ecore_evas_dnd_leave(Ecore_Evas *ee, unsigned int seat, Eina_Position2D pos); EAPI void ecore_evas_dnd_enter(Ecore_Evas *ee, unsigned int seat, Eina_Iterator *available_types, Eina_Position2D pos); EAPI Eina_Position2D ecore_evas_dnd_pos_get(Ecore_Evas *ee, unsigned int seat); diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index 0f5bbdbc25..0c1e960ce5 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c @@ -9268,15 +9268,18 @@ _motion_cb(Ecore_Evas *ee, unsigned int seat, Eina_Position2D p) { 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); } else 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); } diff --git a/src/modules/ecore_evas/engines/x/ecore_evas_x.c b/src/modules/ecore_evas/engines/x/ecore_evas_x.c index eb545a256a..5730037e11 100644 --- a/src/modules/ecore_evas/engines/x/ecore_evas_x.c +++ b/src/modules/ecore_evas/engines/x/ecore_evas_x.c @@ -4185,8 +4185,9 @@ _ecore_evas_x_dnd_position(void *udata EINA_UNUSED, int type EINA_UNUSED, void * ee = ecore_event_window_match(pos->win); EINA_SAFETY_ON_NULL_GOTO(ee, end); ecore_evas_geometry_get(ee, &x, &y, &w, &h); - ecore_evas_dnd_position_set(ee, 1, EINA_POSITION2D(pos->position.x - x, pos->position.y - y)); - ecore_x_dnd_send_status(EINA_TRUE, EINA_FALSE, (Ecore_X_Rectangle){x,y,w,h}, pos->action); + Eina_Bool used = ecore_evas_dnd_position_set(ee, 1, EINA_POSITION2D(pos->position.x - x, pos->position.y - y)); + if (used) + ecore_x_dnd_send_status(EINA_TRUE, EINA_FALSE, (Ecore_X_Rectangle){x,y,w,h}, pos->action); end: return ECORE_CALLBACK_PASS_ON; }