inputevt: use xrealloc() instead of g_realloc().
inputevt: made usage of the poll context thread-safe.

This will hopefully close a race condition when GTK is polling from another
thread.