mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-08 14:00:17 +01:00
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 <peter.hutterer@who-t.net>
This commit is contained in:
parent
c457050d44
commit
0b221c6c97
2 changed files with 16 additions and 7 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue