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 <daniel@fooishbar.org>
(cherry picked from commit 627b09e5bd)
This commit is contained in:
Daniel Stone
2011-06-14 17:07:11 +01:00
committed by Peter Hutterer
parent a85e2926b5
commit 75550077e6

View File

@@ -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)
{