e_input: add a config 'touch_block_on_palm' and apply it on palm 40/313640/1
authorduna.oh <duna.oh@samsung.com>
Fri, 28 Jun 2024 06:52:51 +0000 (15:52 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Fri, 28 Jun 2024 11:19:34 +0000 (20:19 +0900)
Change-Id: I9c36de81e91ebf30151a2baf7b5f7efba7c0201a

src/bin/core/e_comp_cfdata.c
src/bin/inputmgr/e_input_evdev.c
src/include/e_comp_cfdata.h

index 6b4d3f05b274825ae94d3625238ccc767384d9b8..7f181a5aa73443aed1fd866d4e959deb2326c736 100644 (file)
@@ -93,6 +93,7 @@ e_comp_cfdata_edd_init(E_Config_DD **conf_edd, E_Config_DD **match_edd)
    E_CONFIG_VAL(D, T, commit_handler_timer.interval, DOUBLE);
    E_CONFIG_VAL(D, T, e_wheel_click_angle, INT);
    E_CONFIG_VAL(D, T, input_output_assign_policy, INT);
+   E_CONFIG_VAL(D, T, touch_block_on_palm, INT);
 }
 
 EINTERN E_Comp_Config *
@@ -265,6 +266,8 @@ e_comp_cfdata_config_new(void)
 
    cfg->input_output_assign_policy = 0;
 
+   cfg->touch_block_on_palm = 0;
+
    return cfg;
 
 error:
index 15fe691f573c221c0e2eab46528dc286bfa5a911..f262e32d104a08eda98478e08be65d47040ccd7a 100644 (file)
@@ -20,6 +20,8 @@ static void  _device_modifiers_update(E_Input_Evdev *edev);
 static void  _device_configured_size_get(E_Input_Evdev *edev, int *x, int *y, int *w, int *h);
 static void  _device_output_assign(E_Input_Evdev *edev, E_Input_Seat_Capabilities cap);
 
+static Eina_Bool _touch_blocked_by_palm, _touch_up_blocked_by_palm;
+
 void
 e_input_evdev_device_calibration_set(E_Input_Evdev *edev)
 {
@@ -2042,6 +2044,13 @@ _device_handle_touch_down(struct libinput_device *device, struct libinput_event_
 
    atomic_fetch_or(&edev->touch.raw_pressed, (1 << edev->mt_slot));
 
+   if (_touch_blocked_by_palm)
+     {
+        ELOGF("Touch", "Down (id: %d, x: %d, y: %d) is blocked during palm", NULL,
+              edev->mt_slot, edev->seat->ptr.ix, edev->seat->ptr.iy);
+        return;
+     }
+
    if (edev->touch.blocked)
      {
         void *blocked_client = atomic_load(&edev->seat->dev->blocked_client);
@@ -2105,6 +2114,13 @@ _device_handle_touch_motion(struct libinput_device *device, struct libinput_even
         edev->touch.coords[edev->mt_slot].y = edev->seat->ptr.iy;
      }
 
+   if (_touch_blocked_by_palm)
+     {
+        ELOGF("Touch", "Move (id: %d, x: %d, y: %d) is blocked during palm", NULL,
+              edev->mt_slot, edev->seat->ptr.ix, edev->seat->ptr.iy);
+        return;
+     }
+
    if (!(edev->touch.pressed & (1 << edev->mt_slot)))
      {
         if (edev->touch.blocked)
@@ -2158,6 +2174,23 @@ _device_handle_touch_up(struct libinput_device *device, struct libinput_event_to
 
    atomic_fetch_and(&edev->touch.raw_pressed, ~(1 << edev->mt_slot));
 
+   if (_touch_blocked_by_palm)
+     {
+        ELOGF("Touch", "Up (id: %d, x: %d, y: %d) is blocked during palm", NULL,
+              edev->mt_slot, edev->seat->ptr.ix, edev->seat->ptr.iy);
+
+        return;
+     }
+   else if (_touch_up_blocked_by_palm)
+     {
+        ELOGF("Touch", "Up (id: %d, x: %d, y: %d) is blocked lastly on palm up.", NULL,
+              edev->mt_slot, edev->seat->ptr.ix, edev->seat->ptr.iy);
+
+        _touch_up_blocked_by_palm = EINA_FALSE;
+
+        return;
+     }
+
    if (edev->touch.blocked)
      {
         if (!(edev->touch.pressed & (1 << edev->mt_slot)))
@@ -2300,6 +2333,19 @@ _device_handle_touch_aux_data(struct libinput_device *device, struct libinput_ev
    if (comp_conf && comp_conf->input_log_enable)
      ELOGF("Touch", "Axis (label: %d, value: %lf)", NULL, axis?axis->label:-1, axis?axis->value:0.0);
 
+   if (comp_conf && comp_conf->touch_block_on_palm == 1)
+     {
+        if (touch_value > 0)
+          {
+             _touch_blocked_by_palm = EINA_TRUE;
+             _touch_up_blocked_by_palm = EINA_TRUE;
+          }
+        else
+          {
+             _touch_blocked_by_palm = EINA_FALSE;
+          }
+     }
+
    ev->dev = ecore_device_ref(ecore_dev);
 
    ecore_event_add(ECORE_EVENT_AXIS_UPDATE, ev, _e_input_aux_data_event_free, NULL);
index 1ed61d7fb8183f948fbd74574d10bf18e17ed98c..94fe875cc28c83338dd37870312fbd27626b8a4e 100644 (file)
@@ -84,6 +84,7 @@ struct _E_Comp_Config
 
    int e_wheel_click_angle;
    int input_output_assign_policy;
+   int touch_block_on_palm;
 };
 
 struct _E_Comp_Match