touch: define multitouch_toggle_key_checking function 58/35258/2
authorGiWoong Kim <giwoong.kim@samsung.com>
Mon, 29 Dec 2014 08:08:44 +0000 (17:08 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Fri, 13 Feb 2015 05:43:29 +0000 (21:43 -0800)
Change-Id: I0584df8f97a2d01a027e32cd4e4132b77e92ef5e
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/skin/maruskin_operation.c

index e1bb9743b59a8fbaa094c734974e508506b9c2e4..e2ea3bfdc40e4962d17e389033857caa6efd9490 100644 (file)
@@ -200,73 +200,85 @@ void do_qt_keyboard_key_event(int event_type, int keycode) {
     }
 }
 
-void do_keyboard_key_event(int event_type,
+#if !defined(CONFIG_USE_SHM) && defined(CONFIG_SDL)
+static void multitouch_toggle_key_checking(int event_type,
     int keycode, int state_mask, int key_location)
 {
-    int scancode = -1;
+    /* multi-touch checking */
+    state_mask &= ~JAVA_KEYCODE_NO_FOCUS;
 
-    TRACE("Keyboard Key : event_type=%d, keycode=%d,"
-        "state_mask=%d, key_location=%d\n",
-        event_type, keycode, state_mask, key_location);
+    if ((keycode == JAVA_KEYCODE_BIT_SHIFT && state_mask == JAVA_KEYCODE_BIT_CTRL) ||
+        (keycode == JAVA_KEYCODE_BIT_CTRL && state_mask == JAVA_KEYCODE_BIT_SHIFT))
+    {
+        if (KEY_PRESSED == event_type) {
+            get_emul_multi_touch_state()->multitouch_enable = 2;
+
+            /* 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 &&
+                pressing_origin_x != -1 && pressing_origin_y != -1) {
+                add_finger_point(
+                    pressing_origin_x, pressing_origin_y,
+                    pressing_x, pressing_y);
+                pressing_x = pressing_y = -1;
+                pressing_origin_x = pressing_origin_y = -1;
 
-#if !defined(CONFIG_USE_SHM) && defined(CONFIG_SDL)
-    if (get_emul_max_touch_point() > 1) {
-        /* multi-touch checking */
-        int state_mask_temp = state_mask & ~JAVA_KEYCODE_NO_FOCUS;
-
-        if ((keycode == JAVA_KEYCODE_BIT_SHIFT &&
-            state_mask_temp == JAVA_KEYCODE_BIT_CTRL) ||
-            (keycode == JAVA_KEYCODE_BIT_CTRL &&
-            state_mask_temp == JAVA_KEYCODE_BIT_SHIFT))
-        {
-            if (KEY_PRESSED == event_type) {
-                get_emul_multi_touch_state()->multitouch_enable = 2;
-
-                /* add a finger before start the multi-touch processing
-                if already exist the pressed touch in display */
-                if (pressing_x != -1 && pressing_y != -1 &&
-                    pressing_origin_x != -1 && pressing_origin_y != -1) {
-                    add_finger_point(
-                        pressing_origin_x, pressing_origin_y,
-                        pressing_x, pressing_y);
-                    pressing_x = pressing_y = -1;
-                    pressing_origin_x = pressing_origin_y = -1;
-                }
-
-                INFO("enable multi-touch = mode 2\n");
+                maru_display_update();
             }
-        }
-        else if (keycode == JAVA_KEYCODE_BIT_CTRL ||
-            keycode == JAVA_KEYCODE_BIT_SHIFT)
-        {
-            if (KEY_PRESSED == event_type) {
-                get_emul_multi_touch_state()->multitouch_enable = 1;
 
-                /* add a finger before start the multi-touch processing
-                if already exist the pressed touch in display */
-                if (pressing_x != -1 && pressing_y != -1 &&
-                    pressing_origin_x != -1 && pressing_origin_y != -1) {
-                    add_finger_point(
-                        pressing_origin_x, pressing_origin_y,
-                        pressing_x, pressing_y);
-                    pressing_x = pressing_y = -1;
-                    pressing_origin_x = pressing_origin_y = -1;
-                }
-
-                INFO("enable multi-touch = mode 1\n");
-            } else if (KEY_RELEASED == event_type) {
-                if (state_mask_temp == (JAVA_KEYCODE_BIT_CTRL | JAVA_KEYCODE_BIT_SHIFT)) {
-                    get_emul_multi_touch_state()->multitouch_enable = 1;
-                    INFO("enabled multi-touch = mode 1\'\n");
-                } else {
-                    clear_finger_slot(false);
-                    INFO("disable multi-touch\n");
-                }
+            INFO("enable multi-touch mode 2\n");
+        }
+    }
+    else if (keycode == JAVA_KEYCODE_BIT_CTRL ||
+        keycode == JAVA_KEYCODE_BIT_SHIFT)
+    {
+        if (KEY_PRESSED == event_type) {
+            get_emul_multi_touch_state()->multitouch_enable = 1;
+
+            /* 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 &&
+                pressing_origin_x != -1 && pressing_origin_y != -1) {
+                add_finger_point(
+                    pressing_origin_x, pressing_origin_y,
+                    pressing_x, pressing_y);
+                pressing_x = pressing_y = -1;
+                pressing_origin_x = pressing_origin_y = -1;
 
                 maru_display_update();
             }
+
+            INFO("enable multi-touch mode 1\n");
+        } else if (KEY_RELEASED == event_type) {
+            if (state_mask == (JAVA_KEYCODE_BIT_CTRL | JAVA_KEYCODE_BIT_SHIFT)) {
+                get_emul_multi_touch_state()->multitouch_enable = 1;
+                INFO("enable multi-touch mode 2->1\n");
+            } else {
+                clear_finger_slot(false);
+                INFO("disable multi-touch\n");
+            }
+
+            maru_display_update();
         }
+    }
+}
+#endif
 
+void do_keyboard_key_event(int event_type,
+    int keycode, int state_mask, int key_location)
+{
+    int scancode = -1;
+
+    TRACE("Keyboard Key : event_type=%d, keycode=%d,"
+        "state_mask=%d, key_location=%d\n",
+        event_type, keycode, state_mask, key_location);
+
+#if !defined(CONFIG_USE_SHM) && defined(CONFIG_SDL)
+    if (get_emul_max_touch_point() > 1) {
+        multitouch_toggle_key_checking(event_type,
+            keycode, state_mask, key_location);
     }
 #endif