e_input: add a config 'touch_block_on_palm' and apply it on palm 28/313728/2 accepted/tizen/8.0/unified/20240705.163555
authorduna.oh <duna.oh@samsung.com>
Fri, 28 Jun 2024 06:52:51 +0000 (15:52 +0900)
committerDuna Oh <duna.oh@samsung.com>
Fri, 5 Jul 2024 06:04:00 +0000 (06:04 +0000)
Change-Id: I9c36de81e91ebf30151a2baf7b5f7efba7c0201a

src/bin/e_comp_cfdata.c
src/bin/e_comp_cfdata.h
src/bin/e_input_evdev.c

index cf60b49da09bb1d5804505513780ed542cb2e8f1..ccc5846a4bd68d6fe77dfa61005c4d1c4ca87f92 100644 (file)
@@ -95,6 +95,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 *
@@ -267,6 +268,8 @@ e_comp_cfdata_config_new(void)
 
    cfg->input_output_assign_policy = 0;
 
+   cfg->touch_block_on_palm = 0;
+
    return cfg;
 
 error:
index 978b42413d2cff0f32d0f16a7606e31ac8822c0e..490782dd3579afde875aa1dcdf78765c4e604e53 100644 (file)
@@ -83,6 +83,7 @@ struct _E_Comp_Config
 
    int e_wheel_click_angle;
    int input_output_assign_policy;
+   int touch_block_on_palm;
 };
 
 struct _E_Comp_Match
index 4c80639881a95b6247729b4a85e6f18d14fa8f1e..8e9056e22bee10b5a8ad6cf9e3ef24f5d1cea3ba 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
 _device_calibration_set(E_Input_Evdev *edev)
 {
@@ -2095,6 +2097,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);
@@ -2158,6 +2167,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)
@@ -2211,6 +2227,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)))
@@ -2303,6 +2336,7 @@ _device_handle_touch_aux_data(struct libinput_device *device, struct libinput_ev
    Ecore_Device *ecore_dev = NULL, *data;
    Eina_List *l;
    E_Comp_Config *comp_conf;
+   int touch_value;
 
    ecore_thread_main_loop_begin();
 
@@ -2313,6 +2347,8 @@ _device_handle_touch_aux_data(struct libinput_device *device, struct libinput_ev
    if (!(edev = libinput_device_get_user_data(device))) goto end;
    if (!(input = edev->seat->input)) goto end;
 
+   touch_value = libinput_event_touch_aux_data_get_value(event);
+
    if (edev->ecore_dev) ecore_dev = edev->ecore_dev;
    else if (edev->ecore_dev_list && eina_list_count(edev->ecore_dev_list) > 0)
      {
@@ -2348,7 +2384,7 @@ _device_handle_touch_aux_data(struct libinput_device *device, struct libinput_ev
    if (axis)
      {
         axis->label = ECORE_AXIS_LABEL_TOUCH_PALM;
-        axis->value = libinput_event_touch_aux_data_get_value(event);
+        axis->value = touch_value;
         ev->naxis = 1;
      }
    ev->axis = axis;
@@ -2357,6 +2393,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);