"Touch, hold and drag" gesture implementation 66/162366/2
authorLukasz Wlazly <l.wlazly@partner.samsung.com>
Thu, 30 Nov 2017 12:28:04 +0000 (13:28 +0100)
committerLukasz Wlazly <l.wlazly@partner.samsung.com>
Thu, 30 Nov 2017 12:45:14 +0000 (13:45 +0100)
Change-Id: Ic086968b0326106ac8656a7977c79619c1a62fd1

src/e_dispatch_gesture_event.c
src/e_dispatch_gesture_event.h
src/e_mod_main.c

index 4f9181b..24cf957 100644 (file)
@@ -5,8 +5,7 @@
 #define MOVE_STEP 10
 #define ZOOM_LENGTH 150
 
-#define DRAG_INITIAL_STEPS 3
-#define DRAG_FINAL_STEPS 1
+#define DRAG_INITIAL_STEPS 4
 
 enum
 {
@@ -135,6 +134,7 @@ static TouchInputSequence _ts_drag[] = {
    {0.0, _dispatch_mouse_in_event, 0},
    {0.0, _dispatch_mouse_move_event, 0},
    {0.0, _dispatch_mouse_down_event, 0},
+   {0.0, _dispatch_mouse_move_event, 0},
    /* move */
    {0.01, _dispatch_mouse_move_event, 0},
    /* up */
@@ -564,7 +564,7 @@ void _e_dispatch_gesture_event(int type, int x, int y)
    ecore_timer_add(tc.ts->delay, _touch_sequnece_timer, &tc);
 }
 
-void _e_dispatch_drag_event(int x1, int y1, int x2, int y2, int steps)
+void _e_dispatch_drag_event(int x1, int y1, int x2, int y2, int steps, double hold_time)
 {
    E_Zone *zone;
 
@@ -592,6 +592,8 @@ void _e_dispatch_drag_event(int x1, int y1, int x2, int y2, int steps)
    if (y1 == 0) y1 += 1;
    if (y1 == _zh) y1 -= 1;
 
+   _ts_drag[3].delay = hold_time;
+
    dtc.type = DRAG;
    dtc.x1 = x1;
    dtc.y1 = y1;
index 40aaebc..3af3b0f 100644 (file)
@@ -2,6 +2,6 @@
 #define E_DISPATCH_GESTURE_EVENT_H_
 
 void _e_dispatch_gesture_event(int type, int x, int y);
-void _e_dispatch_drag_event(int x1, int y1, int x2, int y2, int steps);
+void _e_dispatch_drag_event(int x1, int y1, int x2, int y2, int steps, double hold_time);
 
 #endif /* E_DISPATCH_GESTURE_EVENT_H_ */
index 6897ff4..11d97e2 100644 (file)
@@ -76,7 +76,7 @@ static const Eldbus_Method methods[] = {
       { "DispatchGestureEvent", ELDBUS_ARGS({"i", "int"}, {"i", "int"}, {"i", "int"}), NULL,
         _dispatch_gesture_event
       },
-      { "DispatchDragEvent", ELDBUS_ARGS({"i", "int"}, {"i", "int"}, {"i", "int"}, {"i", "int"}, {"i", "int"}), NULL,
+      { "DispatchDragEvent", ELDBUS_ARGS({"i", "int"}, {"i", "int"}, {"i", "int"}, {"i", "int"}, {"i", "int"}, {"d", "double"}), NULL,
         _dispatch_drag_event
       },
       { }
@@ -431,9 +431,10 @@ static Eldbus_Message *
 _dispatch_drag_event(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
 {
    int x1, y1, x2, y2, steps;
-   if (eldbus_message_arguments_get(msg, "iiiii", &x1, &y1, &x2, &y2, &steps))
+   double hold_time;
+   if (eldbus_message_arguments_get(msg, "iiiiid", &x1, &y1, &x2, &y2, &steps, &hold_time))
      {
-        _e_dispatch_drag_event(x1, y1, x2, y2, steps);
+        _e_dispatch_drag_event(x1, y1, x2, y2, steps, hold_time);
      }
    else
      ERROR("eldbus_message_arguments_get() error\n");