src/test/sysdep/linux/input.c
static int xinput2_master_pointer(void)
{
    __typeof__(XIQueryDevice) *p_XIQueryDevice =
        dlsym(RTLD_NEXT, "XIQueryDevice");
    __typeof__(XIFreeDeviceInfo) *p_XIFreeDeviceInfo =
        dlsym(RTLD_NEXT, "XIFreeDeviceInfo");
    ASSERT(p_XIQueryDevice);
    ASSERT(p_XIFreeDeviceInfo);

    int num_devices = 0;
    XIDeviceInfo *devices = (*p_XIQueryDevice)(
        linux_x11_display(), XIAllMasterDevices, &num_devices);
    if (!devices) {
        return 0;
    }

    int deviceid = 0;
    for (int i = 0; i < num_devices; i++) {
        if (devices[i].use == XIMasterPointer) {
            deviceid = devices[i].deviceid;
            break;
        }
    }

    (*p_XIFreeDeviceInfo)(devices);
    return deviceid;
}
/**
 * xinput2_master_pointer:  Return the XInput2 device ID of the master
 * pointer device, for use in synthesized XInput2 events.  Assumes that
 * XInput2 is available.
 */
Return the XInput2 device ID of the master
pointer device, for use in synthesized XInput2 events.  Assumes that
XInput2 is available.
Return the XInput2 device ID of the master pointer device for use in synthesized XInput2 events . Assumes that XInput2 is available .
static int xinput2_master_pointer(void)
{
    __typeof__(XIQueryDevice) *p_XIQueryDevice =
        dlsym(RTLD_NEXT, "XIQueryDevice");
    __typeof__(XIFreeDeviceInfo) *p_XIFreeDeviceInfo =
        dlsym(RTLD_NEXT, "XIFreeDeviceInfo");
    ASSERT(p_XIQueryDevice);
    ASSERT(p_XIFreeDeviceInfo);
    int num_devices = 0;
    XIDeviceInfo *devices = (*p_XIQueryDevice)(
        linux_x11_display(), XIAllMasterDevices, &num_devices);
    if (!devices) {
        return 0;
    }
    int deviceid = 0;
    for (int i = 0; i < num_devices; i++) {
        if (devices[i].use == XIMasterPointer) {
            deviceid = devices[i].deviceid;
            break;
        }
    }
    (*p_XIFreeDeviceInfo)(devices);
    return deviceid;
}
static int xinput2_master_pointer ( void ) { __typeof__ ( XIQueryDevice ) * p_XIQueryDevice = dlsym ( RTLD_NEXT , " " ) ; __typeof__ ( XIFreeDeviceInfo ) * p_XIFreeDeviceInfo = dlsym ( RTLD_NEXT , " " ) ; ASSERT ( p_XIQueryDevice ) ; ASSERT ( p_XIFreeDeviceInfo ) ; int num_devices = 0 ; XIDeviceInfo * devices = ( * p_XIQueryDevice ) ( linux_x11_display ( ) , XIAllMasterDevices , & num_devices ) ; if ( ! devices ) { return 0 ; } int deviceid = 0 ; for ( int i = 0 ; i < num_devices ; i ++ ) { if ( devices [ i ] . use == XIMasterPointer ) { deviceid = devices [ i ] . deviceid ; break ; } } ( * p_XIFreeDeviceInfo ) ( devices ) ; return deviceid ; }
xinput2_master_pointer:  Return the XInput2 device ID of the master
 pointer device, for use in synthesized XInput2 events.
xinput2_master_pointer : Return the XInput2 device ID of the master pointer device for use in synthesized XInput2 events .