diff options
author | Daniel Zaoui <daniel.zaoui@samsung.com> | 2016-11-10 08:20:10 +0200 |
---|---|---|
committer | Daniel Zaoui <daniel.zaoui@samsung.com> | 2016-11-10 08:26:26 +0200 |
commit | 819c14c86ff29ac62354e5a92a26779c0cbe6236 (patch) | |
tree | d067a893bd6912e4d7f1951459266fb3d8701481 | |
parent | 1dfdb9ebd989f2af1b1d991f5c8e8f348e7101ba (diff) | |
download | efl-819c14c86ff29ac62354e5a92a26779c0cbe6236.tar.gz |
DnD: cancel drag if mouse moves too much
In the case of an entry inside a draggable gengrid, trying to select
text was always resulting in starting a DnD operation because mouse
coordinates were not checked.
Now we check that the mouse coords don't move more than a finger size.
@fix
-rw-r--r-- | src/lib/elementary/elm_cnp.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lib/elementary/elm_cnp.c b/src/lib/elementary/elm_cnp.c index 3ccd0ec102..64f4cba6f8 100644 --- a/src/lib/elementary/elm_cnp.c +++ b/src/lib/elementary/elm_cnp.c @@ -5543,10 +5543,13 @@ static void _cont_obj_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) { /* Cancel any drag waiting to start on timeout */ cnp_debug("In\n"); - if (((Evas_Event_Mouse_Move *)event_info)->event_flags & EVAS_EVENT_FLAG_ON_HOLD) + Item_Container_Drag_Info *st = data; + Evas_Event_Mouse_Move *ev = event_info; + int dx = ev->cur.canvas.x - st->x_down, dy = ev->cur.canvas.y - st->y_down; + int finger_size = elm_config_finger_size_get(); + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD || (dx * dx + dy * dy > finger_size * finger_size)) { - cnp_debug("event on hold - have to cancel DnD\n"); - Item_Container_Drag_Info *st = data; + cnp_debug("event on hold or mouse moved too much - have to cancel DnD\n"); evas_object_event_callback_del_full (st->obj, EVAS_CALLBACK_MOUSE_MOVE, _cont_obj_mouse_move, st); |