From a2e67a6412386782cb8b644b86a5744591397d45 Mon Sep 17 00:00:00 2001 From: Christopher James Halse Rogers Date: Mon, 6 Dec 2010 11:24:01 +1100 Subject: [PATCH] IDLETIME: Fix edge-case in IdleTimeBlockHandler Ensure that if we're called exactly on the threshold of a NegativeTransition trigger that we reshedule to pick up an idle time over the threshold. Signed-off-by: Christopher James Halse Rogers Reviewed-by: Adam Jackson Signed-off-by: Keith Packard --- Xext/sync.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Xext/sync.c b/Xext/sync.c index 7ea8a44fa..d495116dc 100644 --- a/Xext/sync.c +++ b/Xext/sync.c @@ -2793,6 +2793,14 @@ IdleTimeBlockHandler(pointer env, struct timeval **wt, pointer LastSelectMask) break; } } + /* + * We've been called exactly on the idle time, but we have a + * NegativeTransition trigger which requires a transition from an + * idle time greater than this. Schedule a wakeup for the next + * millisecond so we won't miss a transition. + */ + if (XSyncValueEqual (idle, *pIdleTimeValueLess)) + AdjustWaitForDelay(wt, 1); } else if (pIdleTimeValueGreater) {