diff --git a/os/inputthread.c b/os/inputthread.c index 6aa0a9ce6..ddafa7fe8 100644 --- a/os/inputthread.c +++ b/os/inputthread.c @@ -197,7 +197,7 @@ InputThreadRegisterDev(int fd, dev = NULL; xorg_list_for_each_entry(old, &inputThreadInfo->devs, node) { - if (old->fd == fd) { + if (old->fd == fd && old->state != device_state_removed) { dev = old; break; } @@ -218,6 +218,9 @@ InputThreadRegisterDev(int fd, dev->readInputProc = readInputProc; dev->readInputArgs = readInputArgs; dev->state = device_state_added; + + /* Do not prepend, so that any dev->state == device_state_removed + * with the same dev->fd get processed first. */ xorg_list_append(&dev->node, &inputThreadInfo->devs); }