ets_fps: filter unexpected double-click event

Some of the user's sliding may be mistaken for double-clicking event.
filtering out the min double-click interval tim to reducing the
probability of unexpected double-click.

Change-Id: I0b1a43d3ed7aac601865127076f5b2c51f6eb3d4
Signed-off-by: wuwl10 <wuwl10@motorola.com>
Reviewed-on: https://gerrit.mot.com/1735804
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
(cherry picked from commit 60cdf2a116c3e7cc321eab8038065efc98e3a3fc)
Reviewed-on: https://gerrit.mot.com/1737936
This commit is contained in:
wuwl10 2020-08-28 13:50:19 +08:00 • committed by Chuang He
commit 3b8344ecee

View file

@ -213,7 +213,7 @@ static unsigned int prev_keycode;
#define SINGLECLICK_INTERVAL 150
#define SINGLECLICK_INTERVAL_MIN 5
#define DOUBLECLICK_INTERVAL 300
#define DOUBLECLICK_INTERVAL_MIN 70
#define KEYEVENT_CLICK KEY_FPS_TAP /* 0x232 */
#define KEYEVENT_CLICK_ACTION KEY_PRESS_RELEASE
@ -438,7 +438,8 @@ void translated_command_converter(char cmd, struct etspi_data *etspi)
#endif
#if ENABLE_TRANSLATED_DOUBLE_CLICK
if (g_SingleClick >= 2) {
if ((g_SingleClickJiffies - g_DoubleClickJiffies) < (HZ * DOUBLECLICK_INTERVAL / 1000)) {
if (((g_SingleClickJiffies - g_DoubleClickJiffies) < (HZ * DOUBLECLICK_INTERVAL / 1000))
&& ((g_SingleClickJiffies - g_DoubleClickJiffies) >= (HZ * DOUBLECLICK_INTERVAL_MIN / 1000))) {
/* Double click event */
send_key_event(etspi, KEYEVENT_DOUBLECLICK, KEYEVENT_DOUBLECLICK_ACTION);
g_SingleClick = 0;