mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2025-12-26 23:50:06 +01:00
tools/demo-server: check if we have a touch before sending one
If the client was disconnected, the returned touch is NULL. Check for that instead of blindly assuming we can send the touch.
This commit is contained in:
parent
2a178f416f
commit
3e39dabeac
1 changed files with 16 additions and 10 deletions
|
|
@ -741,21 +741,27 @@ int main(int argc, char **argv)
|
|||
|
||||
switch (counter++ % 5) {
|
||||
case 0:
|
||||
colorprint("sending touch down event\n");
|
||||
touch = eis_device_touch_new(touchscreen);
|
||||
eis_touch_down(touch, 100 + ++x, 200 - ++y);
|
||||
eis_device_frame(touchscreen, now);
|
||||
democlient->touch = touch;
|
||||
if (touch) { /* NULL if client was disconnected internally already */
|
||||
colorprint("sending touch down event\n");
|
||||
eis_touch_down(touch, 100 + ++x, 200 - ++y);
|
||||
eis_device_frame(touchscreen, now);
|
||||
democlient->touch = touch;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
colorprint("sending touch down event\n");
|
||||
eis_touch_up(touch);
|
||||
eis_device_frame(touchscreen, now);
|
||||
democlient->touch = eis_touch_unref(touch);
|
||||
if (touch) {
|
||||
colorprint("sending touch down event\n");
|
||||
eis_touch_up(touch);
|
||||
eis_device_frame(touchscreen, now);
|
||||
democlient->touch = eis_touch_unref(touch);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
eis_touch_motion(touch, 100 + ++x, 200 - ++y);
|
||||
eis_device_frame(touchscreen, now);
|
||||
if (touch) {
|
||||
eis_touch_motion(touch, 100 + ++x, 200 - ++y);
|
||||
eis_device_frame(touchscreen, now);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue