Not receiving XI_RawMotion events while mouse button is pressed.

Peter Hutterer peter.hutterer at
Tue May 10 16:13:34 PDT 2011

On Tue, May 10, 2011 at 01:56:19PM -0500, Roger Cruz wrote:
> I have integrated libxi2's capability to provide raw motion pointer values
> into my application which was originally using (and still uses) xinput
> events.  The application currently registers for the old xinput events
> using XSelectInput.  
> 	XSelectInput(xs->dpy, xs->w, event_mask);
> where the event mask is
> 	event_mask = (OwnerGrabButtonMask << 1) - 1;	/* all events */
> 	event_mask &= ~PointerMotionHintMask;
> 	event_mask &= ~PropertyChangeMask;
> 	event_mask &= ~ColormapChangeMask;
> 	event_mask &= ~SubstructureNotifyMask;
> I added an additional xinput2 registration to only capture the raw motion events which I needed.
> 	XISetMask(eventmask->mask, XI_RawMotion);
> 	XISelectEvents(xs->dpy, DefaultRootWindow(xs->dpy), eventmask, 1);
> This appears to be working fine.  I get raw motion and mouse button press
> and releases when done independently.  However, when I click to drag, I
> only get the button press event but not the raw motion events.  Is this
> expected behavior for the current implementation of libxi?  I need to be
> able to get raw motion events even when the button is pressed.  I don't
> believe anyone else is grabbing the pointer.

If the button press event is delivered somewhere, this activated an implicit
grab in the server and the device is now grabbed by that client that
received the button press event. I suspect this is the cause here too.

Furthermore, XI and XI2 grabs are handled separately, so if you get a XI1
grab, it does not carry the XI2 event mask. Your raw event is thus not
delivered once you have an XI grab.


More information about the xorg-devel mailing list