mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2026-01-21 16:30:22 +01:00
eis: don't send stop_emulating for a sender device
The check is currently missing from a number of libeis APIs but in most cases we can blame the EIS implementation and say "don't do this". Device removal is an exception since that is still required.
This commit is contained in:
parent
b6a901e690
commit
0541668443
2 changed files with 35 additions and 1 deletions
|
|
@ -283,7 +283,8 @@ eis_device_remove(struct eis_device *device)
|
|||
if (device->state == EIS_DEVICE_STATE_DEAD)
|
||||
return;
|
||||
|
||||
if (device->state == EIS_DEVICE_STATE_EMULATING)
|
||||
if (device->state == EIS_DEVICE_STATE_EMULATING &&
|
||||
!eis_client_is_sender(eis_device_get_client(device)))
|
||||
eis_device_stop_emulating(device);
|
||||
|
||||
device->state = EIS_DEVICE_STATE_DEAD;
|
||||
|
|
|
|||
|
|
@ -1322,6 +1322,39 @@ MUNIT_TEST(test_ei_flush_frame)
|
|||
return MUNIT_OK;
|
||||
}
|
||||
|
||||
MUNIT_TEST(test_ei_device_remove_no_stop_emulating_event)
|
||||
{
|
||||
_unref_(peck) *peck = peck_new();
|
||||
|
||||
peck_enable_eis_behavior(peck, PECK_EIS_BEHAVIOR_ACCEPT_ALL);
|
||||
peck_enable_eis_behavior(peck, PECK_EIS_BEHAVIOR_ADD_KEYBOARD);
|
||||
peck_enable_ei_behavior(peck, PECK_EI_BEHAVIOR_AUTODEVICES);
|
||||
peck_dispatch_until_stable(peck);
|
||||
|
||||
with_client(peck) {
|
||||
struct ei_device *device = peck_ei_get_default_keyboard(peck);
|
||||
ei_device_keyboard_key(device, KEY_Q, true);
|
||||
ei_device_frame(device, peck_ei_now(peck));
|
||||
ei_device_keyboard_key(device, KEY_Q, false);
|
||||
ei_device_frame(device, peck_ei_now(peck));
|
||||
}
|
||||
peck_dispatch_until_stable(peck);
|
||||
|
||||
with_server(peck) {
|
||||
struct eis_device *device = peck_eis_get_default_keyboard(peck);
|
||||
eis_device_remove(device);
|
||||
}
|
||||
peck_dispatch_until_stable(peck);
|
||||
|
||||
with_client(peck) {
|
||||
_unref_(ei_event) *removed =
|
||||
peck_ei_next_event(ei, EI_EVENT_DEVICE_REMOVED);
|
||||
peck_assert_no_ei_events(ei);
|
||||
}
|
||||
|
||||
return MUNIT_OK;
|
||||
}
|
||||
|
||||
MUNIT_TEST(test_passive_ei_device_start_stop_emulating)
|
||||
{
|
||||
_unref_(peck) *peck = peck_new_context(PECK_EI_RECEIVER);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue