Reschedule X OsTimer by returning next timeout value

The X OsTimer API allows a timer callback to immediately reschedule its
timer by returning a new (delta) timeout value.  This is slightly more
optimal than explicitly calling TimerSet() from within the TimerCallback.

When the GesturesTimer callback returns < 0 (i.e., -1.0), the OsTimer is
canceled by returning 0 from the OsTimer callback.  If the GesturesTimer
callback returns 0.0 or less than 0.001, this is rounded up to 1 ms.

We were not able to do this previously, since we were were relying on
explicit signal blocking in our timer callback.  Now that the X server
properly blocks signals when calling the callback, and while performing
global timer list operations in TimerSet(), we can make use of this more
efficient method.

BUG=chromium-os:34628
TEST=Verify tap-to-click still works for CMT

Change-Id: I6f943abc911a16a65b258e5a3f6e89dd13b808c7
Reviewed-on: https://gerrit.chromium.org/gerrit/33991
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
Commit-Ready: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Tested-by: Daniel Kurtz <djkurtz@chromium.org>
1 file changed