Skip to content

Commit

Permalink
touchpad: set keyboard to non-active when the keyboard is removed
Browse files Browse the repository at this point in the history
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=101743

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 9e5d1df)
  • Loading branch information
whot committed Jul 13, 2017
1 parent 429fc47 commit c75e052
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/evdev-mt-touchpad.c
Original file line number Diff line number Diff line change
Expand Up @@ -1740,6 +1740,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) {
Expand Down
42 changes: 42 additions & 0 deletions test/test-touchpad.c
Original file line number Diff line number Diff line change
Expand Up @@ -3819,6 +3819,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();
Expand Down Expand Up @@ -5071,6 +5112,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);

Expand Down

0 comments on commit c75e052

Please sign in to comment.