]> diplodocus.org Git - xorg-xinput/commitdiff
Handle XA_CARDINAL as property type
authorPeter Hutterer <peter.hutterer@who-t.net>
Tue, 21 Feb 2012 01:57:19 +0000 (11:57 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Thu, 23 Feb 2012 00:42:02 +0000 (10:42 +1000)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
src/property.c

index 7723445f22659eaa8c3efc0f6f6716425fdee274..3ab2cb0d7b5a9ed93f05ba707cdab6c741e0679d 100644 (file)
@@ -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: