Enforce a frame after ei_touch_destroy()

Destroying a touch causes ei_touch_up if the touch is still down. But
for the event sequence to be correct we also need to add a frame event
here, otherwise the touch up may be "pending" on the remote until the
next actual event happens and a frame is added.

A client that doesn't want this should just call ei_touch_up()
This commit is contained in:
Peter Hutterer 2022-04-29 10:59:40 +10:00
parent cede41d190
commit 35aca1a387
3 changed files with 6 additions and 2 deletions

View file

@ -574,6 +574,9 @@ ei_touch_destroy(struct ei_touch *touch)
{
if (touch->state == TOUCH_IS_DOWN)
ei_touch_up(touch);
/* Enforce a frame, otherwise we're just pending. If the client
* doesn't want this, it needs to ei_touch_up() */
ei_device_frame(touch->device);
ei_device_unref(touch->device);
}

View file

@ -531,6 +531,9 @@ eis_touch_destroy(struct eis_touch *touch)
{
if (touch->state == TOUCH_IS_DOWN)
eis_touch_up(touch);
/* Enforce a frame, otherwise we're just pending. If the client
* doesn't want this, it needs to eis_touch_up() */
eis_device_frame(touch->device);
eis_device_unref(touch->device);
}

View file

@ -869,7 +869,6 @@ MUNIT_TEST(test_ei_device_touch)
ei_touch_down(t, 100, 100);
ei_device_frame(device);
/* client forgets to touch up, touch_unref takes care of it */
/* FIXME: this doesn't work with frames */
}
peck_dispatch_until_stable(peck);
@ -1791,7 +1790,6 @@ MUNIT_TEST(test_passive_ei_device_touch)
eis_touch_down(t, 100, 100);
eis_device_frame(device);
/* client forgets to touch up, touch_unref takes care of it */
/* FIXME: this doesn't work with frames */
}
peck_dispatch_until_stable(peck);