[e-mod-tizen-screen-reader] Emit hover events of ONGOING state in interval of 200ms 97/238297/1 accepted/tizen/unified/20200714.065657 submit/tizen/20200713.050659
authorPrasoon Singh <prasoon.16@samsung.com>
Tue, 30 Jun 2020 09:47:26 +0000 (15:17 +0530)
committerKamil Konieczny <k.konieczny@samsung.com>
Fri, 10 Jul 2020 09:12:17 +0000 (09:12 +0000)
On hover, gesture update is sent continously which degrades
performance. Screen Reader is bombarded with continous unneccesary
updates about hover which causes performance issues for feature like
scroll audio feedback. Limiting hover events to 200ms intervals helps
to fix this.

Change-Id: I0f9e546d099b0eca8e3dfef033f8fbfadc4c3376
Signed-off-by: Prasoon Singh <prasoon.16@samsung.com>
(cherry picked from commit 25e6aa0df955a290b10363257bed3379ecfbd763)

src/e_screen_reader_gestures.c

index 8e07040..1bfef0c 100644 (file)
@@ -4,10 +4,12 @@
 #include "e_mod_accessibility_conf.h"
 
 #define HISTORY_MAX 8
+#define ONGOING_HOVER_GESTURE_INTERPRETATION_INTERVAL 200
 
 double MAGIC_NUMBER = 987654321.0;
 Eina_Bool app_support_gestures;
 Eina_Bool gestures_supported_by_app [ GESTURES_COUNT ];
+unsigned int _last_hover_event_time = -1;
 
 typedef enum {
      FLICK_DIRECTION_UNDEFINED,
@@ -949,6 +951,7 @@ _hover_gesture_mouse_up(Ecore_Event_Mouse_Button *ev, Cover *cov)
              if (cov->hover_gesture.timer)
                ecore_timer_del(cov->hover_gesture.timer);
              cov->hover_gesture.timer = NULL;
+             _last_hover_event_time = -1;
              // aditionally emit event to complete sequence
              if (cov->hover_gesture.longpressed || scrolling)
                {
@@ -1085,7 +1088,12 @@ _hover_gesture_mouse_move(Ecore_Event_Mouse_Move *ev, Cover *cov)
           }
           cov->hover_gesture.x[i] = ev->root.x;
           cov->hover_gesture.y[i] = ev->root.y;
-          _hover_event_emit(cov, GESTURE_ONGOING);
+          if ((_last_hover_event_time == -1) ||
+                      (abs(ev->timestamp - _last_hover_event_time) > ONGOING_HOVER_GESTURE_INTERPRETATION_INTERVAL))
+            {
+               _hover_event_emit(cov, GESTURE_ONGOING);
+               _last_hover_event_time = ev->timestamp;
+            }
       }
 }
 
@@ -1651,6 +1659,7 @@ _gesture_init()
    object_needs_scroll_from_x = -1;
    object_needs_scroll_from_y = -1;
    scrolling = EINA_FALSE;
+   _last_hover_event_time = -1;
 
    zone = e_zone_current_get();
    if (zone)