aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Zaoui <daniel.zaoui@yahoo.com>2015-03-10 20:30:00 +0200
committerDaniel Zaoui <daniel.zaoui@yahoo.com>2015-03-11 18:03:01 +0200
commitdb2a068760d9472c4a2b56e105fd0b1c377f0b2e (patch)
treeaf3020226bfd4987d864b219c6582a84250ba31b
parentDnD/Wl: add a better support to data types. (diff)
downloadelementary-db2a068760d9472c4a2b56e105fd0b1c377f0b2e.tar.gz
DnD/Wl: fix drop sequence when drop is done on a bad target.
The problem occurs when no drop target below the mouse can receive the data type provided and the mouse button is released. The mouse pointer stays grabbed and this leads to issues for the next drags. To solve this, on a bad drop, the destination window has to request from the source window the end of the dnd.
-rw-r--r--src/lib/elm_cnp.c39
1 files changed, 16 insertions, 23 deletions
diff --git a/src/lib/elm_cnp.c b/src/lib/elm_cnp.c
index 255664813..23f1afc90 100644
--- a/src/lib/elm_cnp.c
+++ b/src/lib/elm_cnp.c
@@ -3087,6 +3087,7 @@ _wl_dnd_leave(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
{
Ecore_Wl_Event_Dnd_Leave *ev;
Dropable *drop;
+ cnp_debug("In\n");
ev = event;
if ((drop = _wl_dropable_find(ev->win)))
@@ -3173,7 +3174,8 @@ _wl_dnd_position(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
evas_object_geometry_get(dropable->obj, &ox, &oy, NULL, NULL);
- cnp_debug("Candidate on %i %i: %p\n", x - ox, y - oy, dropable);
+ cnp_debug("Candidate %p (%s)\n",
+ dropable->obj, eo_class_name_get(eo_class_get(dropable->obj)));
_wl_dropable_handle(dropable, x - ox, y - oy);
wl_cnp_selection.requestwidget = dropable->obj;
will_accept = EINA_TRUE;
@@ -3201,39 +3203,29 @@ _wl_dnd_drop(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
{
Ecore_Wl_Event_Dnd_Drop *ev;
Dropable *drop;
+ Eina_List *l;
cnp_debug("In\n");
ev = event;
-
- if (!(drop = _wl_dropable_find(ev->win)))
- return ECORE_CALLBACK_PASS_ON;
-
savedtypes.x = ev->position.x;
savedtypes.y = ev->position.y;
- _dropable_coords_adjust(drop, &savedtypes.x, &savedtypes.y);
- Evas *evas = _wl_evas_get_from_win(ev->win);
-
- Eina_List *dropable_list = evas ? _dropable_list_geom_find(evas, savedtypes.x, savedtypes.y) : NULL;
- /* check if there is dropable (obj) can accept this drop */
- if (dropable_list)
+ EINA_LIST_FOREACH(drops, l, drop)
{
- Eina_List *l;
- EINA_LIST_FOREACH(dropable_list, l, drop)
+ if (drop->last.in)
{
- if (drop->last.in)
- {
- wl_cnp_selection.requestwidget = drop->obj;
- evas_object_event_callback_add(wl_cnp_selection.requestwidget,
- EVAS_CALLBACK_DEL,
- _wl_sel_obj_del2,
- &wl_cnp_selection);
- ecore_wl_dnd_drag_get(ecore_wl_input_get(), drop->last.type);
- break;
- }
+ cnp_debug("Request data of type %s\n", drop->last.type);
+ wl_cnp_selection.requestwidget = drop->obj;
+ evas_object_event_callback_add(wl_cnp_selection.requestwidget,
+ EVAS_CALLBACK_DEL,
+ _wl_sel_obj_del2,
+ &wl_cnp_selection);
+ ecore_wl_dnd_drag_get(ecore_wl_input_get(), drop->last.type);
+ return ECORE_CALLBACK_PASS_ON;
}
}
+ ecore_wl_dnd_drag_end(ecore_wl_input_get());
return ECORE_CALLBACK_PASS_ON;
}
@@ -3271,6 +3263,7 @@ _wl_dnd_receive(void *data, int type EINA_UNUSED, void *event)
{
Wl_Cnp_Selection *sel;
Ecore_Wl_Event_Selection_Data_Ready *ev;
+ cnp_debug("In\n");
ev = event;
sel = data;