summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-02-08 11:46:46 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-02-17 10:57:06 +1000
commitf34ee8e8ac68c3fdff38d084f175106a3415f3a5 (patch)
tree9762164fe3b6353c023ec1d04cf618e0ea361b19
parent311e54594a7dbacf241c046626139a260716ba31 (diff)
syndaemon: reset idle time if the system time has changed (#31968)
If the system time is changed backwards while the touchpad is disabled through syndaemon it remains disabled until the time catches up with the previous idle time again. Avoid this by resetting last_activity with a time that will trigger re-enabling of the device. X.Org Bug 31968 <http://bugs.freedesktop.org/show_bug.cgi?id=31968> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--tools/syndaemon.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/syndaemon.c b/tools/syndaemon.c
index 944c34e..9779935 100644
--- a/tools/syndaemon.c
+++ b/tools/syndaemon.c
@@ -227,6 +227,11 @@ main_loop(Display *display, double idle_time, int poll_delay)
if (keyboard_activity(display))
last_activity = current_time;
+ /* If system times goes backwards, touchpad can get locked. Make
+ * sure our last activity wasn't in the future and reset if it was. */
+ if (last_activity > current_time)
+ last_activity = current_time - idle_time - 1;
+
if (current_time > last_activity + idle_time) { /* Enable touchpad */
toggle_touchpad(True);
} else { /* Disable touchpad */