touch: modified multi-touch mode 3 60/35260/3
authorGiWoong Kim <giwoong.kim@samsung.com>
Thu, 1 Jan 2015 08:18:24 +0000 (17:18 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Fri, 13 Feb 2015 05:45:12 +0000 (21:45 -0800)
supports single finger point dragging
disable multi-touch mode if the another key is pressed while
multi-touching

Change-Id: I1ea40d4d737bc0bfd8ba0845592a5e21027cd511
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/display/maru_finger.c
tizen/src/skin/maruskin_operation.c

index 45dd12778e927e7d2e041cf9700c895754c3acfe..556336ea739f97c5605cf30880368903410687c7 100644 (file)
@@ -346,6 +346,7 @@ void maru_finger_processing_1(
 
         if (mts->finger_cnt == 0)
         { /* first finger touch input */
+            INFO("multi-touch mode 1 processing");
 
             if (add_finger_point(origin_x, origin_y, x, y) == -1) {
                 return;
@@ -376,7 +377,7 @@ void maru_finger_processing_1(
                 finger->x = x;
                 finger->y = y;
                 if (finger->id != 0) {
-                    INFO("%d finger touching\n", finger->id);
+                    INFO("id %d finger touching\n", finger->id);
                     virtio_touchscreen_event(x, y,
                         mts->finger_cnt - 1, QEMU_MOUSE_PRESSED);
                 }
@@ -384,7 +385,10 @@ void maru_finger_processing_1(
         }
         else /* one more finger */
         {
-            add_finger_point(origin_x, origin_y, x, y);
+            if (add_finger_point(origin_x, origin_y, x, y) == -1) {
+                return;
+            }
+
             virtio_touchscreen_event(x, y,
                 mts->finger_cnt - 1, QEMU_MOUSE_PRESSED);
         }
@@ -465,6 +469,7 @@ void maru_finger_processing_2(
 
         if (mts->finger_cnt == 0)
         { /* first finger touch input */
+            INFO("multi-touch mode 2 processing");
 
             if (add_finger_point(origin_x, origin_y, x, y) == -1) {
                 return;
@@ -486,7 +491,10 @@ void maru_finger_processing_2(
         }
         else /* one more finger */
         {
-            add_finger_point(origin_x, origin_y, x, y);
+            if (add_finger_point(origin_x, origin_y, x, y) == -1) {
+                return;
+            }
+
             virtio_touchscreen_event(x, y,
                 mts->finger_cnt - 1, QEMU_MOUSE_PRESSED);
         }
@@ -503,35 +511,14 @@ void maru_finger_processing_3(
     FingerPoint *finger = NULL;
 
     if (touch_type == MOUSE_DOWN || touch_type == MOUSE_DRAG) { /* pressed */
-        if (_grab_finger_id > 0 && _grab_finger_id <= 2) {
-            FingerPoint *finger1 = get_finger_point_from_slot(0);
-            FingerPoint *finger2 = get_finger_point_from_slot(1);
-            if (finger1 != NULL && finger2 != NULL) {
-                FingerPoint *co_finger = NULL;
-
-                if (_grab_finger_id == 2) {
-                    finger = finger2;
-                    co_finger = finger1;
-                } else {
-                    finger = finger1;
-                    co_finger = finger2;
-                }
-
+        if (_grab_finger_id > 0) {
+            finger = get_finger_point_from_slot(_grab_finger_id - 1);
+            if (finger != NULL && _grab_finger_id <= 2) {
                 const int origin_distance_x = origin_x - finger->origin_x;
                 const int origin_distance_y = origin_y - finger->origin_y;
                 const int distance_x = x - finger->x;
                 const int distance_y = y - finger->y;
 
-                /* bounds checking */
-                if ((co_finger->x - distance_x) >= get_emul_resolution_width() ||
-                    (co_finger->x - distance_x) < 0 ||
-                    (co_finger->y - distance_y) >= get_emul_resolution_height() ||
-                    (co_finger->y - distance_y) < 0) {
-                    TRACE("id %d finger is out of bounds (%d, %d)\n",
-                        co_finger->id, co_finger->x - distance_x, co_finger->y - distance_y);
-                    return;
-                }
-
                 /* move */
                 finger->origin_x += origin_distance_x;
                 finger->origin_y += origin_distance_y;
@@ -544,23 +531,41 @@ void maru_finger_processing_3(
                         finger->id, x, y);
                 }
 
-                co_finger->origin_x -= origin_distance_x;
-                co_finger->origin_y -= origin_distance_y;
-                co_finger->x -= distance_x;
-                co_finger->y -= distance_y;
-                if (co_finger->id != 0) {
-                    virtio_touchscreen_event(x, y,
-                        co_finger->id - 1, QEMU_MOUSE_PRESSED);
-                    TRACE("id %d finger multi-touch dragging : (%d, %d)\n",
-                        co_finger->id, x, y);
+                if (mts->finger_cnt > 1) {
+                    FingerPoint *co_finger = get_finger_point_from_slot(
+                         (_grab_finger_id == 2) ? 0 : 1);
+                    if (co_finger != NULL) {
+                        /* bounds checking */
+                        if ((co_finger->x - distance_x) >= get_emul_resolution_width() ||
+                            (co_finger->x - distance_x) < 0 ||
+                            (co_finger->y - distance_y) >= get_emul_resolution_height() ||
+                            (co_finger->y - distance_y) < 0) {
+                            TRACE("id %d finger is out of bounds (%d, %d)\n",
+                                co_finger->id, co_finger->x - distance_x, co_finger->y - distance_y);
+                            return;
+                        }
+
+                        /* move */
+                        co_finger->origin_x -= origin_distance_x;
+                        co_finger->origin_y -= origin_distance_y;
+                        co_finger->x -= distance_x;
+                        co_finger->y -= distance_y;
+                        if (co_finger->id != 0) {
+                            virtio_touchscreen_event(co_finger->x, co_finger->y,
+                                co_finger->id - 1, QEMU_MOUSE_PRESSED);
+                            TRACE("id %d finger multi-touch dragging : (%d, %d)\n",
+                                co_finger->id, co_finger->x, co_finger->y);
+                        }
+                    }
                 }
-
-                return;
             }
+
+            return;
         }
 
         if (mts->finger_cnt == 0)
         { /* first finger touch input */
+            INFO("multi-touch mode 3 processing");
 
             if (add_finger_point(origin_x, origin_y, x, y) == -1) {
                 return;
@@ -598,7 +603,10 @@ void maru_finger_processing_3(
         }
         else /* one more finger */
         {
-            add_finger_point(origin_x, origin_y, x, y);
+            if (add_finger_point(origin_x, origin_y, x, y) == -1) {
+                return;
+            }
+
             virtio_touchscreen_event(x, y,
                 mts->finger_cnt - 1, QEMU_MOUSE_PRESSED);
         }
index 1369f41185c28ebc8298001b55f6928b76c47e54..7b889650a7992d03acb750f62645992482e9ce58 100644 (file)
@@ -231,8 +231,8 @@ static void multitouch_toggle_key_checking(int event_type,
             INFO("enable multi-touch mode 3\n");
         }
     }
-    else if ((keycode == JAVA_KEYCODE_BIT_SHIFT && state_mask == JAVA_KEYCODE_BIT_CTRL) ||
-        (keycode == JAVA_KEYCODE_BIT_CTRL && state_mask == JAVA_KEYCODE_BIT_SHIFT))
+    else if ((keycode == JAVA_KEYCODE_BIT_CTRL && state_mask == JAVA_KEYCODE_BIT_SHIFT) ||
+        (keycode == JAVA_KEYCODE_BIT_SHIFT && state_mask == JAVA_KEYCODE_BIT_CTRL))
     {
         if (KEY_PRESSED == event_type) {
             set_multi_touch_enable(2);
@@ -240,7 +240,7 @@ static void multitouch_toggle_key_checking(int event_type,
             /* Before the Emulator starts multi-touch processing,
              * add a first finger if user just switches on to the multi-touch mode
              * while display dragging. */
-            if (pressing_x != -1 && pressing_y != -1 &&
+            if (get_finger_cnt() == 0 && pressing_x != -1 && pressing_y != -1 &&
                 pressing_origin_x != -1 && pressing_origin_y != -1) {
                 add_finger_point(
                     pressing_origin_x, pressing_origin_y,
@@ -262,7 +262,7 @@ static void multitouch_toggle_key_checking(int event_type,
             /* Before the Emulator starts multi-touch processing,
              * add a first finger if user just switches on to the multi-touch mode
              * while display dragging. */
-            if (pressing_x != -1 && pressing_y != -1 &&
+            if (get_finger_cnt() == 0 && pressing_x != -1 && pressing_y != -1 &&
                 pressing_origin_x != -1 && pressing_origin_y != -1) {
                 add_finger_point(
                     pressing_origin_x, pressing_origin_y,
@@ -299,6 +299,15 @@ static void multitouch_toggle_key_checking(int event_type,
                 INFO("disable multi-touch\n");
             }
 
+            maru_display_update();
+        }
+    }
+    else
+    {
+        if (get_multi_touch_enable() != 0) {
+            clear_finger_slot(false);
+            INFO("disable multi-touch\n");
+
             maru_display_update();
         }
     }