summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/evdev.c1
-rw-r--r--test/test-pointer.c26
2 files changed, 27 insertions, 0 deletions
diff --git a/src/evdev.c b/src/evdev.c
index 687774c4..928937bc 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -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);
diff --git a/test/test-pointer.c b/test/test-pointer.c
index 7af2261a..b72cff5c 100644
--- a/test/test-pointer.c
+++ b/test/test-pointer.c
@@ -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);