Commit 9e5d1df4 authored by Peter Hutterer's avatar Peter Hutterer

touchpad: set keyboard to non-active when the keyboard is removed

If the keyboard is removed while dwt thinks it is in active state, that state
is never reset and subsequent touches are ignored.

https://bugs.freedesktop.org/show_bug.cgi?id=101743Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent 756c7e3d
......@@ -1855,6 +1855,7 @@ tp_interface_device_removed(struct evdev_device *device,
libinput_device_remove_event_listener(
&tp->dwt.keyboard_listener);
tp->dwt.keyboard = NULL;
tp->dwt.keyboard_active = false;
}
if (removed_device == tp->lid_switch.lid_switch) {
......
......@@ -4127,6 +4127,47 @@ START_TEST(touchpad_dwt_enable_during_tap)
}
END_TEST
START_TEST(touchpad_dwt_remove_kbd_while_active)
{
struct litest_device *touchpad = litest_current_device();
struct litest_device *keyboard;
struct libinput *li = touchpad->libinput;
if (!has_disable_while_typing(touchpad))
return;
litest_enable_tap(touchpad->libinput_device);
enable_dwt(touchpad);
keyboard = dwt_init_paired_keyboard(li, touchpad);
litest_drain_events(li);
litest_keyboard_key(keyboard, KEY_A, true);
litest_keyboard_key(keyboard, KEY_A, false);
libinput_dispatch(li);
litest_touch_down(touchpad, 0, 50, 50);
libinput_dispatch(li);
litest_keyboard_key(keyboard, KEY_A, true);
litest_keyboard_key(keyboard, KEY_A, false);
litest_drain_events(li);
litest_delete_device(keyboard);
litest_drain_events(li);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_up(touchpad, 0);
litest_assert_empty_queue(li);
litest_touch_down(touchpad, 0, 50, 50);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_up(touchpad, 0);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
}
END_TEST
START_TEST(touchpad_dwt_apple)
{
struct litest_device *touchpad = litest_current_device();
......@@ -5359,6 +5400,7 @@ litest_setup_tests_touchpad(void)
litest_add("touchpad:dwt", touchpad_dwt_enable_during_touch, LITEST_TOUCHPAD, LITEST_ANY);
litest_add("touchpad:dwt", touchpad_dwt_enable_before_touch, LITEST_TOUCHPAD, LITEST_ANY);
litest_add("touchpad:dwt", touchpad_dwt_enable_during_tap, LITEST_TOUCHPAD, LITEST_ANY);
litest_add("touchpad:dwt", touchpad_dwt_remove_kbd_while_active, LITEST_TOUCHPAD, LITEST_ANY);
litest_add_for_device("touchpad:dwt", touchpad_dwt_apple, LITEST_BCM5974);
litest_add_for_device("touchpad:dwt", touchpad_dwt_acer_hawaii, LITEST_ACER_HAWAII_TOUCHPAD);
......
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