e_mod_main: add validation for touch position within compositor bounds 99/324999/1 accepted/tizen_9.0_unified accepted/tizen/9.0/unified/20250602.180227
authorduna.oh <duna.oh@samsung.com>
Fri, 30 May 2025 02:36:40 +0000 (11:36 +0900)
committerduna.oh <duna.oh@samsung.com>
Fri, 30 May 2025 02:39:56 +0000 (11:39 +0900)
This commit prevents invalid touch events outside the screen boundaries
from being handled in gesture module.

Change-Id: I06cdbd21aab3203e6b0971fb46843626916d8f61

src/e_mod_gesture_events.c

index 7fe6d9cba1d3eca575742c60af3d7882b932bfcf..2498c7ddbae9be642342be64788c2faa9454e779 100644 (file)
@@ -1783,14 +1783,20 @@ _e_gesture_process_tap_up(Ecore_Event_Mouse_Button *ev)
 }
 
 static Eina_Bool
-_e_gesture_process_touch_check(Ecore_Device *dev, int finger)
+_e_gesture_process_touch_check(Ecore_Device *dev, int finger, int x, int y)
 {
+   int comp_w = 0, comp_h = 0;
    if ((!gesture->grabbed_gesture) ||
        (e_gesture_is_touch_device(dev) == EINA_FALSE) ||
        (finger > E_GESTURE_FINGER_MAX))
      {
         return EINA_FALSE;
      }
+
+   e_comp_size_get(&comp_w, &comp_h);
+   if ((x < 0) || (x > comp_w - 1) || (y < 0) || (y > comp_h - 1))
+     return EINA_FALSE;
+
    return EINA_TRUE;
 }
 
@@ -1799,7 +1805,7 @@ _e_gesture_process_mouse_button_down(void *event)
 {
    Ecore_Event_Mouse_Button *ev = event;
 
-   if (!_e_gesture_process_touch_check(ev->dev, ev->multi.device))
+   if (!_e_gesture_process_touch_check(ev->dev, ev->multi.device, ev->x, ev->y))
      return E_GESTURE_EVENT_STATE_PROPAGATE;
 
    gesture->gesture_events.base_point[ev->multi.device + 1].pressed = EINA_TRUE;
@@ -1854,9 +1860,6 @@ _e_gesture_process_mouse_button_cancel(void *event)
    GTWRN("Mouse Cancel. id:%d dev:%s", ev->multi.device,
          ev->dev ? ecore_device_identifier_get(ev->dev) : "No device");
 
-   if (!_e_gesture_process_touch_check(ev->dev, ev->multi.device))
-     return E_GESTURE_EVENT_STATE_PROPAGATE;
-
    gesture->gesture_events.base_point[ev->multi.device + 1].pressed = EINA_FALSE;
    gesture->gesture_events.base_point[ev->multi.device + 1].axis.x = 0;
    gesture->gesture_events.base_point[ev->multi.device + 1].axis.y = 0;
@@ -1908,7 +1911,7 @@ _e_gesture_process_mouse_button_up(void *event)
 {
    Ecore_Event_Mouse_Button *ev = event;
 
-   if (!_e_gesture_process_touch_check(ev->dev, ev->multi.device))
+   if (!_e_gesture_process_touch_check(ev->dev, ev->multi.device, ev->x, ev->y))
      return E_GESTURE_EVENT_STATE_PROPAGATE;
 
    gesture->gesture_events.base_point[ev->multi.device + 1].axis.x = ev->x;
@@ -1963,7 +1966,7 @@ _e_gesture_process_mouse_move(void *event)
 {
    Ecore_Event_Mouse_Move *ev = event;
 
-   if (!_e_gesture_process_touch_check(ev->dev, ev->multi.device))
+   if (!_e_gesture_process_touch_check(ev->dev, ev->multi.device, ev->x, ev->y))
      return E_GESTURE_EVENT_STATE_PROPAGATE;
 
    if (gesture->gesture_events.num_pressed == 0)