diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2012-03-12 13:51:02 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2012-03-22 13:12:56 +1000 |
commit | 6aef209ebc2e54f5465da505a780f7b4cc273ee0 (patch) | |
tree | 13798842bcc4ba3e2fef224bf6f74d7f86d26b7b | |
parent | 20cf0ef825e3f14b0688b691691e0aeba0a4860a (diff) |
Change lastDeviceIdleTime to be per-device
Preparation work for per-device idle counters.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: James Jones <jajones@nvidia.com>
-rw-r--r-- | Xext/saver.c | 7 | ||||
-rw-r--r-- | Xext/sync.c | 2 | ||||
-rw-r--r-- | Xi/exevents.c | 2 | ||||
-rw-r--r-- | dix/events.c | 13 | ||||
-rw-r--r-- | dix/globals.c | 2 | ||||
-rw-r--r-- | dix/window.c | 4 | ||||
-rw-r--r-- | hw/kdrive/src/kinput.c | 3 | ||||
-rw-r--r-- | include/dix.h | 3 | ||||
-rw-r--r-- | include/dixstruct.h | 2 | ||||
-rw-r--r-- | os/WaitFor.c | 2 | ||||
-rw-r--r-- | os/xdmcp.c | 2 |
11 files changed, 25 insertions, 17 deletions
diff --git a/Xext/saver.c b/Xext/saver.c index 159153c23..61fc044d7 100644 --- a/Xext/saver.c +++ b/Xext/saver.c @@ -46,6 +46,7 @@ in this Software without prior written authorization from the X Consortium. #include "cursorstr.h" #include "colormapst.h" #include "xace.h" +#include "inputstr.h" #ifdef PANORAMIX #include "panoramiX.h" #include "panoramiXsrv.h" @@ -388,8 +389,10 @@ ScreenSaverFreeSuspend(pointer value, XID id) if (screenIsSaved != SCREEN_SAVER_ON) #endif { + DeviceIntPtr dev; UpdateCurrentTimeIf(); - lastDeviceEventTime = currentTime; + nt_list_for_each_entry(dev, inputInfo.devices, next) + lastDeviceEventTime[dev->id] = currentTime; SetScreenSaverTimer(); } } @@ -672,7 +675,7 @@ ProcScreenSaverQueryInfo(ClientPtr client) pPriv = GetScreenPrivate(pDraw->pScreen); UpdateCurrentTime(); - lastInput = GetTimeInMillis() - lastDeviceEventTime.milliseconds; + lastInput = GetTimeInMillis() - lastDeviceEventTime[XIAllDevices].milliseconds; rep.type = X_Reply; rep.length = 0; diff --git a/Xext/sync.c b/Xext/sync.c index 25379bbec..8217e7662 100644 --- a/Xext/sync.c +++ b/Xext/sync.c @@ -2599,7 +2599,7 @@ typedef struct { static void IdleTimeQueryValue(pointer pCounter, CARD64 * pValue_return) { - CARD32 idle = GetTimeInMillis() - lastDeviceEventTime.milliseconds; + CARD32 idle = GetTimeInMillis() - lastDeviceEventTime[XIAllDevices].milliseconds; XSyncIntsToValue(pValue_return, idle, 0); } diff --git a/Xi/exevents.c b/Xi/exevents.c index f681a8b6f..ff2224094 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -1598,7 +1598,7 @@ ProcessDeviceEvent(InternalEvent *ev, DeviceIntPtr device) GetSpritePosition(device, &rootX, &rootY); event->root_x = rootX; event->root_y = rootY; - NoticeEventTime((InternalEvent *) event); + NoticeEventTime((InternalEvent *) event, device); event->corestate = corestate; key = event->detail.key; break; diff --git a/dix/events.c b/dix/events.c index f7b9456ea..447094757 100644 --- a/dix/events.c +++ b/dix/events.c @@ -1055,19 +1055,20 @@ MonthChangedOrBadTime(InternalEvent *ev) } static void -NoticeTime(InternalEvent *ev) +NoticeTime(InternalEvent *ev, DeviceIntPtr dev) { if (ev->any.time < currentTime.milliseconds) MonthChangedOrBadTime(ev); currentTime.milliseconds = ev->any.time; - lastDeviceEventTime = currentTime; + lastDeviceEventTime[XIAllDevices] = currentTime; + lastDeviceEventTime[dev->id] = currentTime; } void -NoticeEventTime(InternalEvent *ev) +NoticeEventTime(InternalEvent *ev, DeviceIntPtr dev) { if (!syncEvents.playingEvents) - NoticeTime(ev); + NoticeTime(ev, dev); } /************************************************************************** @@ -1091,7 +1092,7 @@ EnqueueEvent(InternalEvent *ev, DeviceIntPtr device) if (!xorg_list_is_empty(&syncEvents.pending)) tail = xorg_list_last_entry(&syncEvents.pending, QdEventRec, next); - NoticeTime((InternalEvent *) event); + NoticeTime((InternalEvent *)event, device); /* Fix for key repeating bug. */ if (device->key != NULL && device->key->xkbInfo != NULL && @@ -5163,6 +5164,7 @@ InitEvents(void) for (i = 0; i < MAXDEVICES; i++) { memcpy(&event_filters[i], default_filter, sizeof(default_filter)); + lastDeviceEventTime[i] = currentTime; } syncEvents.replayDev = (DeviceIntPtr) NULL; @@ -5176,7 +5178,6 @@ InitEvents(void) syncEvents.time.milliseconds = 0; /* hardly matters */ currentTime.months = 0; currentTime.milliseconds = GetTimeInMillis(); - lastDeviceEventTime = currentTime; for (i = 0; i < DNPMCOUNT; i++) { DontPropagateMasks[i] = 0; DontPropagateRefCnts[i] = 0; diff --git a/dix/globals.c b/dix/globals.c index c0cae159a..a564575f3 100644 --- a/dix/globals.c +++ b/dix/globals.c @@ -122,7 +122,7 @@ Bool party_like_its_1989 = FALSE; Bool whiteRoot = FALSE; TimeStamp currentTime; -TimeStamp lastDeviceEventTime; +TimeStamp lastDeviceEventTime[MAXDEVICES]; int defaultColorVisualClass = -1; int monitorResolution = 0; diff --git a/dix/window.c b/dix/window.c index a31e78fad..98f5604c9 100644 --- a/dix/window.c +++ b/dix/window.c @@ -3134,8 +3134,10 @@ dixSaveScreens(ClientPtr client, int on, int mode) screenIsSaved = what; if (mode == ScreenSaverReset) { if (on == SCREEN_SAVER_FORCER) { + DeviceIntPtr dev; UpdateCurrentTimeIf(); - lastDeviceEventTime = currentTime; + nt_list_for_each_entry(dev, inputInfo.devices, next) + lastDeviceEventTime[dev->id] = currentTime; } SetScreenSaverTimer(); } diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c index 692e511a8..e16fe78f2 100644 --- a/hw/kdrive/src/kinput.c +++ b/hw/kdrive/src/kinput.c @@ -340,7 +340,8 @@ KdEnableInput(void) /* reset screen saver */ ev.any.time = GetTimeInMillis(); - NoticeEventTime(&ev); + NoticeEventTime(&ev, pi->dixdev); + NoticeEventTime(&ev, ki->dixdev); KdUnblockSigio(); } diff --git a/include/dix.h b/include/dix.h index d604e0676..5dc2ac568 100644 --- a/include/dix.h +++ b/include/dix.h @@ -313,7 +313,8 @@ extern _X_EXPORT WindowPtr GetSpriteWindow(DeviceIntPtr pDev); extern _X_EXPORT void -NoticeEventTime(InternalEvent *ev); +NoticeEventTime(InternalEvent *ev, + DeviceIntPtr dev); extern void EnqueueEvent(InternalEvent * /* ev */ , diff --git a/include/dixstruct.h b/include/dixstruct.h index 75685a2dc..b2a168aa8 100644 --- a/include/dixstruct.h +++ b/include/dixstruct.h @@ -156,7 +156,7 @@ typedef struct _WorkQueue { } WorkQueueRec; extern _X_EXPORT TimeStamp currentTime; -extern _X_EXPORT TimeStamp lastDeviceEventTime; +extern _X_EXPORT TimeStamp lastDeviceEventTime[MAXDEVICES]; extern _X_EXPORT int CompareTimeStamps(TimeStamp /*a */ , diff --git a/os/WaitFor.c b/os/WaitFor.c index 4c3be343b..95e64ba45 100644 --- a/os/WaitFor.c +++ b/os/WaitFor.c @@ -547,7 +547,7 @@ NextDPMSTimeout(INT32 timeout) static CARD32 ScreenSaverTimeoutExpire(OsTimerPtr timer, CARD32 now, pointer arg) { - INT32 timeout = now - lastDeviceEventTime.milliseconds; + INT32 timeout = now - lastDeviceEventTime[XIAllDevices].milliseconds; CARD32 nextTimeout = 0; #ifdef DPMSExtension diff --git a/os/xdmcp.c b/os/xdmcp.c index 8d0fbb5a9..87f04b455 100644 --- a/os/xdmcp.c +++ b/os/xdmcp.c @@ -1391,7 +1391,7 @@ recv_alive_msg(unsigned length) if (SessionRunning && AliveSessionID == SessionID) { /* backoff dormancy period */ state = XDM_RUN_SESSION; - if ((GetTimeInMillis() - lastDeviceEventTime.milliseconds) > + if ((GetTimeInMillis() - lastDeviceEventTime[XIAllDevices].milliseconds) > keepaliveDormancy * 1000) { keepaliveDormancy <<= 1; if (keepaliveDormancy > XDM_MAX_DORMANCY) |