diff options
author | marha <marha@users.sourceforge.net> | 2010-02-05 12:56:11 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2010-02-05 12:56:11 +0000 |
commit | 7fe172c9035f56977209da12a7fd67d8badd71a2 (patch) | |
tree | b8e23664e5fefebcb80cc0657674db1b8c46ceba /xorg-server/dix | |
parent | 007385f704a99ab49dab0789f9c330a1a3a455be (diff) | |
download | vcxsrv-7fe172c9035f56977209da12a7fd67d8badd71a2.tar.gz vcxsrv-7fe172c9035f56977209da12a7fd67d8badd71a2.tar.bz2 vcxsrv-7fe172c9035f56977209da12a7fd67d8badd71a2.zip |
Git update 5/2/2010
Diffstat (limited to 'xorg-server/dix')
-rw-r--r-- | xorg-server/dix/devices.c | 44 | ||||
-rw-r--r-- | xorg-server/dix/getevents.c | 2 |
2 files changed, 34 insertions, 12 deletions
diff --git a/xorg-server/dix/devices.c b/xorg-server/dix/devices.c index 92b95ed69..b002150d0 100644 --- a/xorg-server/dix/devices.c +++ b/xorg-server/dix/devices.c @@ -877,13 +877,43 @@ CloseDevice(DeviceIntPtr dev) } /** + * Shut down all devices of one list and free all resources. + */ +static +void +CloseDeviceList(DeviceIntPtr *listHead) +{ + /* Used to mark devices that we tried to free */ + Bool freedIds[MAXDEVICES]; + DeviceIntPtr dev; + int i; + + if (listHead == NULL) + return; + + for (i = 0; i < MAXDEVICES; i++) + freedIds[i] = FALSE; + + dev = *listHead; + while (dev != NULL) + { + freedIds[dev->id] = TRUE; + DeleteInputDeviceRequest(dev); + + dev = *listHead; + while (dev != NULL && freedIds[dev->id]) + dev = dev->next; + } +} + +/** * Shut down all devices, free all resources, etc. * Only useful if you're shutting down the server! */ void CloseDownDevices(void) { - DeviceIntPtr dev, next; + DeviceIntPtr dev; /* Float all SDs before closing them. Note that at this point resources * (e.g. cursors) have been freed already, so we can't just call @@ -896,16 +926,8 @@ CloseDownDevices(void) dev->u.master = NULL; } - for (dev = inputInfo.devices; dev; dev = next) - { - next = dev->next; - DeleteInputDeviceRequest(dev); - } - for (dev = inputInfo.off_devices; dev; dev = next) - { - next = dev->next; - DeleteInputDeviceRequest(dev); - } + CloseDeviceList(&inputInfo.devices); + CloseDeviceList(&inputInfo.off_devices); CloseDevice(inputInfo.pointer); CloseDevice(inputInfo.keyboard); diff --git a/xorg-server/dix/getevents.c b/xorg-server/dix/getevents.c index bfde2e93f..82bb77b4b 100644 --- a/xorg-server/dix/getevents.c +++ b/xorg-server/dix/getevents.c @@ -296,7 +296,7 @@ updateSlaveDeviceCoords(DeviceIntPtr master, DeviceIntPtr pDev) &pDev->last.remainder[0], NULL, pDev->valuator->axes + 0, scr->width); if(pDev->valuator->numAxes > 1) pDev->last.valuators[1] = rescaleValuatorAxis(pDev->last.valuators[1], pDev->last.remainder[1], - &pDev->last.remainder[0], NULL, pDev->valuator->axes + 1, scr->height); + &pDev->last.remainder[1], NULL, pDev->valuator->axes + 1, scr->height); /* calculate the other axis as well based on info from the old * slave-device. If the old slave had less axes than this one, |