Receiving EnterNotify event that should be prohibited by event mask
Submitted by Rouslan
Assigned to Peter Hutterer @whot
Description
Created attachment 120406 demonstration of problem
If a window is created and opts to receive XI_ButtonPress events, but not EnterNotify or LeaveNotify events (i.e. does not use EnterWindowMask or LeaveWindowMask), it will still receive EnterNotify events if the user presses and holds a mouse button on the window, drags the cursor out of the window and then drags it back in. This only happens while a mouse button is down, and corresponding LeaveNotify events are not sent. Curiously, calling XIGrabDevice in response to a button press will suppress this behaviour.
The attached source code demonstrates this problem. When dragging the cursor in and out of the window, the program will print "EnterNotify!" to standard out, which can only happen when an EnterNotify event is received, but XSetWindowAttributes::event_mask is set to zero.
It can be compiled with:
gcc -o test -lX11 -lXi test.c
Attachment 120406, "demonstration of problem":
test.c
Version: 7.7 (2012.06)