Commit 0b221c6c authored by Peter Hutterer's avatar Peter Hutterer

tablet: handle a valid prox-out sequence after a forced proximity out

With the previous patches a tablet would ignore a valid proximity out sequence
where it happends after a forced prox-out. Fix this by checking the state when
we're in forced proximity out - if we have a zero tool state but a tool
updated then we did get a proximity out.

And fix the existing test to check for that case.
Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent c457050d
......@@ -1766,6 +1766,16 @@ tablet_update_tool_state(struct tablet_dispatch *tablet,
int state;
uint32_t doubled_up_new_tool_bit = 0;
/* we were already out of proximity but now got a tool update but
* our tool state is zero - i.e. we got a valid prox out from the
* device.
*/
if (tablet->quirks.proximity_out_forced &&
tablet_has_status(tablet, TABLET_TOOL_UPDATED) &&
!tablet->tool_state) {
tablet->quirks.need_to_force_prox_out = false;
tablet->quirks.proximity_out_forced = false;
}
/* We need to emulate a BTN_TOOL_PEN if we get an axis event (i.e.
* stylus is def. in proximity) and:
* - we forced a proximity out before, or
......
......@@ -5813,17 +5813,10 @@ START_TEST(huion_static_btn_tool_pen_disable_quirk_on_prox_out)
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT);
}
litest_push_event_frame(dev);
litest_tablet_proximity_out(dev);
litest_event(dev, EV_KEY, BTN_TOOL_PEN, 0);
litest_event(dev, EV_SYN, SYN_REPORT, 0);
litest_pop_event_frame(dev);
litest_tablet_proximity_in(dev, 50, 50, NULL);
libinput_dispatch(li);
litest_assert_tablet_proximity_event(li,
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN);
libinput_dispatch(li);
for (i = 0; i < 10; i++) {
litest_tablet_motion(dev, 50 + i, 50 + i, NULL);
......@@ -5833,6 +5826,12 @@ START_TEST(huion_static_btn_tool_pen_disable_quirk_on_prox_out)
litest_assert_only_typed_events(li,
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
libinput_dispatch(li);
litest_timeout_tablet_proxout();
libinput_dispatch(li);
litest_assert_empty_queue(li);
litest_push_event_frame(dev);
litest_tablet_proximity_out(dev);
litest_event(dev, EV_KEY, BTN_TOOL_PEN, 0);
......
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