mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-05-01 19:07:58 +02:00
evdev: cancel the middle button timer on device removed
If a middle-button-emulating device is removed with one button down, the timer never gets cancelled and triggers an assert during device removal. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
afbb90daeb
commit
34b49d5118
2 changed files with 27 additions and 0 deletions
|
|
@ -2641,6 +2641,7 @@ evdev_device_remove(struct evdev_device *device)
|
|||
evdev_log_info(device, "device removed\n");
|
||||
|
||||
libinput_timer_cancel(&device->scroll.timer);
|
||||
libinput_timer_cancel(&device->middlebutton.timer);
|
||||
|
||||
list_for_each(dev, &device->base.seat->devices_list, link) {
|
||||
struct evdev_device *d = evdev_device(dev);
|
||||
|
|
|
|||
|
|
@ -2138,6 +2138,31 @@ START_TEST(middlebutton_device_remove_while_down)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(middlebutton_device_remove_while_one_is_down)
|
||||
{
|
||||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput_device *device = dev->libinput_device;
|
||||
struct libinput *li = dev->libinput;
|
||||
enum libinput_config_status status;
|
||||
|
||||
libinput_device_config_scroll_set_method(device,
|
||||
LIBINPUT_CONFIG_SCROLL_NO_SCROLL);
|
||||
status = libinput_device_config_middle_emulation_set_enabled(
|
||||
device,
|
||||
LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED);
|
||||
if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED)
|
||||
return;
|
||||
|
||||
litest_drain_events(li);
|
||||
|
||||
litest_event(dev, EV_KEY, BTN_RIGHT, 1);
|
||||
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
||||
libinput_dispatch(li);
|
||||
|
||||
litest_assert_empty_queue(li);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(pointer_time_usec)
|
||||
{
|
||||
struct litest_device *dev = litest_current_device();
|
||||
|
|
@ -2705,6 +2730,7 @@ TEST_COLLECTION(pointer)
|
|||
litest_add("pointer:middlebutton", middlebutton_button_scrolling, LITEST_RELATIVE|LITEST_BUTTON, LITEST_CLICKPAD);
|
||||
litest_add("pointer:middlebutton", middlebutton_button_scrolling_middle, LITEST_RELATIVE|LITEST_BUTTON, LITEST_CLICKPAD);
|
||||
litest_add("pointer:middlebutton", middlebutton_device_remove_while_down, LITEST_BUTTON, LITEST_CLICKPAD);
|
||||
litest_add("pointer:middlebutton", middlebutton_device_remove_while_one_is_down, LITEST_BUTTON, LITEST_CLICKPAD);
|
||||
|
||||
litest_add_ranged("pointer:state", pointer_absolute_initial_state, LITEST_ABSOLUTE, LITEST_ANY, &axis_range);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue