diff options
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 ca3852a28..8134c4d77 100644 --- a/xorg-server/dix/getevents.c +++ b/xorg-server/dix/getevents.c @@ -304,7 +304,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,
|