mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-20 08:00:08 +01:00
fallback: when force-releasing keys, release them directly
An emulated button is recorded as BTN_MIDDLE in the key down mask. If the device is removed in that state, the BTN_MIDDLE event processed triggers an assertion when we try to send out the event twice. Fixes #201 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
507441537e
commit
c75c00dac3
2 changed files with 33 additions and 1 deletions
|
|
@ -1095,7 +1095,7 @@ release_pressed_keys(struct fallback_dispatch *dispatch,
|
|||
LIBINPUT_KEY_STATE_RELEASED);
|
||||
break;
|
||||
case KEY_TYPE_BUTTON:
|
||||
evdev_pointer_notify_physical_button(
|
||||
evdev_pointer_notify_button(
|
||||
device,
|
||||
time,
|
||||
evdev_to_left_handed(device, code),
|
||||
|
|
|
|||
|
|
@ -2107,6 +2107,37 @@ START_TEST(middlebutton_button_scrolling_middle)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(middlebutton_device_remove_while_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_LEFT, 1);
|
||||
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
||||
litest_event(dev, EV_KEY, BTN_RIGHT, 1);
|
||||
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
||||
libinput_dispatch(li);
|
||||
|
||||
litest_assert_button_event(li,
|
||||
BTN_MIDDLE,
|
||||
LIBINPUT_BUTTON_STATE_PRESSED);
|
||||
|
||||
litest_assert_empty_queue(li);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(pointer_time_usec)
|
||||
{
|
||||
struct litest_device *dev = litest_current_device();
|
||||
|
|
@ -2673,6 +2704,7 @@ TEST_COLLECTION(pointer)
|
|||
litest_add_for_device("pointer:middlebutton", middlebutton_default_alps, LITEST_ALPS_SEMI_MT);
|
||||
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_ranged("pointer:state", pointer_absolute_initial_state, LITEST_ABSOLUTE, LITEST_ANY, &axis_range);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue