You basically have 2 options:
Option 1
Call the regular XI*
Xinput2 functions and poll them in your event loop with a generic event. A event loop would probably look like similar to this:
xcb_generic_event_t *event;
while ((event = xcb_wait_for_event(connection))) {
xcb_ge_generic_event_t *generic_event = (xcb_ge_generic_event_t*)event;
if (generic_event->response_type == XCB_GE_GENERIC && generic_event->extension == xinput_ext_opcode && generic_event->event_type == XI_RawMotion) {
// Handle motion
continue;
}
}
Also take a look at the XCB Protocol Extension API.
Option 2
You can use the xcb_input_*
xcb-xinput extension functions. According to the official documentation:
When XCB added its API style to the mix, it followed the newer style and created a "libxcb"-prefixed library for each extension---libxcb-composite, libxcb-render, etc. Since XCB can generates the API code for an extension automatically from an XML description of the extension protocol, new extension API's are created by simply adding the extension description to the xcb-proto package and rebuilding.
Take a look at the xinput.h
header.