summaryrefslogtreecommitdiff
path: root/dix
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2012-03-22 13:13:07 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2012-03-22 13:13:07 +1000
commita7eac500e652f30deffd9dc5e623fab701077738 (patch)
tree4752399bd0658a63f8d1af3b3f9ceb6bf039721c /dix
parentbf876c87a9099fdfa63ed599f8ed9a954dd023d9 (diff)
parentd645edd11e7482f98c8b7e0d6c8693285c484907 (diff)
Merge branch 'per-device-sync-counters' into for-keith
Diffstat (limited to 'dix')
-rw-r--r--dix/devices.c8
-rw-r--r--dix/events.c13
-rw-r--r--dix/globals.c2
-rw-r--r--dix/window.c4
4 files changed, 19 insertions, 8 deletions
diff --git a/dix/devices.c b/dix/devices.c
index 012550443..600f8b738 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -84,6 +84,7 @@ SOFTWARE.
#include "enterleave.h" /* for EnterWindow() */
#include "xserver-properties.h"
#include "xichangehierarchy.h" /* For XISendDeviceHierarchyEvent */
+#include "syncsrv.h"
/** @file
* This file handles input device-related stuff.
@@ -406,9 +407,13 @@ EnableDevice(DeviceIntPtr dev, BOOL sendevent)
RecalculateMasterButtons(dev);
+ /* initialise an idle timer for this device*/
+ dev->idle_counter = SyncInitDeviceIdleTime(dev);
+
return TRUE;
}
+
/**
* 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
@@ -432,6 +437,9 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
if (*prev != dev)
return FALSE;
+ SyncRemoveDeviceIdleTime(dev->idle_counter);
+ dev->idle_counter = NULL;
+
/* float attached devices */
if (IsMaster(dev)) {
for (other = inputInfo.devices; other; other = other->next) {
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();
}