e_mod_main: add validation for touch position within compositor bounds 98/324998/1 accepted/tizen_unified accepted/tizen_unified_x accepted/tizen/unified/20250602.182621 accepted/tizen/unified/x/20250604.024132
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:36:43 +0000 (11:36 +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 864ceea970b24ceaae5fd534436d675d2723395a..10a4346362971e08213dfd522fac40543c717f84 100644 (file)
@@ -1796,14 +1796,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;
 }
 
@@ -1812,7 +1818,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;
@@ -1867,9 +1873,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;
@@ -1921,7 +1924,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;
@@ -1976,7 +1979,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)