summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2020-04-14 02:56:13 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-04-14 11:55:59 +0200
commit0122f4c7b84f770551f66720a3268c30ee486faf (patch)
tree680f5c772877cbfd5d505fde340bc31fa82e07b2
parentbe7ffe11420273e6f5e29d428be22e17d95064a6 (diff)
ecore_evas: add API for finding out if event is used
ecore_x_dnd_send_status can be used to indicate if a item can be dropped on a client or not. However, we should only indicate that this can be dropped, if there is a object we signaled that a drop is in. Long story short: there is no assertion that after indicating that things can be dropped, that a notify for the data is sent. A drag implementation should always listen to a mouse up event, and abort the drag if no further operations are sent. Differential Revision: https://phab.enlightenment.org/D11699
-rw-r--r--src/lib/ecore_evas/ecore_evas.c25
-rw-r--r--src/lib/ecore_evas/ecore_evas_private.h4
-rw-r--r--src/lib/elementary/efl_ui_win.c3
-rw-r--r--src/modules/ecore_evas/engines/x/ecore_evas_x.c5
4 files changed, 29 insertions, 8 deletions
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)
5699typedef struct { 5699typedef struct {
5700 Eina_Array *available_mime_types; 5700 Eina_Array *available_mime_types;
5701 Eina_Position2D pos; 5701 Eina_Position2D pos;
5702 Eina_Bool last_motion_was_used;
5702} Ecore_Evas_Active_Dnd; 5703} Ecore_Evas_Active_Dnd;
5703 5704
5704static void 5705static void
@@ -5734,18 +5735,34 @@ ecore_evas_dnd_enter(Ecore_Evas *ee, unsigned int seat, Eina_Iterator *available
5734 ee->func.fn_dnd_state_change(ee, seat, pos, EINA_TRUE); 5735 ee->func.fn_dnd_state_change(ee, seat, pos, EINA_TRUE);
5735} 5736}
5736 5737
5737EAPI void 5738EAPI Eina_Bool
5738ecore_evas_dnd_position_set(Ecore_Evas *ee, unsigned int seat, Eina_Position2D pos) 5739ecore_evas_dnd_position_set(Ecore_Evas *ee, unsigned int seat, Eina_Position2D pos)
5739{ 5740{
5740 Ecore_Evas_Active_Dnd *dnd; 5741 Ecore_Evas_Active_Dnd *dnd;
5741 5742
5742 ECORE_EVAS_CHECK(ee); 5743 ECORE_EVAS_CHECK_GOTO(ee, err);
5743 EINA_SAFETY_ON_NULL_RETURN(ee->active_drags); 5744 EINA_SAFETY_ON_NULL_GOTO(ee->active_drags, err);
5744 dnd = eina_hash_find(ee->active_drags, &seat); 5745 dnd = eina_hash_find(ee->active_drags, &seat);
5745 EINA_SAFETY_ON_NULL_RETURN(dnd); 5746 EINA_SAFETY_ON_NULL_GOTO(dnd, err);
5746 dnd->pos = pos; 5747 dnd->pos = pos;
5748 dnd->last_motion_was_used = EINA_FALSE;
5747 if (ee->func.fn_dnd_motion) 5749 if (ee->func.fn_dnd_motion)
5748 ee->func.fn_dnd_motion(ee, seat, pos); 5750 ee->func.fn_dnd_motion(ee, seat, pos);
5751 return dnd->last_motion_was_used;
5752err:
5753 return EINA_FALSE;
5754}
5755
5756EAPI void
5757ecore_evas_dnd_mark_motion_used(Ecore_Evas *ee, unsigned int seat)
5758{
5759 Ecore_Evas_Active_Dnd *dnd;
5760
5761 ECORE_EVAS_CHECK(ee);
5762 EINA_SAFETY_ON_NULL_RETURN(ee->active_drags);
5763 dnd = eina_hash_find(ee->active_drags, &seat);
5764 EINA_SAFETY_ON_NULL_RETURN(dnd);
5765 dnd->last_motion_was_used = EINA_TRUE;
5749} 5766}
5750 5767
5751EAPI void 5768EAPI 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);
522 522
523EAPI Evas *ecore_evas_evas_new(Ecore_Evas *ee, int w, int h); 523EAPI Evas *ecore_evas_evas_new(Ecore_Evas *ee, int w, int h);
524EAPI void ecore_evas_done(Ecore_Evas *ee, Eina_Bool single_window); 524EAPI void ecore_evas_done(Ecore_Evas *ee, Eina_Bool single_window);
525 525EAPI void ecore_evas_dnd_mark_motion_used(Ecore_Evas *ee, unsigned int seat);
526EAPI void ecore_evas_dnd_position_set(Ecore_Evas *ee, unsigned int seat, Eina_Position2D pos); 526EAPI Eina_Bool ecore_evas_dnd_position_set(Ecore_Evas *ee, unsigned int seat, Eina_Position2D pos);
527EAPI void ecore_evas_dnd_leave(Ecore_Evas *ee, unsigned int seat, Eina_Position2D pos); 527EAPI void ecore_evas_dnd_leave(Ecore_Evas *ee, unsigned int seat, Eina_Position2D pos);
528EAPI void ecore_evas_dnd_enter(Ecore_Evas *ee, unsigned int seat, Eina_Iterator *available_types, Eina_Position2D pos); 528EAPI void ecore_evas_dnd_enter(Ecore_Evas *ee, unsigned int seat, Eina_Iterator *available_types, Eina_Position2D pos);
529EAPI Eina_Position2D ecore_evas_dnd_pos_get(Ecore_Evas *ee, unsigned int seat); 529EAPI 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 7a58ddfc81..20231b127a 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)
9268 { 9268 {
9269 target->currently_inside = EINA_FALSE; 9269 target->currently_inside = EINA_FALSE;
9270 efl_event_callback_call(target->obj, EFL_UI_DND_EVENT_DROP_LEFT, &ev); 9270 efl_event_callback_call(target->obj, EFL_UI_DND_EVENT_DROP_LEFT, &ev);
9271 ecore_evas_dnd_mark_motion_used(ee, seat);
9271 } 9272 }
9272 else if (!target->currently_inside && inside) 9273 else if (!target->currently_inside && inside)
9273 { 9274 {
9274 target->currently_inside = EINA_TRUE; 9275 target->currently_inside = EINA_TRUE;
9275 efl_event_callback_call(target->obj, EFL_UI_DND_EVENT_DROP_ENTERED, &ev); 9276 efl_event_callback_call(target->obj, EFL_UI_DND_EVENT_DROP_ENTERED, &ev);
9277 ecore_evas_dnd_mark_motion_used(ee, seat);
9276 } 9278 }
9277 else if (target->currently_inside && inside) 9279 else if (target->currently_inside && inside)
9278 { 9280 {
9279 efl_event_callback_call(target->obj, EFL_UI_DND_EVENT_DROP_POSITION_CHANGED, &ev); 9281 efl_event_callback_call(target->obj, EFL_UI_DND_EVENT_DROP_POSITION_CHANGED, &ev);
9282 ecore_evas_dnd_mark_motion_used(ee, seat);
9280 } 9283 }
9281 eina_accessor_free(ev.available_types); 9284 eina_accessor_free(ev.available_types);
9282 } 9285 }
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 *
4185 ee = ecore_event_window_match(pos->win); 4185 ee = ecore_event_window_match(pos->win);
4186 EINA_SAFETY_ON_NULL_GOTO(ee, end); 4186 EINA_SAFETY_ON_NULL_GOTO(ee, end);
4187 ecore_evas_geometry_get(ee, &x, &y, &w, &h); 4187 ecore_evas_geometry_get(ee, &x, &y, &w, &h);
4188 ecore_evas_dnd_position_set(ee, 1, EINA_POSITION2D(pos->position.x - x, pos->position.y - y)); 4188 Eina_Bool used = ecore_evas_dnd_position_set(ee, 1, EINA_POSITION2D(pos->position.x - x, pos->position.y - y));
4189 ecore_x_dnd_send_status(EINA_TRUE, EINA_FALSE, (Ecore_X_Rectangle){x,y,w,h}, pos->action); 4189 if (used)
4190 ecore_x_dnd_send_status(EINA_TRUE, EINA_FALSE, (Ecore_X_Rectangle){x,y,w,h}, pos->action);
4190end: 4191end:
4191 return ECORE_CALLBACK_PASS_ON; 4192 return ECORE_CALLBACK_PASS_ON;
4192} 4193}