summaryrefslogtreecommitdiff
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-16 09:42:02 +0200
commit22bd43d4bbfa591fd24397f62fa32ff27f78884f (patch)
treebb7e8594bd66b72785483b91f73d22fb46213541
parent2e1e65f56dde8bb37c1bdbebe1af5cfeb62d992a (diff)
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 168d78f4d..1fc5479d9 100644
--- a/src/lib/elm_cnp.c
+++ b/src/lib/elm_cnp.c
@@ -3085,6 +3085,7 @@ _wl_dnd_leave(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
3085{ 3085{
3086 Ecore_Wl_Event_Dnd_Leave *ev; 3086 Ecore_Wl_Event_Dnd_Leave *ev;
3087 Dropable *drop; 3087 Dropable *drop;
3088 cnp_debug("In\n");
3088 3089
3089 ev = event; 3090 ev = event;
3090 if ((drop = _wl_dropable_find(ev->win))) 3091 if ((drop = _wl_dropable_find(ev->win)))
@@ -3171,7 +3172,8 @@ _wl_dnd_position(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
3171 3172
3172 evas_object_geometry_get(dropable->obj, &ox, &oy, NULL, NULL); 3173 evas_object_geometry_get(dropable->obj, &ox, &oy, NULL, NULL);
3173 3174
3174 cnp_debug("Candidate on %i %i: %p\n", x - ox, y - oy, dropable); 3175 cnp_debug("Candidate %p (%s)\n",
3176 dropable->obj, eo_class_name_get(eo_class_get(dropable->obj)));
3175 _wl_dropable_handle(dropable, x - ox, y - oy); 3177 _wl_dropable_handle(dropable, x - ox, y - oy);
3176 wl_cnp_selection.requestwidget = dropable->obj; 3178 wl_cnp_selection.requestwidget = dropable->obj;
3177 will_accept = EINA_TRUE; 3179 will_accept = EINA_TRUE;
@@ -3199,39 +3201,29 @@ _wl_dnd_drop(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
3199{ 3201{
3200 Ecore_Wl_Event_Dnd_Drop *ev; 3202 Ecore_Wl_Event_Dnd_Drop *ev;
3201 Dropable *drop; 3203 Dropable *drop;
3204 Eina_List *l;
3202 3205
3203 cnp_debug("In\n"); 3206 cnp_debug("In\n");
3204 ev = event; 3207 ev = event;
3205
3206 if (!(drop = _wl_dropable_find(ev->win)))
3207 return ECORE_CALLBACK_PASS_ON;
3208
3209 savedtypes.x = ev->position.x; 3208 savedtypes.x = ev->position.x;
3210 savedtypes.y = ev->position.y; 3209 savedtypes.y = ev->position.y;
3211 _dropable_coords_adjust(drop, &savedtypes.x, &savedtypes.y);
3212 Evas *evas = _wl_evas_get_from_win(ev->win);
3213
3214 Eina_List *dropable_list = evas ? _dropable_list_geom_find(evas, savedtypes.x, savedtypes.y) : NULL;
3215 3210
3216 /* check if there is dropable (obj) can accept this drop */ 3211 EINA_LIST_FOREACH(drops, l, drop)
3217 if (dropable_list)
3218 { 3212 {
3219 Eina_List *l; 3213 if (drop->last.in)
3220 EINA_LIST_FOREACH(dropable_list, l, drop)
3221 { 3214 {
3222 if (drop->last.in) 3215 cnp_debug("Request data of type %s\n", drop->last.type);
3223 { 3216 wl_cnp_selection.requestwidget = drop->obj;
3224 wl_cnp_selection.requestwidget = drop->obj; 3217 evas_object_event_callback_add(wl_cnp_selection.requestwidget,
3225 evas_object_event_callback_add(wl_cnp_selection.requestwidget, 3218 EVAS_CALLBACK_DEL,
3226 EVAS_CALLBACK_DEL, 3219 _wl_sel_obj_del2,
3227 _wl_sel_obj_del2, 3220 &wl_cnp_selection);
3228 &wl_cnp_selection); 3221 ecore_wl_dnd_drag_get(ecore_wl_input_get(), drop->last.type);
3229 ecore_wl_dnd_drag_get(ecore_wl_input_get(), drop->last.type); 3222 return ECORE_CALLBACK_PASS_ON;
3230 break;
3231 }
3232 } 3223 }
3233 } 3224 }
3234 3225
3226 ecore_wl_dnd_drag_end(ecore_wl_input_get());
3235 return ECORE_CALLBACK_PASS_ON; 3227 return ECORE_CALLBACK_PASS_ON;
3236} 3228}
3237 3229
@@ -3269,6 +3261,7 @@ _wl_dnd_receive(void *data, int type EINA_UNUSED, void *event)
3269{ 3261{
3270 Wl_Cnp_Selection *sel; 3262 Wl_Cnp_Selection *sel;
3271 Ecore_Wl_Event_Selection_Data_Ready *ev; 3263 Ecore_Wl_Event_Selection_Data_Ready *ev;
3264 cnp_debug("In\n");
3272 3265
3273 ev = event; 3266 ev = event;
3274 sel = data; 3267 sel = data;