Remember the next timeout requested

This moves the timeout handling into the touchpad core so we can remember what
the next timeout is that we need to handle. This way we can skip timeout
handling at the core as well if we're not past the requested timeout yet.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Handle timeouts before events

Before handling an event, check if there's any timeouts pending that have a
time before this event. If the caller is delayed reading events, the events
may have a timestamp before the timeout requested and need to be handled
accordingly. This only needs to be done on EV_SYN, as all other events will
have the same timestamp.

We use the event time as "now" and see if any timeouts trigger. If so, they
get handled first, otherwise we parse the events. And if we don't have event
data left, we make sure to handle any timeouts too.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>