aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/dix
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-05-26 07:52:44 +0000
committermarha <marha@users.sourceforge.net>2010-05-26 07:52:44 +0000
commitd2ae79d77679ccfc02ef5b8e42c16d398d874464 (patch)
tree1d566cb7bc73279e52671d2529bff1905148a32b /xorg-server/dix
parent74fa9a70a4817660f1c2ec3b3cc2bbe56db4fc58 (diff)
downloadvcxsrv-d2ae79d77679ccfc02ef5b8e42c16d398d874464.tar.gz
vcxsrv-d2ae79d77679ccfc02ef5b8e42c16d398d874464.tar.bz2
vcxsrv-d2ae79d77679ccfc02ef5b8e42c16d398d874464.zip
xserver git update 26/5/2010
Diffstat (limited to 'xorg-server/dix')
-rw-r--r--xorg-server/dix/devices.c2
-rw-r--r--xorg-server/dix/inpututils.c79
2 files changed, 80 insertions, 1 deletions
diff --git a/xorg-server/dix/devices.c b/xorg-server/dix/devices.c
index 85a008004..e64b8ed56 100644
--- a/xorg-server/dix/devices.c
+++ b/xorg-server/dix/devices.c
@@ -891,7 +891,7 @@ CloseDeviceList(DeviceIntPtr *listHead)
while (dev != NULL)
{
freedIds[dev->id] = TRUE;
- DeleteInputDeviceRequest(dev);
+ DeleteInputDeviceRequest(dev, DEVICE_REMOVE_ALL);
dev = *listHead;
while (dev != NULL && freedIds[dev->id])
diff --git a/xorg-server/dix/inpututils.c b/xorg-server/dix/inpututils.c
index d2d36bd95..6d730be2d 100644
--- a/xorg-server/dix/inpututils.c
+++ b/xorg-server/dix/inpututils.c
@@ -331,3 +331,82 @@ int generate_modkeymap(ClientPtr client, DeviceIntPtr dev,
return Success;
}
+
+/**
+ * Duplicate the InputAttributes in the most obvious way.
+ * No special memory handling is used to give drivers the maximum
+ * flexibility with the data. Drivers should be able to call realloc on the
+ * product string if needed and perform similar operations.
+ */
+InputAttributes*
+DuplicateInputAttributes(InputAttributes *attrs)
+{
+ InputAttributes *new_attr;
+ int ntags = 0;
+ char **tags, **new_tags;
+
+ if (!attrs)
+ return NULL;
+
+ if (!(new_attr = calloc(1, sizeof(InputAttributes))))
+ goto unwind;
+
+ if (attrs->product && !(new_attr->product = strdup(attrs->product)))
+ goto unwind;
+ if (attrs->vendor && !(new_attr->vendor = strdup(attrs->vendor)))
+ goto unwind;
+ if (attrs->device && !(new_attr->device = strdup(attrs->device)))
+ goto unwind;
+
+ new_attr->flags = attrs->flags;
+
+ if ((tags = attrs->tags))
+ {
+ while(*tags++)
+ ntags++;
+
+ new_attr->tags = calloc(ntags + 1, sizeof(char*));
+ if (!new_attr->tags)
+ goto unwind;
+
+ tags = attrs->tags;
+ new_tags = new_attr->tags;
+
+ while(*tags)
+ {
+ *new_tags = strdup(*tags);
+ if (!*new_tags)
+ goto unwind;
+
+ tags++;
+ new_tags++;
+ }
+ }
+
+ return new_attr;
+
+unwind:
+ FreeInputAttributes(new_attr);
+ return NULL;
+}
+
+void
+FreeInputAttributes(InputAttributes *attrs)
+{
+ char **tags;
+
+ if (!attrs)
+ return;
+
+ free(attrs->product);
+ free(attrs->vendor);
+ free(attrs->device);
+
+ if ((tags = attrs->tags))
+ while(*tags)
+ free(*tags++);
+
+ free(attrs->tags);
+ free(attrs);
+}
+