[Mono-winforms-list] [Patch] Check for EnterNotify events

Carlos Alberto Cortez calberto.cortez at gmail.com
Fri Aug 15 10:08:08 EDT 2008


The attached patch adds a static field to XplatUIX11 to detect if the
window receiving the EnterNotify event is actually the one having the
pointer within its bounds. For normal motion events, the code we have
right now is just fine.

But we need this special check when grabbing. When grabbing a window by
pressing the left button of the mouse and holding it, we are receiving:

1. LeaveNotify events for the control being grabbed and all its
containers, with mode param as NotifyGrab.
2. EnterNotify events are generated for each of the containers of the
Control, and finally, the control itself gets a new EnterNotify with
mode param as NotifyUngrab (and this is why in the patch we ignore if
mode param is NotifyUngrab).
3. If the pointer , still grabbed, moves to a different control, when
the button is released, we get a EnterNotify event with mode param as
NotifyUngrab for the  new control.

As you see, in both steps 2 and 3 we get the same event with the same
mode param, but for case 2 we don't need to actually handle the event,
since we are already within the control bounds (as well as all of its
containers). But for step 3 we *do need* it.

That's why I added a field to check the actual last window containing
the pointer against the window receiving the EnterNotify event, and if
it's a different one, try to detect if a child contains it - in which
case we are already there and don't need to handle the event.

I hope the explanation is clear - I needed it to understand the problem,
and hopefully will make things clear to review it ;-)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: xplat-enternotify.patch
Type: text/x-patch
Size: 1604 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-winforms-list/attachments/20080815/e48bf984/attachment.bin 

More information about the Mono-winforms-list mailing list