mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2026-05-05 00:48:02 +02:00
tools: fix a few issues in the demo server
A few copy/paste errors and a use-after-free because our demo-client was never removed from the server list on disconnect.
This commit is contained in:
parent
21985060b9
commit
eea1a24285
1 changed files with 4 additions and 3 deletions
|
|
@ -73,6 +73,7 @@ OBJECT_IMPLEMENT_UNREF_CLEANUP(eis_demo_client);
|
|||
static void
|
||||
eis_demo_client_destroy(struct eis_demo_client *democlient)
|
||||
{
|
||||
list_remove(&democlient->link);
|
||||
eis_client_unref(democlient->client);
|
||||
eis_device_unref(democlient->ptr);
|
||||
eis_device_unref(democlient->abs);
|
||||
|
|
@ -337,9 +338,9 @@ eis_demo_server_printf_handle_event(struct eis_demo_server *server,
|
|||
}
|
||||
}
|
||||
|
||||
if (eis_event_seat_has_capability(e, EIS_DEVICE_CAP_POINTER)) {
|
||||
if (eis_event_seat_has_capability(e, EIS_DEVICE_CAP_KEYBOARD)) {
|
||||
if (!democlient->kbd)
|
||||
democlient->kbd = add_device(server, client, seat, EIS_DEVICE_CAP_POINTER);
|
||||
democlient->kbd = add_device(server, client, seat, EIS_DEVICE_CAP_KEYBOARD);
|
||||
} else {
|
||||
if (democlient->kbd) {
|
||||
eis_device_remove(democlient->kbd);
|
||||
|
|
@ -607,7 +608,7 @@ int main(int argc, char **argv)
|
|||
key = (key + 1) % 6;
|
||||
}
|
||||
|
||||
if (ptr) {
|
||||
if (abs) {
|
||||
static int x, y;
|
||||
colorprint("sending abs event\n");
|
||||
eis_device_pointer_motion_absolute(abs, 150 + ++x, 150 - ++y);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue