From 627b09e5bd0726ad31bfeb4f07b8f8287d8ec46f Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Tue, 14 Jun 2011 17:07:11 +0100 Subject: [PATCH] Properties: Generalise InitTypedAtom from InitAtom Add InitTypedAtom, which does exactly the same thing as InitAtom, but takes an additional type argument. Signed-off-by: Daniel Stone --- src/properties.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/properties.c b/src/properties.c index 299a444..f5f78e3 100644 --- a/src/properties.c +++ b/src/properties.c @@ -96,7 +96,8 @@ Atom prop_product_id = 0; Atom prop_device_node = 0; static Atom -InitAtom(DeviceIntPtr dev, char *name, int format, int nvalues, int *values) +InitTypedAtom(DeviceIntPtr dev, char *name, Atom type, int format, int nvalues, + int *values) { int i; Atom atom; @@ -124,13 +125,18 @@ InitAtom(DeviceIntPtr dev, char *name, int format, int nvalues, int *values) } atom = MakeAtom(name, strlen(name), TRUE); - XIChangeDeviceProperty(dev, atom, XA_INTEGER, format, - PropModeReplace, nvalues, + XIChangeDeviceProperty(dev, atom, type, format, PropModeReplace, nvalues, converted, FALSE); XISetDevicePropertyDeletable(dev, atom, FALSE); return atom; } +static Atom +InitAtom(DeviceIntPtr dev, char *name, int format, int nvalues, int *values) +{ + return InitTypedAtom(dev, name, XA_INTEGER, format, nvalues, values); +} + static Atom InitFloatAtom(DeviceIntPtr dev, char *name, int nvalues, float *values) {