I want to filter mouse motion events from a specific device. When these events are occurring I don't want the pointer to move, but I do want to execute some code to indicate to the user that the events are occuring.

But, there are actually two attached mice. I don't want to filter the events from any but the specified device.

I don't see a way to identify a device associated with an XEvent.

Is it possible to determine which device generated an event?