XI_Leave missing

Peter Hutterer peter.hutterer at who-t.net
Mon Mar 1 20:26:01 PST 2010


On Sat, Feb 27, 2010 at 04:00:08PM +0300, Artem Ananiev wrote:
> Hello,
> 
> with a simple test - see the code snippet below - I successfully
> receive XI_Enter notifications for my window, but XI_Leave are
> missed. Are there any problems with the test, or something else is
> wrong?
> 
> ----
> 
>   display = XOpenDisplay(NULL);
> 
>   root = RootWindow(display, 0);
>   window = XCreateSimpleWindow(display, root,
>                                100, 100, 320, 240,
>                                BlackPixel(display, 0),
>                                WhitePixel(display, 0));
> 
>   eventmask.deviceid = XIAllMasterDevices;
>   eventmask.mask_len = sizeof(mask);
>   eventmask.mask = mask;
> 
>   XISetMask(mask, XI_Enter);
>   XISetMask(mask, XI_Leave);
>   XISelectEvents(display, window, &eventmask, 1);
> 
>   XMapWindow(display, window);
>   XSync(display, True);
> 
>   while (1) {
>     XNextEvent(display, &xev);
>     if ((xev.xcookie.type == GenericEvent) &&
>         (xev.xcookie.extension == xinput_opcode) &&
>         XGetEventData(display, &xev.xcookie)) {
>       switch (xev.xcookie.evtype) {
>         case XI_Enter:
>           fprintf(stderr, "XI_Enter\n");
>           break;
>         case XI_Leave:
>           fprintf(stderr, "XI_Leave\n");
>           break;
>       }
>       XFreeEventData(display, &xev.xcookie);
>     }
>   }
> 
> ----
> 
> The problem is reproducible both with a single master device and
> with multiple ones. If I modify the test to listen for regular
> EnterNotify and LeaveNotify, these are received correctly (but
> XI_Leave is still missed).

weird. I copy/pasted your code (no changes, just added the missing
declarations and one missing param to XCreateSimpleWindow) I'm getting
events just as required.

do you see enter/leave events with "xinput --test-xi2"?
is the value of xinput_opcode off by any chance? try to hardcode it, you can
get the value from "xdpyinfo -ext XInputExtension | grep opcode"
 
Cheers,
  Peter


More information about the xorg-devel mailing list