Goal is to capture the XI2 event for multiple cursor( for different mouse/keyboard)
Here's some relevant code. (I've check the has_xi2 for my display, and set the event mask in the MainWindow's constructor.
Qt Code:
  1. bool MainWindow::x11Event(XEvent * e)
  2. {
  3. XEvent ev = *e;
  4. XGenericEventCookie *cookie = &ev.xcookie; //&e->xcookie;
  5. if(cookie->type != GenericEvent || cookie->extension != xi_opcode || !XGetEventData(dpy, cookie) ){
  6. printf("No GenericEvent Type is found in X11Event, return ******************* \n");
  7. return false;
  8. }
  9. printf("EVENT TYPE %d \n", cookie->evtype);
  10. switch(cookie->evtype){
  11. case XI_RawMotion:
  12. print_rawmotion((XIRawEvent *)cookie->data);
  13. break;
  14. case XI_Enter:
  15. case XI_Leave:
  16. print_enterleaveevent((XIEnterEvent *)cookie->data);
  17. break;
  18. default:
  19. print_deviceEvent((XIDeviceEvent *)cookie->data);
  20. break;
  21. }
  22. return false;
  23. }
To copy to clipboard, switch view to plain text mode 

If needed, I can send more code to your email.

BTW, what do you mean that the event is native. would you please show me the document you've seen?

Thanks