Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:lafenghu
xorg-x11-server
sync-fix.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File sync-fix.patch of Package xorg-x11-server
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 static void IdleTimeQueryValue(pointer pCounter, CARD64 * pValue_return) { - 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; XSyncIntsToValue(pValue_return, idle, 0); + 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; + } + previousLastDeviceEventTimeMilliseconds = lastDeviceEventTime.milliseconds; + + /* + * 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 @@ -2700,7 +2734,7 @@ IdleTimeWakeupHandler(pointer env, int r if (!pIdleTimeValueLess && !pIdleTimeValueGreater) return; - IdleTimeQueryValue(NULL, &idle); + IdleTimeQueryValue(IdleTimeCounter, &idle); if ((pIdleTimeValueGreater && XSyncValueGreaterOrEqual(idle, *pIdleTimeValueGreater)) ||
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor