Rewrites part of xi2event.c that were directly copied from xinput.
Still looks very similar as this is essentially the only way to do things.