psm(4): do not process gestures when palm is present

Ignoring of gesture processing when the palm is detected helps to reduce
some of the erratic pointer behavior.

This fixes regression introduced in r317814

Reported by:	Ben LeMasurier <ben@crypt.ly>
MFC after:	2 weeks
This commit is contained in:
Vladimir Kondratyev 2019-04-20 21:02:41 +00:00
parent 232e4318b0
commit 51319286ed
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=346456

View File

@ -3214,7 +3214,7 @@ proc_synaptics(struct psm_softc *sc, packetbuf_t *pb, mousestatus_t *ms,
static int guest_buttons;
static int ew_finger_count;
static finger_t f[PSM_FINGERS];
int w, id, nfingers, ewcode, extended_buttons, clickpad_pressed;
int w, id, nfingers, palm, ewcode, extended_buttons, clickpad_pressed;
extended_buttons = 0;
@ -3577,12 +3577,16 @@ proc_synaptics(struct psm_softc *sc, packetbuf_t *pb, mousestatus_t *ms,
ms->button = touchpad_buttons;
psmgestures(sc, &f[0], nfingers, ms);
palm = psmpalmdetect(sc, &f[0], nfingers);
/* Palm detection doesn't terminate the current action. */
if (!palm)
psmgestures(sc, &f[0], nfingers, ms);
for (id = 0; id < PSM_FINGERS; id++)
psmsmoother(sc, &f[id], id, ms, x, y);
/* Palm detection doesn't terminate the current action. */
if (psmpalmdetect(sc, &f[0], nfingers)) {
if (palm) {
*x = *y = *z = 0;
ms->button = ms->obutton;
return (0);
@ -4324,7 +4328,7 @@ proc_elantech(struct psm_softc *sc, packetbuf_t *pb, mousestatus_t *ms,
{
static int touchpad_button, trackpoint_button;
finger_t fn, f[ELANTECH_MAX_FINGERS];
int pkt, id, scale, i, nfingers, mask;
int pkt, id, scale, i, nfingers, mask, palm;
if (!elantech_support)
return (0);
@ -4713,10 +4717,14 @@ proc_elantech(struct psm_softc *sc, packetbuf_t *pb, mousestatus_t *ms,
ms->button = touchpad_button | trackpoint_button;
/* Palm detection doesn't terminate the current action. */
palm = psmpalmdetect(sc, &f[0], nfingers);
/* Send finger 1 position to gesture processor */
if (PSM_FINGER_IS_SET(f[0]) || PSM_FINGER_IS_SET(f[1]) ||
nfingers == 0)
if ((PSM_FINGER_IS_SET(f[0]) || PSM_FINGER_IS_SET(f[1]) ||
nfingers == 0) && !palm)
psmgestures(sc, &f[0], imin(nfingers, 3), ms);
/* Send fingers positions to movement smoothers */
for (id = 0; id < PSM_FINGERS; id++)
if (PSM_FINGER_IS_SET(f[id]) || !(mask & (1 << id)))
@ -4731,8 +4739,7 @@ proc_elantech(struct psm_softc *sc, packetbuf_t *pb, mousestatus_t *ms,
}
sc->elanaction.mask = mask;
/* Palm detection doesn't terminate the current action. */
if (psmpalmdetect(sc, &f[0], nfingers)) {
if (palm) {
*x = *y = *z = 0;
ms->button = ms->obutton;
return (0);