From: duna.oh Date: Fri, 28 Jun 2024 06:52:51 +0000 (+0900) Subject: e_input: add a config 'touch_block_on_palm' and apply it on palm X-Git-Tag: accepted/tizen/8.0/unified/20240705.163555^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F28%2F313728%2F2;p=platform%2Fupstream%2Fenlightenment.git e_input: add a config 'touch_block_on_palm' and apply it on palm Change-Id: I9c36de81e91ebf30151a2baf7b5f7efba7c0201a --- diff --git a/src/bin/e_comp_cfdata.c b/src/bin/e_comp_cfdata.c index cf60b49da0..ccc5846a4b 100644 --- a/src/bin/e_comp_cfdata.c +++ b/src/bin/e_comp_cfdata.c @@ -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: diff --git a/src/bin/e_comp_cfdata.h b/src/bin/e_comp_cfdata.h index 978b42413d..490782dd35 100644 --- a/src/bin/e_comp_cfdata.h +++ b/src/bin/e_comp_cfdata.h @@ -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 diff --git a/src/bin/e_input_evdev.c b/src/bin/e_input_evdev.c index 4c80639881..8e9056e22b 100644 --- a/src/bin/e_input_evdev.c +++ b/src/bin/e_input_evdev.c @@ -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);