summaryrefslogtreecommitdiff
path: root/dix
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-05-20 16:23:38 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-05-22 15:44:03 +1000
commitadd2defac7e59dcb355e5ba12b6de60861741d57 (patch)
treed519a5b4d0e63ab7f5bd0f34fab5d25eca0fae5a /dix
parent73c7398aafa050950ad614483fb0d5bdd2da97ca (diff)
Split the signal-handler's lastSlave out into a separate variable.
dev->u.lastSlave was not signal safe since it was accessed by the DIX and during signal handling. Replaced with: 'dev->last.slave' for the signal handler's lastSlave (used to generate DeviceChangedEvents), . 'dev->u.lastSlave' for the DIX lastSlave (currently only used in change_modmap) Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'dix')
-rw-r--r--dix/devices.c14
-rw-r--r--dix/getevents.c10
2 files changed, 19 insertions, 5 deletions
diff --git a/dix/devices.c b/dix/devices.c
index ff91608a8..e7da2ad1d 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -433,6 +433,18 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
(void)(*dev->deviceProc)(dev, DEVICE_OFF);
dev->enabled = FALSE;
+
+ /* now that the device is disabled, we can reset the signal handler's
+ * last.slave */
+ OsBlockSignals();
+ for (other = inputInfo.devices; other; other = other->next)
+ {
+ if (other->last.slave == dev)
+ other->last.slave = NULL;
+ }
+ OsReleaseSignals();
+
+
*prev = dev->next;
dev->next = inputInfo.off_devices;
inputInfo.off_devices = dev;
@@ -2367,6 +2379,7 @@ AllocDevicePair (ClientPtr client, char* name,
pointer->spriteInfo->spriteOwner = TRUE;
pointer->u.lastSlave = NULL;
+ pointer->last.slave = NULL;
pointer->isMaster = master;
keyboard = AddInputDevice(client, CoreKeyboardProc, TRUE);
@@ -2389,6 +2402,7 @@ AllocDevicePair (ClientPtr client, char* name,
keyboard->spriteInfo->spriteOwner = FALSE;
keyboard->u.lastSlave = NULL;
+ keyboard->last.slave = NULL;
keyboard->isMaster = master;
diff --git a/dix/getevents.c b/dix/getevents.c
index 652bd6758..e40b3dbe9 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -199,10 +199,10 @@ CreateClassesChangedEvent(EventList* event,
dce->length = sizeof(DeviceChangedEvent);
dce->type = ET_DeviceChanged;
dce->time = ms;
- if (master->u.lastSlave)
+ if (master->last.slave)
{
dce->flags |= DEVCHANGE_HAS_OLD_SLAVE;
- dce->old_slaveid = master->u.lastSlave->id;
+ dce->old_slaveid = master->last.slave->id;
}
dce->flags |= DEVCHANGE_HAS_NEW_SLAVE;
dce->new_slaveid = slave->id;
@@ -294,7 +294,7 @@ updateSlaveDeviceCoords(DeviceIntPtr master, DeviceIntPtr pDev)
* slave-device. If the old slave had less axes than this one,
* last.valuators is reset to 0.
*/
- if ((lastSlave = master->u.lastSlave) && lastSlave->valuator) {
+ if ((lastSlave = master->last.slave) && lastSlave->valuator) {
for (i = 2; i < pDev->valuator->numAxes; i++) {
if (i >= lastSlave->valuator->numAxes)
pDev->last.valuators[i] = 0;
@@ -612,11 +612,11 @@ static EventListPtr
updateFromMaster(EventListPtr events, DeviceIntPtr dev, int *num_events)
{
DeviceIntPtr master = dev->u.master;
- if (master && master->u.lastSlave != dev)
+ if (master && master->last.slave != dev)
{
CreateClassesChangedEvent(events, master, dev);
updateSlaveDeviceCoords(master, dev);
- master->u.lastSlave = dev;
+ master->last.slave = dev;
master->last.numValuators = dev->last.numValuators;
(*num_events)++;
events++;