|
From: Ping C. <pin...@gm...> - 2010-05-20 20:22:59
|
I am not familiar with the xf86-input-wacom/tools/xsetwacom.c code.
And , I don't have time to read through the file to see the whole
picture. So, just throw a wild question at you to see if it hits
anything or not :).
Ping
On Wed, May 19, 2010 at 10:07 PM, Peter Hutterer
<pet...@wh...> wrote:
> Currently only PressCurve but I guess we'll have more of those soon.
>
> Signed-off-by: Peter Hutterer <pet...@wh...>
> ---
> tools/xsetwacom.c | 29 +++++++++++++++++++++++++++++
> 1 files changed, 29 insertions(+), 0 deletions(-)
>
> diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c
> index 59602b4..e1f2753 100644
> --- a/tools/xsetwacom.c
> +++ b/tools/xsetwacom.c
> @@ -945,6 +945,28 @@ static XDevice* find_device(Display *display, char *name)
> return dev;
> }
>
> +/* Return True if the given device has the property, or False otherwise */
> +static Bool test_property(Display *dpy, XDevice* dev, Atom prop)
> +{
> + int nprops_return;
> + Atom *properties;
> + int found = False;
> +
> + properties = XListDeviceProperties(dpy, dev, &nprops_return);
> +
> + while(nprops_return--)
> + {
> + if (properties[nprops_return] == prop)
> + {
> + found = True;
> + break;
> + }
> + }
> +
> + XFree(properties);
> + return found;
> +}
> +
> static void list_one_device(Display *dpy, XDeviceInfo *info)
> {
> static int wacom_prop = 0;
> @@ -1871,6 +1893,13 @@ static void get_presscurve(Display *dpy, XDevice *dev, param_t *param, int argc,
>
> TRACE("Getting pressure curve for device %ld.\n", dev->device_id);
>
> + if (!test_property(dpy, dev, prop))
> + {
> + fprintf(stderr, "Property '%s' does not exist on device.\n",
> + param->prop_name);
> + return;
> + }
> +
Don't we also need this chunk of code inside set(Display *dpy, int
argc, char **argv) and get_param() before the XGetDeviceProperty call?
I would think they would cover more properties.
> XGetDeviceProperty(dpy, dev, prop, 0, 1000, False, AnyPropertyType,
> &type, &format, &nitems, &bytes_after, &data);
>
> --
> 1.7.0.1
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Linuxwacom-devel mailing list
> Lin...@li...
> https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
>
|