Receiving EnterNotify event that should be prohibited by event mask

Rouslan Korneychuk rouslank at
Sat Dec 5 21:36:27 PST 2015

Forgive me if this is not the right place to ask this.

I have  a program with a single window that uses XInput2 for mouse input. I set the event_mask field of the XSetWindowAttributes struct to "ExposureMask | StructureNotifyMask | KeymapStateMask | KeyPressMask | KeyReleaseMask", so I expect to not receive any EnterNotify or LeaveNotify events, yet if I press and hold a mouse button on my window, move the cursor out of the window and then back into the window, I get an EnterNotify event (the only reason the program even listens for these events is for compatibility with operating systems that don't have XInput2). I only get EnterNotify events, not LeaveNotify, and I only get them while holding a mouse button down. Curiously, this behaviour goes away if I call XIGrabDevice in response to a button press.

My question is: why does this happen? This looks like a bug and this issue is trivial to work around (I only even noticed because of an "assert" statement I added), but I want to make sure this isn't caused by me doing something wrong.

More information about the xorg mailing list