Merge branch 'per-device-sync-counters' into for-keith
This commit is contained in:
		
						commit
						a7eac500e6
					
				| 
						 | 
					@ -46,6 +46,7 @@ in this Software without prior written authorization from the X Consortium.
 | 
				
			||||||
#include "cursorstr.h"
 | 
					#include "cursorstr.h"
 | 
				
			||||||
#include "colormapst.h"
 | 
					#include "colormapst.h"
 | 
				
			||||||
#include "xace.h"
 | 
					#include "xace.h"
 | 
				
			||||||
 | 
					#include "inputstr.h"
 | 
				
			||||||
#ifdef PANORAMIX
 | 
					#ifdef PANORAMIX
 | 
				
			||||||
#include "panoramiX.h"
 | 
					#include "panoramiX.h"
 | 
				
			||||||
#include "panoramiXsrv.h"
 | 
					#include "panoramiXsrv.h"
 | 
				
			||||||
| 
						 | 
					@ -388,8 +389,10 @@ ScreenSaverFreeSuspend(pointer value, XID id)
 | 
				
			||||||
        if (screenIsSaved != SCREEN_SAVER_ON)
 | 
					        if (screenIsSaved != SCREEN_SAVER_ON)
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
					            DeviceIntPtr dev;
 | 
				
			||||||
            UpdateCurrentTimeIf();
 | 
					            UpdateCurrentTimeIf();
 | 
				
			||||||
            lastDeviceEventTime = currentTime;
 | 
					            nt_list_for_each_entry(dev, inputInfo.devices, next)
 | 
				
			||||||
 | 
					                lastDeviceEventTime[dev->id] = currentTime;
 | 
				
			||||||
            SetScreenSaverTimer();
 | 
					            SetScreenSaverTimer();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -672,7 +675,7 @@ ProcScreenSaverQueryInfo(ClientPtr client)
 | 
				
			||||||
    pPriv = GetScreenPrivate(pDraw->pScreen);
 | 
					    pPriv = GetScreenPrivate(pDraw->pScreen);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    UpdateCurrentTime();
 | 
					    UpdateCurrentTime();
 | 
				
			||||||
    lastInput = GetTimeInMillis() - lastDeviceEventTime.milliseconds;
 | 
					    lastInput = GetTimeInMillis() - lastDeviceEventTime[XIAllDevices].milliseconds;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    rep.type = X_Reply;
 | 
					    rep.type = X_Reply;
 | 
				
			||||||
    rep.length = 0;
 | 
					    rep.length = 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										203
									
								
								Xext/sync.c
								
								
								
								
							
							
						
						
									
										203
									
								
								Xext/sync.c
								
								
								
								
							| 
						 | 
					@ -69,6 +69,7 @@ PERFORMANCE OF THIS SOFTWARE.
 | 
				
			||||||
#include "syncsrv.h"
 | 
					#include "syncsrv.h"
 | 
				
			||||||
#include "syncsdk.h"
 | 
					#include "syncsdk.h"
 | 
				
			||||||
#include "protocol-versions.h"
 | 
					#include "protocol-versions.h"
 | 
				
			||||||
 | 
					#include "inputstr.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdio.h>
 | 
					#include <stdio.h>
 | 
				
			||||||
#if !defined(WIN32)
 | 
					#if !defined(WIN32)
 | 
				
			||||||
| 
						 | 
					@ -87,8 +88,7 @@ static RESTYPE RTAwait;
 | 
				
			||||||
static RESTYPE RTAlarm;
 | 
					static RESTYPE RTAlarm;
 | 
				
			||||||
static RESTYPE RTAlarmClient;
 | 
					static RESTYPE RTAlarmClient;
 | 
				
			||||||
static RESTYPE RTFence;
 | 
					static RESTYPE RTFence;
 | 
				
			||||||
static int SyncNumSystemCounters = 0;
 | 
					static struct xorg_list SysCounterList;
 | 
				
			||||||
static SyncCounter **SysCounterList = NULL;
 | 
					 | 
				
			||||||
static int SyncNumInvalidCounterWarnings = 0;
 | 
					static int SyncNumInvalidCounterWarnings = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MAX_INVALID_COUNTER_WARNINGS	   5
 | 
					#define MAX_INVALID_COUNTER_WARNINGS	   5
 | 
				
			||||||
| 
						 | 
					@ -114,6 +114,14 @@ static void SyncInitServerTime(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void SyncInitIdleTime(void);
 | 
					static void SyncInitIdleTime(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static inline void*
 | 
				
			||||||
 | 
					SysCounterGetPrivate(SyncCounter *counter)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    BUG_WARN(!IsSystemCounter(counter));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return counter->pSysCounterInfo ? counter->pSysCounterInfo->private : NULL;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static Bool
 | 
					static Bool
 | 
				
			||||||
SyncCheckWarnIsCounter(const SyncObject * pSync, const char *warning)
 | 
					SyncCheckWarnIsCounter(const SyncObject * pSync, const char *warning)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -932,12 +940,6 @@ SyncCreateSystemCounter(const char *name,
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    SyncCounter *pCounter;
 | 
					    SyncCounter *pCounter;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    SysCounterList = realloc(SysCounterList,
 | 
					 | 
				
			||||||
                             (SyncNumSystemCounters +
 | 
					 | 
				
			||||||
                              1) * sizeof(SyncCounter *));
 | 
					 | 
				
			||||||
    if (!SysCounterList)
 | 
					 | 
				
			||||||
        return NULL;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /* this function may be called before SYNC has been initialized, so we
 | 
					    /* this function may be called before SYNC has been initialized, so we
 | 
				
			||||||
     * have to make sure RTCounter is created.
 | 
					     * have to make sure RTCounter is created.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
| 
						 | 
					@ -959,14 +961,16 @@ SyncCreateSystemCounter(const char *name,
 | 
				
			||||||
            return pCounter;
 | 
					            return pCounter;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        pCounter->pSysCounterInfo = psci;
 | 
					        pCounter->pSysCounterInfo = psci;
 | 
				
			||||||
        psci->name = name;
 | 
					        psci->pCounter = pCounter;
 | 
				
			||||||
 | 
					        psci->name = strdup(name);
 | 
				
			||||||
        psci->resolution = resolution;
 | 
					        psci->resolution = resolution;
 | 
				
			||||||
        psci->counterType = counterType;
 | 
					        psci->counterType = counterType;
 | 
				
			||||||
        psci->QueryValue = QueryValue;
 | 
					        psci->QueryValue = QueryValue;
 | 
				
			||||||
        psci->BracketValues = BracketValues;
 | 
					        psci->BracketValues = BracketValues;
 | 
				
			||||||
 | 
					        psci->private = NULL;
 | 
				
			||||||
        XSyncMaxValue(&psci->bracket_greater);
 | 
					        XSyncMaxValue(&psci->bracket_greater);
 | 
				
			||||||
        XSyncMinValue(&psci->bracket_less);
 | 
					        XSyncMinValue(&psci->bracket_less);
 | 
				
			||||||
        SysCounterList[SyncNumSystemCounters++] = pCounter;
 | 
					        xorg_list_add(&psci->entry, &SysCounterList);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return pCounter;
 | 
					    return pCounter;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -1111,26 +1115,10 @@ FreeCounter(void *env, XID id)
 | 
				
			||||||
        free(ptl);              /* destroy the trigger list as we go */
 | 
					        free(ptl);              /* destroy the trigger list as we go */
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (IsSystemCounter(pCounter)) {
 | 
					    if (IsSystemCounter(pCounter)) {
 | 
				
			||||||
        int i, found = 0;
 | 
					        xorg_list_del(&pCounter->pSysCounterInfo->entry);
 | 
				
			||||||
 | 
					        free(pCounter->pSysCounterInfo->name);
 | 
				
			||||||
 | 
					        free(pCounter->pSysCounterInfo->private);
 | 
				
			||||||
        free(pCounter->pSysCounterInfo);
 | 
					        free(pCounter->pSysCounterInfo);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        /* find the counter in the list of system counters and remove it */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (SysCounterList) {
 | 
					 | 
				
			||||||
            for (i = 0; i < SyncNumSystemCounters; i++) {
 | 
					 | 
				
			||||||
                if (SysCounterList[i] == pCounter) {
 | 
					 | 
				
			||||||
                    found = i;
 | 
					 | 
				
			||||||
                    break;
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            if (found < (SyncNumSystemCounters - 1)) {
 | 
					 | 
				
			||||||
                for (i = found; i < SyncNumSystemCounters - 1; i++) {
 | 
					 | 
				
			||||||
                    SysCounterList[i] = SysCounterList[i + 1];
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        SyncNumSystemCounters--;
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    free(pCounter);
 | 
					    free(pCounter);
 | 
				
			||||||
    return Success;
 | 
					    return Success;
 | 
				
			||||||
| 
						 | 
					@ -1221,20 +1209,20 @@ static int
 | 
				
			||||||
ProcSyncListSystemCounters(ClientPtr client)
 | 
					ProcSyncListSystemCounters(ClientPtr client)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    xSyncListSystemCountersReply rep;
 | 
					    xSyncListSystemCountersReply rep;
 | 
				
			||||||
    int i, len;
 | 
					    SysCounterInfo *psci;
 | 
				
			||||||
 | 
					    int len = 0;
 | 
				
			||||||
    xSyncSystemCounter *list = NULL, *walklist = NULL;
 | 
					    xSyncSystemCounter *list = NULL, *walklist = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    REQUEST_SIZE_MATCH(xSyncListSystemCountersReq);
 | 
					    REQUEST_SIZE_MATCH(xSyncListSystemCountersReq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    rep.type = X_Reply;
 | 
					    rep.type = X_Reply;
 | 
				
			||||||
    rep.sequenceNumber = client->sequence;
 | 
					    rep.sequenceNumber = client->sequence;
 | 
				
			||||||
    rep.nCounters = SyncNumSystemCounters;
 | 
					    rep.nCounters = 0;
 | 
				
			||||||
 | 
					 | 
				
			||||||
    for (i = len = 0; i < SyncNumSystemCounters; i++) {
 | 
					 | 
				
			||||||
        const char *name = SysCounterList[i]->pSysCounterInfo->name;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    xorg_list_for_each_entry(psci, &SysCounterList, entry) {
 | 
				
			||||||
        /* pad to 4 byte boundary */
 | 
					        /* pad to 4 byte boundary */
 | 
				
			||||||
        len += pad_to_int32(sz_xSyncSystemCounter + strlen(name));
 | 
					        len += pad_to_int32(sz_xSyncSystemCounter + strlen(psci->name));
 | 
				
			||||||
 | 
					        ++rep.nCounters;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (len) {
 | 
					    if (len) {
 | 
				
			||||||
| 
						 | 
					@ -1251,12 +1239,11 @@ ProcSyncListSystemCounters(ClientPtr client)
 | 
				
			||||||
        swapl(&rep.nCounters);
 | 
					        swapl(&rep.nCounters);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (i = 0; i < SyncNumSystemCounters; i++) {
 | 
					    xorg_list_for_each_entry(psci, &SysCounterList, entry) {
 | 
				
			||||||
        int namelen;
 | 
					        int namelen;
 | 
				
			||||||
        char *pname_in_reply;
 | 
					        char *pname_in_reply;
 | 
				
			||||||
        SysCounterInfo *psci = SysCounterList[i]->pSysCounterInfo;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        walklist->counter = SysCounterList[i]->sync.id;
 | 
					        walklist->counter = psci->pCounter->sync.id;
 | 
				
			||||||
        walklist->resolution_hi = XSyncValueHigh32(psci->resolution);
 | 
					        walklist->resolution_hi = XSyncValueHigh32(psci->resolution);
 | 
				
			||||||
        walklist->resolution_lo = XSyncValueLow32(psci->resolution);
 | 
					        walklist->resolution_lo = XSyncValueLow32(psci->resolution);
 | 
				
			||||||
        namelen = strlen(psci->name);
 | 
					        namelen = strlen(psci->name);
 | 
				
			||||||
| 
						 | 
					@ -2441,8 +2428,6 @@ SAlarmNotifyEvent(xSyncAlarmNotifyEvent * from, xSyncAlarmNotifyEvent * to)
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
SyncResetProc(ExtensionEntry * extEntry)
 | 
					SyncResetProc(ExtensionEntry * extEntry)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    free(SysCounterList);
 | 
					 | 
				
			||||||
    SysCounterList = NULL;
 | 
					 | 
				
			||||||
    RTCounter = 0;
 | 
					    RTCounter = 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2455,6 +2440,8 @@ SyncExtensionInit(void)
 | 
				
			||||||
    ExtensionEntry *extEntry;
 | 
					    ExtensionEntry *extEntry;
 | 
				
			||||||
    int s;
 | 
					    int s;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    xorg_list_init(&SysCounterList);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (s = 0; s < screenInfo.numScreens; s++)
 | 
					    for (s = 0; s < screenInfo.numScreens; s++)
 | 
				
			||||||
        miSyncSetup(screenInfo.screens[s]);
 | 
					        miSyncSetup(screenInfo.screens[s]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2605,33 +2592,48 @@ SyncInitServerTime(void)
 | 
				
			||||||
 * IDLETIME implementation
 | 
					 * IDLETIME implementation
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static SyncCounter *IdleTimeCounter;
 | 
					typedef struct {
 | 
				
			||||||
static XSyncValue *pIdleTimeValueLess;
 | 
					    XSyncValue *value_less;
 | 
				
			||||||
static XSyncValue *pIdleTimeValueGreater;
 | 
					    XSyncValue *value_greater;
 | 
				
			||||||
 | 
					    int deviceid;
 | 
				
			||||||
 | 
					} IdleCounterPriv;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
IdleTimeQueryValue(pointer pCounter, CARD64 * pValue_return)
 | 
					IdleTimeQueryValue(pointer pCounter, CARD64 * pValue_return)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    CARD32 idle = GetTimeInMillis() - lastDeviceEventTime.milliseconds;
 | 
					    int deviceid;
 | 
				
			||||||
 | 
					    CARD32 idle;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (pCounter) {
 | 
				
			||||||
 | 
					        SyncCounter *counter = pCounter;
 | 
				
			||||||
 | 
					        IdleCounterPriv *priv = SysCounterGetPrivate(counter);
 | 
				
			||||||
 | 
					        deviceid = priv->deviceid;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					        deviceid = XIAllDevices;
 | 
				
			||||||
 | 
					    idle = GetTimeInMillis() - lastDeviceEventTime[deviceid].milliseconds;
 | 
				
			||||||
    XSyncIntsToValue(pValue_return, idle, 0);
 | 
					    XSyncIntsToValue(pValue_return, idle, 0);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
IdleTimeBlockHandler(pointer env, struct timeval **wt, pointer LastSelectMask)
 | 
					IdleTimeBlockHandler(pointer pCounter, struct timeval **wt, pointer LastSelectMask)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    SyncCounter *counter = pCounter;
 | 
				
			||||||
 | 
					    IdleCounterPriv *priv = SysCounterGetPrivate(counter);
 | 
				
			||||||
 | 
					    XSyncValue *less = priv->value_less,
 | 
				
			||||||
 | 
					               *greater = priv->value_greater;
 | 
				
			||||||
    XSyncValue idle, old_idle;
 | 
					    XSyncValue idle, old_idle;
 | 
				
			||||||
    SyncTriggerList *list = IdleTimeCounter->sync.pTriglist;
 | 
					    SyncTriggerList *list = counter->sync.pTriglist;
 | 
				
			||||||
    SyncTrigger *trig;
 | 
					    SyncTrigger *trig;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!pIdleTimeValueLess && !pIdleTimeValueGreater)
 | 
					    if (!less && !greater)
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    old_idle = IdleTimeCounter->value;
 | 
					    old_idle = counter->value;
 | 
				
			||||||
    IdleTimeQueryValue(NULL, &idle);
 | 
					    IdleTimeQueryValue(NULL, &idle);
 | 
				
			||||||
    IdleTimeCounter->value = idle;      /* push, so CheckTrigger works */
 | 
					    counter->value = idle;      /* push, so CheckTrigger works */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (pIdleTimeValueLess && XSyncValueLessOrEqual(idle, *pIdleTimeValueLess)) {
 | 
					    if (less && XSyncValueLessOrEqual(idle, *less)) {
 | 
				
			||||||
        /*
 | 
					        /*
 | 
				
			||||||
         * We've been idle for less than the threshold value, and someone
 | 
					         * We've been idle for less than the threshold value, and someone
 | 
				
			||||||
         * wants to know about that, but now we need to know whether they
 | 
					         * wants to know about that, but now we need to know whether they
 | 
				
			||||||
| 
						 | 
					@ -2640,7 +2642,7 @@ IdleTimeBlockHandler(pointer env, struct timeval **wt, pointer LastSelectMask)
 | 
				
			||||||
         * immediately so we can reschedule.
 | 
					         * immediately so we can reschedule.
 | 
				
			||||||
         */
 | 
					         */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for (list = IdleTimeCounter->sync.pTriglist; list; list = list->next) {
 | 
					        for (list = counter->sync.pTriglist; list; list = list->next) {
 | 
				
			||||||
            trig = list->pTrigger;
 | 
					            trig = list->pTrigger;
 | 
				
			||||||
            if (trig->CheckTrigger(trig, old_idle)) {
 | 
					            if (trig->CheckTrigger(trig, old_idle)) {
 | 
				
			||||||
                AdjustWaitForDelay(wt, 0);
 | 
					                AdjustWaitForDelay(wt, 0);
 | 
				
			||||||
| 
						 | 
					@ -2653,10 +2655,10 @@ IdleTimeBlockHandler(pointer env, struct timeval **wt, pointer LastSelectMask)
 | 
				
			||||||
         * idle time greater than this.  Schedule a wakeup for the next
 | 
					         * idle time greater than this.  Schedule a wakeup for the next
 | 
				
			||||||
         * millisecond so we won't miss a transition.
 | 
					         * millisecond so we won't miss a transition.
 | 
				
			||||||
         */
 | 
					         */
 | 
				
			||||||
        if (XSyncValueEqual(idle, *pIdleTimeValueLess))
 | 
					        if (XSyncValueEqual(idle, *less))
 | 
				
			||||||
            AdjustWaitForDelay(wt, 1);
 | 
					            AdjustWaitForDelay(wt, 1);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else if (pIdleTimeValueGreater) {
 | 
					    else if (greater) {
 | 
				
			||||||
        /*
 | 
					        /*
 | 
				
			||||||
         * There's a threshold in the positive direction.  If we've been
 | 
					         * There's a threshold in the positive direction.  If we've been
 | 
				
			||||||
         * idle less than it, schedule a wakeup for sometime in the future.
 | 
					         * idle less than it, schedule a wakeup for sometime in the future.
 | 
				
			||||||
| 
						 | 
					@ -2665,15 +2667,15 @@ IdleTimeBlockHandler(pointer env, struct timeval **wt, pointer LastSelectMask)
 | 
				
			||||||
         */
 | 
					         */
 | 
				
			||||||
        unsigned long timeout = -1;
 | 
					        unsigned long timeout = -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (XSyncValueLessThan(idle, *pIdleTimeValueGreater)) {
 | 
					        if (XSyncValueLessThan(idle, *greater)) {
 | 
				
			||||||
            XSyncValue value;
 | 
					            XSyncValue value;
 | 
				
			||||||
            Bool overflow;
 | 
					            Bool overflow;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            XSyncValueSubtract(&value, *pIdleTimeValueGreater, idle, &overflow);
 | 
					            XSyncValueSubtract(&value, *greater, idle, &overflow);
 | 
				
			||||||
            timeout = min(timeout, XSyncValueLow32(value));
 | 
					            timeout = min(timeout, XSyncValueLow32(value));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        else {
 | 
					        else {
 | 
				
			||||||
            for (list = IdleTimeCounter->sync.pTriglist; list;
 | 
					            for (list = counter->sync.pTriglist; list;
 | 
				
			||||||
                 list = list->next) {
 | 
					                 list = list->next) {
 | 
				
			||||||
                trig = list->pTrigger;
 | 
					                trig = list->pTrigger;
 | 
				
			||||||
                if (trig->CheckTrigger(trig, old_idle)) {
 | 
					                if (trig->CheckTrigger(trig, old_idle)) {
 | 
				
			||||||
| 
						 | 
					@ -2686,24 +2688,26 @@ IdleTimeBlockHandler(pointer env, struct timeval **wt, pointer LastSelectMask)
 | 
				
			||||||
        AdjustWaitForDelay(wt, timeout);
 | 
					        AdjustWaitForDelay(wt, timeout);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    IdleTimeCounter->value = old_idle;  /* pop */
 | 
					    counter->value = old_idle;  /* pop */
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
IdleTimeWakeupHandler(pointer env, int rc, pointer LastSelectMask)
 | 
					IdleTimeWakeupHandler(pointer pCounter, int rc, pointer LastSelectMask)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    SyncCounter *counter = pCounter;
 | 
				
			||||||
 | 
					    IdleCounterPriv *priv = SysCounterGetPrivate(counter);
 | 
				
			||||||
 | 
					    XSyncValue *less = priv->value_less,
 | 
				
			||||||
 | 
					               *greater = priv->value_greater;
 | 
				
			||||||
    XSyncValue idle;
 | 
					    XSyncValue idle;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!pIdleTimeValueLess && !pIdleTimeValueGreater)
 | 
					    if (!less && !greater)
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    IdleTimeQueryValue(NULL, &idle);
 | 
					    IdleTimeQueryValue(pCounter, &idle);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ((pIdleTimeValueGreater &&
 | 
					    if ((greater && XSyncValueGreaterOrEqual(idle, *greater)) ||
 | 
				
			||||||
         XSyncValueGreaterOrEqual(idle, *pIdleTimeValueGreater)) ||
 | 
					        (less && XSyncValueLessOrEqual(idle, *less))) {
 | 
				
			||||||
        (pIdleTimeValueLess &&
 | 
					        SyncChangeCounter(counter, idle);
 | 
				
			||||||
         XSyncValueLessOrEqual(idle, *pIdleTimeValueLess))) {
 | 
					 | 
				
			||||||
        SyncChangeCounter(IdleTimeCounter, idle);
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2711,34 +2715,69 @@ static void
 | 
				
			||||||
IdleTimeBracketValues(pointer pCounter, CARD64 * pbracket_less,
 | 
					IdleTimeBracketValues(pointer pCounter, CARD64 * pbracket_less,
 | 
				
			||||||
                      CARD64 * pbracket_greater)
 | 
					                      CARD64 * pbracket_greater)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    Bool registered = (pIdleTimeValueLess || pIdleTimeValueGreater);
 | 
					    SyncCounter *counter = pCounter;
 | 
				
			||||||
 | 
					    IdleCounterPriv *priv = SysCounterGetPrivate(counter);
 | 
				
			||||||
 | 
					    XSyncValue *less = priv->value_less,
 | 
				
			||||||
 | 
					               *greater = priv->value_greater;
 | 
				
			||||||
 | 
					    Bool registered = (less || greater);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (registered && !pbracket_less && !pbracket_greater) {
 | 
					    if (registered && !pbracket_less && !pbracket_greater) {
 | 
				
			||||||
        RemoveBlockAndWakeupHandlers(IdleTimeBlockHandler,
 | 
					        RemoveBlockAndWakeupHandlers(IdleTimeBlockHandler,
 | 
				
			||||||
                                     IdleTimeWakeupHandler, NULL);
 | 
					                                     IdleTimeWakeupHandler, pCounter);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else if (!registered && (pbracket_less || pbracket_greater)) {
 | 
					    else if (!registered && (pbracket_less || pbracket_greater)) {
 | 
				
			||||||
        RegisterBlockAndWakeupHandlers(IdleTimeBlockHandler,
 | 
					        RegisterBlockAndWakeupHandlers(IdleTimeBlockHandler,
 | 
				
			||||||
                                       IdleTimeWakeupHandler, NULL);
 | 
					                                       IdleTimeWakeupHandler, pCounter);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pIdleTimeValueGreater = pbracket_greater;
 | 
					    priv->value_greater = pbracket_greater;
 | 
				
			||||||
    pIdleTimeValueLess = pbracket_less;
 | 
					    priv->value_less = pbracket_less;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static SyncCounter*
 | 
				
			||||||
 | 
					init_system_idle_counter(const char *name, int deviceid)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    CARD64 resolution;
 | 
				
			||||||
 | 
					    XSyncValue idle;
 | 
				
			||||||
 | 
					    IdleCounterPriv *priv = malloc(sizeof(IdleCounterPriv));
 | 
				
			||||||
 | 
					    SyncCounter *idle_time_counter;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    IdleTimeQueryValue(NULL, &idle);
 | 
				
			||||||
 | 
					    XSyncIntToValue(&resolution, 4);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    idle_time_counter = SyncCreateSystemCounter(name, idle, resolution,
 | 
				
			||||||
 | 
					                                                XSyncCounterUnrestricted,
 | 
				
			||||||
 | 
					                                                IdleTimeQueryValue,
 | 
				
			||||||
 | 
					                                                IdleTimeBracketValues);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    priv->deviceid = deviceid;
 | 
				
			||||||
 | 
					    priv->value_less = priv->value_greater = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    idle_time_counter->pSysCounterInfo->private = priv;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return idle_time_counter;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
SyncInitIdleTime(void)
 | 
					SyncInitIdleTime(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    CARD64 resolution;
 | 
					    init_system_idle_counter("IDLETIME", XIAllDevices);
 | 
				
			||||||
    XSyncValue idle;
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    IdleTimeQueryValue(NULL, &idle);
 | 
					SyncCounter*
 | 
				
			||||||
    XSyncIntToValue(&resolution, 4);
 | 
					SyncInitDeviceIdleTime(DeviceIntPtr dev)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
    IdleTimeCounter = SyncCreateSystemCounter("IDLETIME", idle, resolution,
 | 
					    char timer_name[64];
 | 
				
			||||||
                                              XSyncCounterUnrestricted,
 | 
					    sprintf(timer_name, "DEVICEIDLETIME %d", dev->id);
 | 
				
			||||||
                                              IdleTimeQueryValue,
 | 
					
 | 
				
			||||||
                                              IdleTimeBracketValues);
 | 
					    return init_system_idle_counter(timer_name, dev->id);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
    pIdleTimeValueLess = pIdleTimeValueGreater = NULL;
 | 
					
 | 
				
			||||||
 | 
					void SyncRemoveDeviceIdleTime(SyncCounter *counter)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    /* FreeAllResources() frees all system counters before the devices are
 | 
				
			||||||
 | 
					       shut down, check if there are any left before freeing the device's
 | 
				
			||||||
 | 
					       counter */
 | 
				
			||||||
 | 
					    if (!xorg_list_is_empty(&SysCounterList))
 | 
				
			||||||
 | 
					        xorg_list_del(&counter->pSysCounterInfo->entry);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -51,6 +51,7 @@ PERFORMANCE OF THIS SOFTWARE.
 | 
				
			||||||
#ifndef _SYNCSRV_H_
 | 
					#ifndef _SYNCSRV_H_
 | 
				
			||||||
#define _SYNCSRV_H_
 | 
					#define _SYNCSRV_H_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "list.h"
 | 
				
			||||||
#include "misync.h"
 | 
					#include "misync.h"
 | 
				
			||||||
#include "misyncstr.h"
 | 
					#include "misyncstr.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -74,13 +75,16 @@ typedef void (*SyncSystemCounterBracketValues)(pointer counter,
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct _SysCounterInfo {
 | 
					typedef struct _SysCounterInfo {
 | 
				
			||||||
    const char *name;
 | 
					    SyncCounter *pCounter;
 | 
				
			||||||
 | 
					    char *name;
 | 
				
			||||||
    CARD64 resolution;
 | 
					    CARD64 resolution;
 | 
				
			||||||
    CARD64 bracket_greater;
 | 
					    CARD64 bracket_greater;
 | 
				
			||||||
    CARD64 bracket_less;
 | 
					    CARD64 bracket_less;
 | 
				
			||||||
    SyncCounterType counterType;        /* how can this counter change */
 | 
					    SyncCounterType counterType;        /* how can this counter change */
 | 
				
			||||||
    SyncSystemCounterQueryValue QueryValue;
 | 
					    SyncSystemCounterQueryValue QueryValue;
 | 
				
			||||||
    SyncSystemCounterBracketValues BracketValues;
 | 
					    SyncSystemCounterBracketValues BracketValues;
 | 
				
			||||||
 | 
					    void *private;
 | 
				
			||||||
 | 
					    struct xorg_list entry;
 | 
				
			||||||
} SysCounterInfo;
 | 
					} SysCounterInfo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct _SyncAlarmClientList {
 | 
					typedef struct _SyncAlarmClientList {
 | 
				
			||||||
| 
						 | 
					@ -131,4 +135,7 @@ extern void SyncChangeCounter(SyncCounter *pCounter,
 | 
				
			||||||
extern void SyncDestroySystemCounter(pointer pCounter);
 | 
					extern void SyncDestroySystemCounter(pointer pCounter);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern void SyncExtensionInit(void);
 | 
					extern void SyncExtensionInit(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					extern SyncCounter *SyncInitDeviceIdleTime(DeviceIntPtr dev);
 | 
				
			||||||
 | 
					extern void SyncRemoveDeviceIdleTime(SyncCounter *counter);
 | 
				
			||||||
#endif                          /* _SYNCSRV_H_ */
 | 
					#endif                          /* _SYNCSRV_H_ */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1598,7 +1598,7 @@ ProcessDeviceEvent(InternalEvent *ev, DeviceIntPtr device)
 | 
				
			||||||
        GetSpritePosition(device, &rootX, &rootY);
 | 
					        GetSpritePosition(device, &rootX, &rootY);
 | 
				
			||||||
        event->root_x = rootX;
 | 
					        event->root_x = rootX;
 | 
				
			||||||
        event->root_y = rootY;
 | 
					        event->root_y = rootY;
 | 
				
			||||||
        NoticeEventTime((InternalEvent *) event);
 | 
					        NoticeEventTime((InternalEvent *) event, device);
 | 
				
			||||||
        event->corestate = corestate;
 | 
					        event->corestate = corestate;
 | 
				
			||||||
        key = event->detail.key;
 | 
					        key = event->detail.key;
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -84,6 +84,7 @@ SOFTWARE.
 | 
				
			||||||
#include "enterleave.h"         /* for EnterWindow() */
 | 
					#include "enterleave.h"         /* for EnterWindow() */
 | 
				
			||||||
#include "xserver-properties.h"
 | 
					#include "xserver-properties.h"
 | 
				
			||||||
#include "xichangehierarchy.h"  /* For XISendDeviceHierarchyEvent */
 | 
					#include "xichangehierarchy.h"  /* For XISendDeviceHierarchyEvent */
 | 
				
			||||||
 | 
					#include "syncsrv.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** @file
 | 
					/** @file
 | 
				
			||||||
 * This file handles input device-related stuff.
 | 
					 * This file handles input device-related stuff.
 | 
				
			||||||
| 
						 | 
					@ -406,9 +407,13 @@ EnableDevice(DeviceIntPtr dev, BOOL sendevent)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    RecalculateMasterButtons(dev);
 | 
					    RecalculateMasterButtons(dev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* initialise an idle timer for this device*/
 | 
				
			||||||
 | 
					    dev->idle_counter = SyncInitDeviceIdleTime(dev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return TRUE;
 | 
					    return TRUE;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Switch a device off through the driver and push it onto the off_devices
 | 
					 * Switch a device off through the driver and push it onto the off_devices
 | 
				
			||||||
 * list. A device will not send events while disabled. All clients are
 | 
					 * list. A device will not send events while disabled. All clients are
 | 
				
			||||||
| 
						 | 
					@ -432,6 +437,9 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
 | 
				
			||||||
    if (*prev != dev)
 | 
					    if (*prev != dev)
 | 
				
			||||||
        return FALSE;
 | 
					        return FALSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    SyncRemoveDeviceIdleTime(dev->idle_counter);
 | 
				
			||||||
 | 
					    dev->idle_counter = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* float attached devices */
 | 
					    /* float attached devices */
 | 
				
			||||||
    if (IsMaster(dev)) {
 | 
					    if (IsMaster(dev)) {
 | 
				
			||||||
        for (other = inputInfo.devices; other; other = other->next) {
 | 
					        for (other = inputInfo.devices; other; other = other->next) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										13
									
								
								dix/events.c
								
								
								
								
							
							
						
						
									
										13
									
								
								dix/events.c
								
								
								
								
							| 
						 | 
					@ -1055,19 +1055,20 @@ MonthChangedOrBadTime(InternalEvent *ev)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
NoticeTime(InternalEvent *ev)
 | 
					NoticeTime(InternalEvent *ev, DeviceIntPtr dev)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (ev->any.time < currentTime.milliseconds)
 | 
					    if (ev->any.time < currentTime.milliseconds)
 | 
				
			||||||
        MonthChangedOrBadTime(ev);
 | 
					        MonthChangedOrBadTime(ev);
 | 
				
			||||||
    currentTime.milliseconds = ev->any.time;
 | 
					    currentTime.milliseconds = ev->any.time;
 | 
				
			||||||
    lastDeviceEventTime = currentTime;
 | 
					    lastDeviceEventTime[XIAllDevices] = currentTime;
 | 
				
			||||||
 | 
					    lastDeviceEventTime[dev->id] = currentTime;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
NoticeEventTime(InternalEvent *ev)
 | 
					NoticeEventTime(InternalEvent *ev, DeviceIntPtr dev)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (!syncEvents.playingEvents)
 | 
					    if (!syncEvents.playingEvents)
 | 
				
			||||||
        NoticeTime(ev);
 | 
					        NoticeTime(ev, dev);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**************************************************************************
 | 
					/**************************************************************************
 | 
				
			||||||
| 
						 | 
					@ -1091,7 +1092,7 @@ EnqueueEvent(InternalEvent *ev, DeviceIntPtr device)
 | 
				
			||||||
    if (!xorg_list_is_empty(&syncEvents.pending))
 | 
					    if (!xorg_list_is_empty(&syncEvents.pending))
 | 
				
			||||||
        tail = xorg_list_last_entry(&syncEvents.pending, QdEventRec, next);
 | 
					        tail = xorg_list_last_entry(&syncEvents.pending, QdEventRec, next);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    NoticeTime((InternalEvent *) event);
 | 
					    NoticeTime((InternalEvent *)event, device);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Fix for key repeating bug. */
 | 
					    /* Fix for key repeating bug. */
 | 
				
			||||||
    if (device->key != NULL && device->key->xkbInfo != NULL &&
 | 
					    if (device->key != NULL && device->key->xkbInfo != NULL &&
 | 
				
			||||||
| 
						 | 
					@ -5163,6 +5164,7 @@ InitEvents(void)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (i = 0; i < MAXDEVICES; i++) {
 | 
					    for (i = 0; i < MAXDEVICES; i++) {
 | 
				
			||||||
        memcpy(&event_filters[i], default_filter, sizeof(default_filter));
 | 
					        memcpy(&event_filters[i], default_filter, sizeof(default_filter));
 | 
				
			||||||
 | 
					        lastDeviceEventTime[i] = currentTime;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    syncEvents.replayDev = (DeviceIntPtr) NULL;
 | 
					    syncEvents.replayDev = (DeviceIntPtr) NULL;
 | 
				
			||||||
| 
						 | 
					@ -5176,7 +5178,6 @@ InitEvents(void)
 | 
				
			||||||
    syncEvents.time.milliseconds = 0;   /* hardly matters */
 | 
					    syncEvents.time.milliseconds = 0;   /* hardly matters */
 | 
				
			||||||
    currentTime.months = 0;
 | 
					    currentTime.months = 0;
 | 
				
			||||||
    currentTime.milliseconds = GetTimeInMillis();
 | 
					    currentTime.milliseconds = GetTimeInMillis();
 | 
				
			||||||
    lastDeviceEventTime = currentTime;
 | 
					 | 
				
			||||||
    for (i = 0; i < DNPMCOUNT; i++) {
 | 
					    for (i = 0; i < DNPMCOUNT; i++) {
 | 
				
			||||||
        DontPropagateMasks[i] = 0;
 | 
					        DontPropagateMasks[i] = 0;
 | 
				
			||||||
        DontPropagateRefCnts[i] = 0;
 | 
					        DontPropagateRefCnts[i] = 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -122,7 +122,7 @@ Bool party_like_its_1989 = FALSE;
 | 
				
			||||||
Bool whiteRoot = FALSE;
 | 
					Bool whiteRoot = FALSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TimeStamp currentTime;
 | 
					TimeStamp currentTime;
 | 
				
			||||||
TimeStamp lastDeviceEventTime;
 | 
					TimeStamp lastDeviceEventTime[MAXDEVICES];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int defaultColorVisualClass = -1;
 | 
					int defaultColorVisualClass = -1;
 | 
				
			||||||
int monitorResolution = 0;
 | 
					int monitorResolution = 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3134,8 +3134,10 @@ dixSaveScreens(ClientPtr client, int on, int mode)
 | 
				
			||||||
    screenIsSaved = what;
 | 
					    screenIsSaved = what;
 | 
				
			||||||
    if (mode == ScreenSaverReset) {
 | 
					    if (mode == ScreenSaverReset) {
 | 
				
			||||||
        if (on == SCREEN_SAVER_FORCER) {
 | 
					        if (on == SCREEN_SAVER_FORCER) {
 | 
				
			||||||
 | 
					            DeviceIntPtr dev;
 | 
				
			||||||
            UpdateCurrentTimeIf();
 | 
					            UpdateCurrentTimeIf();
 | 
				
			||||||
            lastDeviceEventTime = currentTime;
 | 
					            nt_list_for_each_entry(dev, inputInfo.devices, next)
 | 
				
			||||||
 | 
					                lastDeviceEventTime[dev->id] = currentTime;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        SetScreenSaverTimer();
 | 
					        SetScreenSaverTimer();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -340,7 +340,8 @@ KdEnableInput(void)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* reset screen saver */
 | 
					    /* reset screen saver */
 | 
				
			||||||
    ev.any.time = GetTimeInMillis();
 | 
					    ev.any.time = GetTimeInMillis();
 | 
				
			||||||
    NoticeEventTime(&ev);
 | 
					    NoticeEventTime(&ev, pi->dixdev);
 | 
				
			||||||
 | 
					    NoticeEventTime(&ev, ki->dixdev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    KdUnblockSigio();
 | 
					    KdUnblockSigio();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -313,7 +313,8 @@ extern _X_EXPORT WindowPtr
 | 
				
			||||||
GetSpriteWindow(DeviceIntPtr pDev);
 | 
					GetSpriteWindow(DeviceIntPtr pDev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern _X_EXPORT void
 | 
					extern _X_EXPORT void
 | 
				
			||||||
NoticeEventTime(InternalEvent *ev);
 | 
					NoticeEventTime(InternalEvent *ev,
 | 
				
			||||||
 | 
					                DeviceIntPtr dev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern void
 | 
					extern void
 | 
				
			||||||
EnqueueEvent(InternalEvent * /* ev */ ,
 | 
					EnqueueEvent(InternalEvent * /* ev */ ,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -156,7 +156,7 @@ typedef struct _WorkQueue {
 | 
				
			||||||
} WorkQueueRec;
 | 
					} WorkQueueRec;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern _X_EXPORT TimeStamp currentTime;
 | 
					extern _X_EXPORT TimeStamp currentTime;
 | 
				
			||||||
extern _X_EXPORT TimeStamp lastDeviceEventTime;
 | 
					extern _X_EXPORT TimeStamp lastDeviceEventTime[MAXDEVICES];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern _X_EXPORT int
 | 
					extern _X_EXPORT int
 | 
				
			||||||
CompareTimeStamps(TimeStamp /*a */ ,
 | 
					CompareTimeStamps(TimeStamp /*a */ ,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -591,6 +591,8 @@ typedef struct _DeviceIntRec {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* XTest related master device id */
 | 
					    /* XTest related master device id */
 | 
				
			||||||
    int xtest_master_id;
 | 
					    int xtest_master_id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    struct _SyncCounter *idle_counter;
 | 
				
			||||||
} DeviceIntRec;
 | 
					} DeviceIntRec;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct {
 | 
					typedef struct {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -547,7 +547,7 @@ NextDPMSTimeout(INT32 timeout)
 | 
				
			||||||
static CARD32
 | 
					static CARD32
 | 
				
			||||||
ScreenSaverTimeoutExpire(OsTimerPtr timer, CARD32 now, pointer arg)
 | 
					ScreenSaverTimeoutExpire(OsTimerPtr timer, CARD32 now, pointer arg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    INT32 timeout = now - lastDeviceEventTime.milliseconds;
 | 
					    INT32 timeout = now - lastDeviceEventTime[XIAllDevices].milliseconds;
 | 
				
			||||||
    CARD32 nextTimeout = 0;
 | 
					    CARD32 nextTimeout = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef DPMSExtension
 | 
					#ifdef DPMSExtension
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1391,7 +1391,7 @@ recv_alive_msg(unsigned length)
 | 
				
			||||||
        if (SessionRunning && AliveSessionID == SessionID) {
 | 
					        if (SessionRunning && AliveSessionID == SessionID) {
 | 
				
			||||||
            /* backoff dormancy period */
 | 
					            /* backoff dormancy period */
 | 
				
			||||||
            state = XDM_RUN_SESSION;
 | 
					            state = XDM_RUN_SESSION;
 | 
				
			||||||
            if ((GetTimeInMillis() - lastDeviceEventTime.milliseconds) >
 | 
					            if ((GetTimeInMillis() - lastDeviceEventTime[XIAllDevices].milliseconds) >
 | 
				
			||||||
                keepaliveDormancy * 1000) {
 | 
					                keepaliveDormancy * 1000) {
 | 
				
			||||||
                keepaliveDormancy <<= 1;
 | 
					                keepaliveDormancy <<= 1;
 | 
				
			||||||
                if (keepaliveDormancy > XDM_MAX_DORMANCY)
 | 
					                if (keepaliveDormancy > XDM_MAX_DORMANCY)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue