[PATCH xinput] Handle XA_CARDINAL as property type

Chase Douglas chase.douglas at canonical.com
Tue Feb 21 03:29:02 PST 2012


On 02/21/2012 02:57 AM, Peter Hutterer wrote:
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
>  src/property.c |   32 ++++++++++++++++++++++++++++++--
>  1 files changed, 30 insertions(+), 2 deletions(-)
> 
> diff --git a/src/property.c b/src/property.c
> index 7723445..3ab2cb0 100644
> --- a/src/property.c
> +++ b/src/property.c
> @@ -97,6 +97,20 @@ print_property(Display *dpy, XDevice* dev, Atom property)
>                              break;
>                      }
>                      break;
> +                case XA_CARDINAL:
> +                    switch(act_format)
> +                    {
> +                        case 8:
> +                            printf("%u", *((unsigned char*)ptr));
> +                            break;
> +                        case 16:
> +                            printf("%u", *((unsigned short*)ptr));
> +                            break;
> +                        case 32:
> +                            printf("%lu", *((unsigned long*)ptr));
> +                            break;
> +                    }
> +                    break;
>                  case XA_STRING:
>                      if (act_format != 8)
>                      {
> @@ -353,7 +367,7 @@ do_set_prop_xi1(Display *dpy, Atom type, int format, int argc, char **argv, char
>  
>      for (i = 0; i < nelements; i++)
>      {
> -        if (type == XA_INTEGER) {
> +        if (type == XA_INTEGER || type == XA_CARDINAL) {
>              switch (format)
>              {
>                  case 8:
> @@ -443,6 +457,20 @@ print_property_xi2(Display *dpy, int deviceid, Atom property)
>                              break;
>                      }
>                      break;
> +                case XA_CARDINAL:
> +                    switch(act_format)
> +                    {
> +                        case 8:
> +                            printf("%u", *((uint8_t*)ptr));
> +                            break;
> +                        case 16:
> +                            printf("%u", *((uint16_t*)ptr));
> +                            break;
> +                        case 32:
> +                            printf("%u", *((uint32_t*)ptr));
> +                            break;
> +                    }
> +                    break;
>                  case XA_STRING:
>                      if (act_format != 8)
>                      {
> @@ -626,7 +654,7 @@ do_set_prop_xi2(Display *dpy, Atom type, int format, int argc, char **argv, char
>  
>      for (i = 0; i < nelements; i++)
>      {
> -        if (type == XA_INTEGER) {
> +        if (type == XA_INTEGER || type == XA_CARDINAL) {
>              switch (format)
>              {
>                  case 8:

I don't really know what XA_CARDINAL means. Where is it defined.

-- Chase


More information about the xorg-devel mailing list