Some highly configurable pointing devices also act as keyboards.

For consistency with other commands, use xi2_find_device_info .

As the build already fails without XInput2, not making conditional on
the HAVE_XI macro.  Suggest removing it, in fact.
---
 src/buttonmap.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/buttonmap.c b/src/buttonmap.c
index 3396e75..2089a2d 100644
--- a/src/buttonmap.c
+++ b/src/buttonmap.c
@@ -95,7 +95,7 @@ set_button_map(Display        *display,
               char     *name,
               char     *desc)
 {
-    XDeviceInfo                *info;
+    XIDeviceInfo       *info;
     XDevice            *device;
     XAnyClassPtr       ip;
     int                        i;
@@ -106,20 +106,19 @@ set_button_map(Display    *display,
        return EXIT_FAILURE;
     }
 
-    info = find_device_info(display, argv[0], False);
+    info = xi2_find_device_info(display, argv[0]);
 
     if (!info) {
        fprintf(stderr, "unable to find device '%s'\n", argv[0]);
        return EXIT_FAILURE;
     }
 
-    ip = (XAnyClassPtr) info->inputclassinfo;
     nbuttons = 0;
 
     /* try to find the number of buttons */
     for(i=0; i<info->num_classes; i++) {
-       if (ip->class == ButtonClass) {
-           nbuttons = ((XButtonInfoPtr)ip)->num_buttons;
+       if (info->classes[i]->type == XIButtonClass) {
+           nbuttons = ((XIButtonClassInfo*)info->classes[i])->num_buttons;
            break;
        }
        ip = (XAnyClassPtr) ((char *) ip + ip->length);
@@ -129,7 +128,7 @@ set_button_map(Display      *display,
        return EXIT_FAILURE;
     }
 
-    device = XOpenDevice(display, info->id);
+    device = XOpenDevice(display, info->deviceid);
     if (device) {
        int             idx;
        unsigned char   *map;
-- 
2.35.3

Reply via email to