Use XInput for tracking global cursor position on X.

The details are ugly, but it works better than the previous approach,
and is arguably a lot simpler (though see the comment in xi2_init()).