Fix unmatched tap gesture count in invalid input. 23/308823/1 accepted/tizen/7.0/unified/20240402.013011
authorHosang Kim <hosang12.kim@samsung.com>
Fri, 29 Mar 2024 11:51:55 +0000 (20:51 +0900)
committerEverLEEst(SangHyeon Lee) <sh10233.lee@samsung.com>
Mon, 1 Apr 2024 12:34:47 +0000 (21:34 +0900)
If first finger is valid, other finger comes invalid down - valid-up,
down is ignored, but up is activated.
this occurs tap count negative which blocks all accessiblity gesture.

this fix prevent those case by block the invalid input only the first
finger so second will activate regardless of it's position.

Change-Id: I17b13e4ef48c99771c95e76d2ddda2f99412f2fc

src/e_screen_reader_gestures.c

index 9277b66..59e3b4a 100644 (file)
@@ -1214,7 +1214,7 @@ _tap_event_emit(Cover *cov, gesture_state_e state)
             }
          break;
       default:
-         ERROR("Unknown tap");
+         ERROR("Unknown tap ntaps %d", cov->n_taps);
          break;
      }
 }
@@ -1286,7 +1286,7 @@ _tap_gestures_mouse_down(Ecore_Event_Mouse_Button *ev, Cover *cov)
 {
    if (cov->n_taps > 4)
       {
-         ERROR("Too many fingers");
+         ERROR("Too many fingers ntaps%d", cov->n_taps);
          return;
       }
 
@@ -1372,7 +1372,7 @@ _tap_gestures_mouse_down(Ecore_Event_Mouse_Button *ev, Cover *cov)
             }
          else
             {
-               ERROR("Unknown finger down");
+               ERROR("Unknown finger down n_taps %d", cov->n_taps);
             }
          ecore_timer_reset(cov->tap_gesture_data.timer);
       }
@@ -1442,7 +1442,7 @@ _tap_gestures_mouse_up(Ecore_Event_Mouse_Button *ev, Cover *cov)
             }
          else
             {
-               ERROR("Unknown finger up, abort gesture");
+               ERROR("Unknown finger up, abort gesture n_taps %d", cov->n_taps);
                cov->tap_gesture_data.started = EINA_FALSE;
             }
       }
@@ -1462,7 +1462,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 tap gesture");
+                  ERROR("Abort tap gesture %d", cov->n_taps);
                   if (cov->n_taps == 2) scrolling = EINA_TRUE;
                   cov->tap_gesture_data.started = EINA_FALSE;
                   if (cov->tap_gesture_data.timer)
@@ -1572,7 +1572,7 @@ _mouse_button_up(int type, Ecore_Event_Mouse_Button *event)
         Ecore_Event_Mouse_Button *ev_up, *ev_multi_up;
         if (!(ev_up = malloc(sizeof(Ecore_Event_Mouse_Button))))
           {
-             DEBUG("NOT ENOUGH MEMORY");
+             ERROR("NOT ENOUGH MEMORY");
              return EINA_FALSE;
           }
         memcpy(ev_up, ev, sizeof(Ecore_Event_Mouse_Button));
@@ -1587,7 +1587,7 @@ _mouse_button_up(int type, Ecore_Event_Mouse_Button *event)
           {
              if (!(ev_multi_up = malloc(sizeof(Ecore_Event_Mouse_Button))))
                {
-                  DEBUG("NOT ENOUGH MEMORY");
+                  ERROR("NOT ENOUGH MEMORY");
                   return EINA_FALSE;
                }
              memcpy(ev_multi_up, ev, sizeof(Ecore_Event_Mouse_Button));
@@ -1645,8 +1645,13 @@ _mouse_button_down(int type, Ecore_Event_Mouse_Button *event)
 }
 
 static Eina_Bool
-_is_event_on_valid_area(int type, int x, int y)
+_is_event_on_valid_area(int type, int x, int y, double radius)
 {
+   if (radius >= MAGIC_NUMBER)
+     {
+        return EINA_TRUE;
+     }
+
    E_Zone *zone;
    E_Accessibility_Conf_Edd* conf;
    Eina_Bool is_invalid_area = EINA_FALSE;
@@ -1676,7 +1681,7 @@ _is_event_on_valid_area(int type, int x, int y)
           }
         cover->finger_data.n_taps++;
 
-        if (is_invalid_area || cover->finger_data.invalid_pressed)
+        if (cover->finger_data.invalid_pressed)
            return EINA_FALSE;
      }
    else if (ECORE_EVENT_MOUSE_BUTTON_UP == type)
@@ -1707,17 +1712,17 @@ _is_valid_event(int type, void *event)
    if (type == ECORE_EVENT_MOUSE_BUTTON_DOWN)
      {
         Ecore_Event_Mouse_Button *ev = event;
-        return _is_event_on_valid_area(type, ev->x, ev->y);
+        return _is_event_on_valid_area(type, ev->x, ev->y, ev->multi.radius);
      }
    else if (type == ECORE_EVENT_MOUSE_BUTTON_UP)
      {
-       Ecore_Event_Mouse_Button *ev = event;
-       return _is_event_on_valid_area(type, ev->x, ev->y);
+        Ecore_Event_Mouse_Button *ev = event;
+        return _is_event_on_valid_area(type, ev->x, ev->y, ev->multi.radius);
      }
    else if (type == ECORE_EVENT_MOUSE_MOVE)
      {
         Ecore_Event_Mouse_Move *ev = event;
-        return _is_event_on_valid_area(type, ev->x, ev->y);
+        return _is_event_on_valid_area(type, ev->x, ev->y, ev->multi.radius);
      }
 
    return EINA_TRUE;