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.
bool MainWindow::x11Event(XEvent * e)
{
XEvent ev = *e;
XGenericEventCookie *cookie = &ev.xcookie; //&e->xcookie;
if(cookie->type != GenericEvent || cookie->extension != xi_opcode || !XGetEventData(dpy, cookie) ){
printf("No GenericEvent Type is found in X11Event, return ******************* \n");
return false;
}
printf("EVENT TYPE %d \n", cookie->evtype);
switch(cookie->evtype){
case XI_RawMotion:
print_rawmotion((XIRawEvent *)cookie->data);
break;
case XI_Enter:
case XI_Leave:
print_enterleaveevent((XIEnterEvent *)cookie->data);
break;
default:
print_deviceEvent((XIDeviceEvent *)cookie->data);
break;
}
return false;
}
bool MainWindow::x11Event(XEvent * e)
{
XEvent ev = *e;
XGenericEventCookie *cookie = &ev.xcookie; //&e->xcookie;
if(cookie->type != GenericEvent || cookie->extension != xi_opcode || !XGetEventData(dpy, cookie) ){
printf("No GenericEvent Type is found in X11Event, return ******************* \n");
return false;
}
printf("EVENT TYPE %d \n", cookie->evtype);
switch(cookie->evtype){
case XI_RawMotion:
print_rawmotion((XIRawEvent *)cookie->data);
break;
case XI_Enter:
case XI_Leave:
print_enterleaveevent((XIEnterEvent *)cookie->data);
break;
default:
print_deviceEvent((XIDeviceEvent *)cookie->data);
break;
}
return false;
}
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
Bookmarks