Add "ObjectNeedsScrollGesture" method 07/142107/3 accepted/tizen/4.0/unified/20170829.015937 accepted/tizen/unified/20170810.172535 submit/tizen/20170810.044648 submit/tizen_4.0/20170828.100004
authorShinwoo Kim <cinoo.kim@samsung.com>
Thu, 15 Dec 2016 05:17:48 +0000 (14:17 +0900)
committerShinwoo Kim <cinoo.kim@samsung.com>
Fri, 4 Aug 2017 01:24:13 +0000 (10:24 +0900)
The screen-reader module changes x,y information of 2 fingers hover gesture
if highlight object needs it.

Application side could use this feature setting attribute as below:
 - elm_atspi_accessible_attribute_append(btn, "gesture_required", "scroll");

This patch set depends on:
https://review.tizen.org/gerrit/#/c/142105/ (elementary)
https://review.tizen.org/gerrit/#/c/142108/ (screen-reader)

Change-Id: I0312a748af5bb514dc085f97c5e1ee7f7acad5a5

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

index ccaa2ac..9cbb5a2 100644 (file)
@@ -21,6 +21,7 @@ Eina_Bool is_slider;
 Eina_Bool is_screen_reader_support;
 int highlighted_object_x, highlighted_object_y;
 Eina_Bool is_selection_mode;
+int object_needs_scroll_from_x, object_needs_scroll_from_y;
 
 EAPI E_Module_Api e_modapi =
 {
@@ -34,6 +35,7 @@ static Eldbus_Message *_is_slider(const Eldbus_Service_Interface *iface, const E
 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 Eldbus_Message *_object_needs_scroll_gesture(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
 
 static const Eldbus_Method methods[] = {
       { "ScreenReaderEnabled", ELDBUS_ARGS({"b", "bool"}), ELDBUS_ARGS({"b", "bool"}),
@@ -51,6 +53,9 @@ static const Eldbus_Method methods[] = {
       { "IsSelectionMode", ELDBUS_ARGS({"b", "bool"}), NULL,
         _is_selection_mode
       },
+      { "ObjectNeedsScrollGesture", ELDBUS_ARGS({"i", "int"}, {"i", "int"}), NULL,
+        _object_needs_scroll_gesture
+      },
       { }
 };
 
@@ -314,6 +319,15 @@ _is_selection_mode(const Eldbus_Service_Interface *iface, const Eldbus_Message *
    return NULL;
 }
 
+static Eldbus_Message *
+_object_needs_scroll_gesture(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
+{
+   if (!eldbus_message_arguments_get(msg, "ii", &object_needs_scroll_from_x, &object_needs_scroll_from_y))
+     ERROR("eldbus_message_arguments_get() error\n");
+
+   return NULL;
+}
+
 static int
 _fetch_a11y_bus_address(void)
 {
index 76d831b..e95712a 100644 (file)
@@ -56,6 +56,8 @@ struct _Cover
         Ecore_Event_Mouse_Button *ev_up;
         int flick_to_scroll_last_x;
         int flick_to_scroll_last_y;
+        int object_needs_scroll_x_delta;
+        int object_needs_scroll_y_delta;
    } flick_gesture;
 
    struct {
@@ -566,8 +568,22 @@ start_scroll(Cover *cov)
         return ;
      }
    memcpy(ev_down, cov->flick_gesture.ev_first_down, sizeof(Ecore_Event_Mouse_Button));
-   cov->flick_gesture.ev_first_down->x = cov->hover_gesture.x[0];
-   cov->flick_gesture.ev_first_down->y = cov->hover_gesture.y[0];
+
+   if (object_needs_scroll_from_x != -1 && object_needs_scroll_from_y != -1)
+     {
+        cov->flick_gesture.ev_first_down->x = object_needs_scroll_from_x;
+        cov->flick_gesture.ev_first_down->y = object_needs_scroll_from_y;
+        cov->flick_gesture.object_needs_scroll_x_delta = object_needs_scroll_from_x - cov->flick_gesture.x_org[0];
+        cov->flick_gesture.object_needs_scroll_y_delta = object_needs_scroll_from_y - cov->flick_gesture.y_org[0];
+     }
+   else
+     {
+        cov->flick_gesture.ev_first_down->x = cov->hover_gesture.x[0];
+        cov->flick_gesture.ev_first_down->y = cov->hover_gesture.y[0];
+        cov->flick_gesture.object_needs_scroll_x_delta = 0;
+        cov->flick_gesture.object_needs_scroll_y_delta = 0;
+     }
+
    cov->flick_gesture.ev_first_down->timestamp = (int)(ecore_time_get() * 1000);
    cov->flick_gesture.ev_first_down->multi.radius += MAGIC_NUMBER;
    _emit_mouse_move_event(cov->flick_gesture.ev_first_down);
@@ -1319,7 +1335,20 @@ _mouse_move(int type, Ecore_Event_Mouse_Move *event)
        cover->tap_n_hold_gesture_data.drag_start ||
        (cover->flick_gesture.flick_to_scroll && !is_selection_mode))
      {
+        /* Do not use 2nd finger when highlight object needs scroll.
+           The changed event point info by object_needs_scroll_x,y_delta could be out of screen */
+        if (object_needs_scroll_from_x != -1 &&  ev->multi.device != 0) return EINA_FALSE;
+
         if (ev->multi.radius >= MAGIC_NUMBER) ev->multi.radius -= MAGIC_NUMBER;
+        else
+          {
+             /* Do not change event point info if its multi.radius >= MAGIC_NUMBER.
+                It is created before down event occurs in _emit_mouse_move_event for start_Scroll */
+             ev->x += cover->flick_gesture.object_needs_scroll_x_delta;
+             ev->y += cover->flick_gesture.object_needs_scroll_y_delta;
+             ev->root.x += cover->flick_gesture.object_needs_scroll_x_delta;
+             ev->root.y += cover->flick_gesture.object_needs_scroll_y_delta;
+          }
         if (cover->flick_gesture.flick_to_scroll) _hover_gesture_mouse_move(ev, cover);
         return EINA_TRUE;
      }
@@ -1444,6 +1473,8 @@ _gesture_init()
    is_screen_reader_support = EINA_TRUE;
    highlighted_object_x = -1;
    highlighted_object_y = -1;
+   object_needs_scroll_from_x = -1;
+   object_needs_scroll_from_y = -1;
    scrolling = EINA_FALSE;
 
    zone = e_zone_current_get();
index 15c2ee7..6328c1c 100644 (file)
@@ -70,6 +70,7 @@ 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;
+extern int object_needs_scroll_from_x, object_needs_scroll_from_y;
 
 int _e_mod_log_init(void);
 void _e_mod_log_shutdown(void);