Commit da74aab7 authored by Peter Hutterer's avatar Peter Hutterer

touchpad: change the stylus palm arbitration to process touches

Previously, on touch toggle (invoked by the tablet when a pen goes in
proximity) the touchpad cleared the state and ignored any events. Since we
ignore touches that we didn't see the touch begin for, this handled the cases
of a touch remaining after proximity out.

This code pre-dates palm detection, so let's take the bluetack off and instead
integrate it with proper palm detectino.
parent 402b179b
......@@ -907,6 +907,19 @@ tp_palm_detect_pressure_triggered(struct tp_dispatch *tp,
return t->palm.state == PALM_PRESSURE;
}
static bool
tp_palm_detect_arbitration_triggered(struct tp_dispatch *tp,
struct tp_touch *t,
uint64_t time)
{
if (!tp->in_arbitration)
return false;
t->palm.state = PALM_ARBITRATION;
return true;
}
static void
tp_palm_detect(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
{
......@@ -916,6 +929,9 @@ tp_palm_detect(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
if (tp_palm_detect_pressure_triggered(tp, t, time))
goto out;
if (tp_palm_detect_arbitration_triggered(tp, t, time))
goto out;
if (tp_palm_detect_dwt_triggered(tp, t, time))
goto out;
......@@ -965,6 +981,9 @@ out:
case PALM_TOUCH_SIZE:
palm_state = "touch size";
break;
case PALM_ARBITRATION:
palm_state = "arbitration";
break;
case PALM_NONE:
default:
abort();
......@@ -1600,9 +1619,6 @@ tp_interface_process(struct evdev_dispatch *dispatch,
{
struct tp_dispatch *tp = tp_dispatch(dispatch);
if (tp->ignore_events)
return;
switch (e->type) {
case EV_ABS:
if (tp->has_mt)
......@@ -2291,15 +2307,15 @@ tp_interface_toggle_touch(struct evdev_dispatch *dispatch,
bool enable)
{
struct tp_dispatch *tp = tp_dispatch(dispatch);
bool ignore_events = !enable;
bool arbitrate = !enable;
if (ignore_events == tp->ignore_events)
if (arbitrate == tp->in_arbitration)
return;
if (ignore_events)
if (arbitrate)
tp_clear_state(tp);
tp->ignore_events = ignore_events;
tp->in_arbitration = arbitrate;
}
static struct evdev_dispatch_interface tp_interface = {
......
......@@ -60,6 +60,7 @@ enum touch_palm_state {
PALM_TOOL_PALM,
PALM_PRESSURE,
PALM_TOUCH_SIZE,
PALM_ARBITRATION,
};
enum button_event {
......@@ -239,9 +240,7 @@ struct tp_dispatch {
bool has_mt;
bool semi_mt;
/* true if we're reading events (i.e. not suspended) but we're
* ignoring them */
bool ignore_events;
bool in_arbitration; /* pen/touch arbitration */
unsigned int num_slots; /* number of slots */
unsigned int ntouches; /* no slots inc. fakes */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment