Support selection mode 82/135982/1 accepted/tizen/unified/20170711.181140 submit/tizen/20170707.071852 submit/tizen/20170711.023244
authorShinwoo Kim <cinoo.kim@samsung.com>
Fri, 31 Mar 2017 10:20:25 +0000 (19:20 +0900)
committerShinwoo Kim <cinoo.kim@samsung.com>
Tue, 27 Jun 2017 23:14:25 +0000 (08:14 +0900)
Double tap & hold with two fingers to enter the Selection mode.
If the text input filed is changed to selection mode, then we do not use two
fingers to scroll. The two fingers gesture is used as below:

 - 2 fingers flick down: select all
 - 2 fingers flick up: copy
 - 2 fingers flick left: cut
 - 2 fingers flick right: paste

Change-Id: Iede0729340f352249e1f489005b66f2bc4247b37
Needs: https://review.tizen.org/gerrit/#/c/122452/

src/e_mod_main.c
src/e_screen_reader_gestures.c
src/e_screen_reader_private.h

index 78f6f2b..133fb2d 100644 (file)
@@ -19,6 +19,7 @@ Eldbus_Service_Interface *iface = NULL;
 Eina_Bool is_slider;
 Eina_Bool is_screen_reader_support;
 int highlighted_object_x, highlighted_object_y;
+Eina_Bool is_selection_mode;
 
 EAPI E_Module_Api e_modapi =
 {
@@ -31,6 +32,7 @@ static Eldbus_Message *_sc_enable(const Eldbus_Service_Interface *iface, const E
 static Eldbus_Message *_is_slider(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
 static Eldbus_Message *_highlighted_object_info(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
 static Eldbus_Message *_is_screen_reader_support(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
+static Eldbus_Message *_is_selection_mode(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
 
 static const Eldbus_Method methods[] = {
       { "ScreenReaderEnabled", ELDBUS_ARGS({"b", "bool"}), ELDBUS_ARGS({"b", "bool"}),
@@ -45,6 +47,9 @@ static const Eldbus_Method methods[] = {
       { "IsScreenReaderSupport", ELDBUS_ARGS({"b", "bool"}), NULL,
         _is_screen_reader_support
       },
+      { "IsSelectionMode", ELDBUS_ARGS({"b", "bool"}), NULL,
+        _is_selection_mode
+      },
       { }
 };
 
@@ -299,6 +304,15 @@ _highlighted_object_info(const Eldbus_Service_Interface *iface, const Eldbus_Mes
    return NULL;
 }
 
+static Eldbus_Message *
+_is_selection_mode(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
+{
+   if (!eldbus_message_arguments_get(msg, "b", &is_selection_mode))
+     ERROR("eldbus_message_arguments_get() error\n");
+
+   return NULL;
+}
+
 static int
 _fetch_a11y_bus_address(void)
 {
index 99a0d79..8925ce2 100644 (file)
@@ -505,7 +505,6 @@ _flick_gesture_mouse_up(Ecore_Event_Mouse_Button *ev, Cover *cov)
 
         cov->flick_gesture.x_end[i] = ev->root.x;
         cov->flick_gesture.y_end[i] = ev->root.y;
-
         if (!cov->flick_gesture.n_fingers_left)
           {
              _flick_event_emit(cov);
@@ -620,7 +619,9 @@ _flick_gesture_mouse_move(Ecore_Event_Mouse_Move *ev, Cover *cov)
                break;
          }
          if (i == 1 && cov->n_taps == 2) {
-            if ((cov->flick_gesture.flick_to_scroll || _flick_to_scroll_gesture_conditions_met(ev, cov->flick_gesture.timestamp[i], dx, dy)) && scrolling) {
+            if (!is_selection_mode && scrolling &&
+                (cov->flick_gesture.flick_to_scroll ||
+                 _flick_to_scroll_gesture_conditions_met(ev, cov->flick_gesture.timestamp[i], dx, dy))) {
                if (!cov->flick_gesture.flick_to_scroll) {
                   start_scroll(cov);
                   cov->flick_gesture.flick_to_scroll = EINA_TRUE;
@@ -804,7 +805,7 @@ _hover_gesture_mouse_down(Ecore_Event_Mouse_Button *ev, Cover *cov)
                }
 
                /* start_scroll is necessary for mouse down event */
-               if (!cov->flick_gesture.flick_to_scroll) {
+               if (!is_selection_mode && !cov->flick_gesture.flick_to_scroll) {
                   start_scroll(cov);
                   cov->flick_gesture.flick_to_scroll = EINA_TRUE;
                }
@@ -1292,7 +1293,7 @@ _tap_gestures_move(Ecore_Event_Mouse_Move *ev, Cover *cov)
              int dy = ev->root.y - cov->tap_gesture_data.y_org[i];
              if ((dx * dx + dy * dy) > _e_mod_config->one_finger_tap_radius * _e_mod_config->one_finger_tap_radius)
                {
-                  ERROR("Abort gesture");
+                  ERROR("Abort tap gesture");
                   if (cov->n_taps == 2) scrolling = EINA_TRUE;
                   cov->tap_gesture_data.started = EINA_FALSE;
                   ecore_timer_del(cov->tap_gesture_data.timer);
@@ -1313,7 +1314,9 @@ _mouse_move(int type, Ecore_Event_Mouse_Move *event)
    Ecore_Event_Mouse_Move *ev = event;
    /* flick_to_scroll: 2 fingers touch and move
       drag_start: 1 finger tap and hold move */
-   if (ev->multi.radius >= MAGIC_NUMBER || cover->flick_gesture.flick_to_scroll || cover->tap_n_hold_gesture_data.drag_start)
+   if (ev->multi.radius >= MAGIC_NUMBER ||
+       cover->tap_n_hold_gesture_data.drag_start ||
+       (cover->flick_gesture.flick_to_scroll && !is_selection_mode))
      {
         if (ev->multi.radius >= MAGIC_NUMBER) ev->multi.radius -= MAGIC_NUMBER;
         if (cover->flick_gesture.flick_to_scroll) _hover_gesture_mouse_move(ev, cover);
index 21f0647..15c2ee7 100644 (file)
@@ -69,6 +69,7 @@ typedef struct {
 extern Eina_Bool is_slider;
 extern Eina_Bool is_screen_reader_support;
 extern int highlighted_object_x, highlighted_object_y;
+extern Eina_Bool is_selection_mode;
 
 int _e_mod_log_init(void);
 void _e_mod_log_shutdown(void);