2012-04-20 11:32:05 +02:00
|
|
|
Index: xorg-server-1.12.1/Xext/sync.c
|
|
|
|
===================================================================
|
|
|
|
--- xorg-server-1.12.1.orig/Xext/sync.c
|
|
|
|
+++ xorg-server-1.12.1/Xext/sync.c
|
|
|
|
@@ -2615,9 +2615,43 @@ static XSyncValue *pIdleTimeValueGreater
|
2010-12-20 00:33:09 +01:00
|
|
|
static void
|
2012-04-20 11:32:05 +02:00
|
|
|
IdleTimeQueryValue(pointer pCounter, CARD64 * pValue_return)
|
2010-12-20 00:33:09 +01:00
|
|
|
{
|
|
|
|
- CARD32 idle = GetTimeInMillis() - lastDeviceEventTime.milliseconds;
|
|
|
|
+ static CARD32 previousLastDeviceEventTimeMilliseconds = 0;
|
|
|
|
+ CARD32 now = GetTimeInMillis();
|
|
|
|
+ CARD32 idle = now - lastDeviceEventTime.milliseconds;
|
|
|
|
+ CARD32 previousIdle = now - previousLastDeviceEventTimeMilliseconds;
|
|
|
|
+ SyncCounter *pIdleTimeCounter = (SyncCounter*)pCounter;
|
2012-04-20 11:32:05 +02:00
|
|
|
|
|
|
|
XSyncIntsToValue(pValue_return, idle, 0);
|
2010-12-20 00:33:09 +01:00
|
|
|
+ if (pCounter == NULL)
|
|
|
|
+ {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (previousLastDeviceEventTimeMilliseconds == 0)
|
|
|
|
+ {
|
|
|
|
+ /* initialize static var when this function is invoked the first time. */
|
|
|
|
+ previousLastDeviceEventTimeMilliseconds = lastDeviceEventTime.milliseconds;
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (previousLastDeviceEventTimeMilliseconds == lastDeviceEventTime.milliseconds)
|
|
|
|
+ {
|
|
|
|
+ /* no new user event, no need to change idle counter. */
|
|
|
|
+ return;
|
|
|
|
+ }
|
2012-04-20 11:32:05 +02:00
|
|
|
+ previousLastDeviceEventTimeMilliseconds = lastDeviceEventTime.milliseconds;
|
2010-12-20 00:33:09 +01:00
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * Some user event occured; now update idle counter with previous
|
|
|
|
+ * event time, so idle counter has the most up-to-date value with
|
|
|
|
+ * respect to previous user event (we need old and new counter
|
|
|
|
+ * value to compute if a transition occured). Recompute bracket
|
|
|
|
+ * values if this is system counter.
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ XSyncIntsToValue (&pIdleTimeCounter->value, previousIdle, 0);
|
|
|
|
+ if (IsSystemCounter(pIdleTimeCounter)) {
|
|
|
|
+ SyncComputeBracketValues(pIdleTimeCounter);
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-04-20 11:32:05 +02:00
|
|
|
@@ -2700,7 +2734,7 @@ IdleTimeWakeupHandler(pointer env, int r
|
2010-12-20 00:33:09 +01:00
|
|
|
if (!pIdleTimeValueLess && !pIdleTimeValueGreater)
|
2012-04-20 11:32:05 +02:00
|
|
|
return;
|
2010-12-20 00:33:09 +01:00
|
|
|
|
2012-04-20 11:32:05 +02:00
|
|
|
- IdleTimeQueryValue(NULL, &idle);
|
|
|
|
+ IdleTimeQueryValue(IdleTimeCounter, &idle);
|
2010-12-20 00:33:09 +01:00
|
|
|
|
|
|
|
if ((pIdleTimeValueGreater &&
|
2012-04-20 11:32:05 +02:00
|
|
|
XSyncValueGreaterOrEqual(idle, *pIdleTimeValueGreater)) ||
|