XI_Leave missing
Artem Ananiev
Artem.Ananiev at Sun.COM
Tue Mar 2 05:55:46 PST 2010
Hi, Peter,
following your suggestion, I have verified `xinput --test-xi2` works
correctly and reports all the XI_Leave events. After another half an
hour I have finally found the problem: the eventmask.mask was too small,
so XI_Leave (which corresponds to 1 << 8) was skipped, while XI_Enter (1
<< 7) was handled fine.
Thanks,
Artem
On 3/2/2010 7:26 AM, Peter Hutterer wrote:
> 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
> _______________________________________________
> xorg-devel mailing list
> xorg-devel at lists.x.org
> http://lists.x.org/mailman/listinfo/xorg-devel
More information about the xorg-devel
mailing list