summaryrefslogtreecommitdiff
path: root/Xi
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2006-08-07 23:02:17 +0300
committerDaniel Stone <daniels@endtroducing.fooishbar.org>2006-08-07 23:02:17 +0300
commit458c63a84110f64c7fce397a531a3a779c2239a2 (patch)
treeb4a244a1ee5e13e600492ce9c9847a9b6edac8db /Xi
parenta31d11a7a8485cdc799f76c4d407d3b7f7c9b350 (diff)
enable adding devices after removal of a middle device
Allow new devices to be added after a device that _wasn't_ the last on the list was removed, by ensuring inputInfo.numDevices always increases, and never decreases.
Diffstat (limited to 'Xi')
-rw-r--r--Xi/listdev.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/Xi/listdev.c b/Xi/listdev.c
index 91e8f2254..02d55ad4c 100644
--- a/Xi/listdev.c
+++ b/Xi/listdev.c
@@ -96,7 +96,7 @@ int
ProcXListInputDevices(register ClientPtr client)
{
xListInputDevicesReply rep;
- int numdevs;
+ int numdevs = 0;
int namesize = 1; /* need 1 extra byte for strcpy */
int size = 0;
int total_length;
@@ -115,12 +115,15 @@ ProcXListInputDevices(register ClientPtr client)
rep.sequenceNumber = client->sequence;
AddOtherInputDevices();
- numdevs = inputInfo.numDevices;
- for (d = inputInfo.devices; d; d = d->next)
+ for (d = inputInfo.devices; d; d = d->next) {
SizeDeviceInfo(d, &namesize, &size);
- for (d = inputInfo.off_devices; d; d = d->next)
+ numdevs++;
+ }
+ for (d = inputInfo.off_devices; d; d = d->next) {
SizeDeviceInfo(d, &namesize, &size);
+ numdevs++;
+ }
total_length = numdevs * sizeof(xDeviceInfo) + size + namesize;
devbuf = (char *)xalloc(total_length);