int n_taps;
Eina_Bool double_tap;
Ecore_Event_Mouse_Button *ev_down, *ev_multi_down;
- Eina_Bool drag_start;
+ Eina_Bool drag_start; // indicates if tap&hold gesture is ongoing
int drag_x_delta;
int drag_y_delta;
+ int n_fingers; // number of fingers currently touching the screen
+ int initiating_finger_id; // ID of a finger that initiated the tap&hold gesture
+ int primary_finger_id; // ID of a finger that is currently leading the tap&hold gesture
+ int secondary_finger_id; // ID of a finger that may become the next leading finger in the tap&hold gesture
} tap_n_hold_gesture_data;
Ecore_Timer *up_timer;
_emit_mouse_move_event(cov->tap_n_hold_gesture_data.ev_down);
cov->tap_n_hold_gesture_data.ev_down->multi.radius += MAGIC_NUMBER;
cov->tap_n_hold_gesture_data.drag_start = EINA_TRUE;
+ cover->tap_n_hold_gesture_data.n_fingers = cov->hover_gesture.n_fingers;
+ cover->tap_n_hold_gesture_data.initiating_finger_id = cov->hover_gesture.finger[0];
+ cover->tap_n_hold_gesture_data.primary_finger_id = cov->hover_gesture.finger[0];
+ //currently we don't consider secondary finger being predefined at the beginning of tap&hold gesture
+ cover->tap_n_hold_gesture_data.secondary_finger_id = cover->tap_n_hold_gesture_data.primary_finger_id;
ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, cov->tap_n_hold_gesture_data.ev_down, NULL, NULL);
if (cov->tap_gesture_data.tap_type == TWO_FINGERS_GESTURE)
{
_mouse_move(int type, Ecore_Event_Mouse_Move *event)
{
Ecore_Event_Mouse_Move *ev = event;
- // During draging ignore events from other fingers than the finger that initiated the drag
- if (cover->tap_n_hold_gesture_data.drag_start && ev->multi.device > 0)
+ // During draging ignore events from other fingers than the primary finger of the tap&hold gesture
+ if (cover->tap_n_hold_gesture_data.drag_start && ev->multi.device != cover->tap_n_hold_gesture_data.primary_finger_id)
{
+ cover->tap_n_hold_gesture_data.secondary_finger_id = ev->multi.device;
return EINA_FALSE;
}
ev->y += cover->tap_n_hold_gesture_data.drag_y_delta;
ev->root.x += cover->tap_n_hold_gesture_data.drag_x_delta;
ev->root.y += cover->tap_n_hold_gesture_data.drag_y_delta;
+ ev->multi.device = cover->tap_n_hold_gesture_data.initiating_finger_id;
}
else
{
event->multi.radius -= MAGIC_NUMBER;
return EINA_TRUE;
}
- // During draging ignore events from other fingers than the finger that initiated the drag
- if (cover->tap_n_hold_gesture_data.drag_start && ev->multi.device > 0)
+ // During draging change the leading finger if number of fingers involved was more than 1
+ if (cover->tap_n_hold_gesture_data.drag_start && cover->tap_n_hold_gesture_data.n_fingers > 1 )
{
+ cover->tap_n_hold_gesture_data.n_fingers--;
+ if(event->multi.device == cover->tap_n_hold_gesture_data.primary_finger_id)
+ {
+ cover->tap_n_hold_gesture_data.primary_finger_id = cover->tap_n_hold_gesture_data.secondary_finger_id;
+ }
return EINA_FALSE;
}
}
memcpy(ev_up, ev, sizeof(Ecore_Event_Mouse_Button));
ev_up->multi.radius += MAGIC_NUMBER;
+ ev_up->multi.device = cover->tap_n_hold_gesture_data.initiating_finger_id;
if (cover->up_timer)
ecore_timer_del(cover->up_timer);
ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev_multi_up, NULL, NULL);
}
cover->tap_n_hold_gesture_data.drag_start = EINA_FALSE;
+ cover->tap_n_hold_gesture_data.n_fingers = 0;
g_context->highlighted_object_x = -1;
g_context->highlighted_object_y = -1;
}
ev->multi.radius -= MAGIC_NUMBER;
return EINA_TRUE;
}
- // During draging ignore events from other fingers than the finger that initiated the drag
- if (cover->tap_n_hold_gesture_data.drag_start && ev->multi.device > 0)
+ // During draging ignore events from other fingers than the primary finger of the tap&hold gesture
+ if (cover->tap_n_hold_gesture_data.drag_start && ev->multi.device != cover->tap_n_hold_gesture_data.primary_finger_id)
{
+ // register that the number of fingers touching screen increased
+ cover->tap_n_hold_gesture_data.n_fingers++;
return EINA_FALSE;
}
cover->n_taps++;