[comp.windows.x] Pointer grab and LeaveNotify events

dave@romano.cs.wisc.edu (Dave Cohrs) (05/12/89)

I used to think it was just the toolkit, but now I see it's
a general problem...

Environment:
	X.V11R3
	on either a Sun or a VS3200 under various OS versions

It appears that when the Pointer is grabbed, the server forgets to
send clients LeaveNotify events when the pointer leaves the client's
window.

For example:
  - start up xmh, move the mouse into a Command widget.
  - Now, I run twm, and have Meta<Btn3Down> mapped to pop up
    a menu.  This causes the a XGrabPointer().
  - move the mouse out of the xmh window, and also out of the twm menu.
  - release the button.

Now, the menu goes away, but the Command widget stays highlighted.
This happens with other widgets and windows as well (for example, the
emacs text cursor remains highlighted given the same set of events).

However, the command widget is even more broken.  If I warp the pointer
out of my emacs window, the text cursor becomes an empty box.  But, if I
warp the pointer out of a Command widget, the widget is still
highlighted.

Any fixes?

dave cohrs
--
Dave Cohrs
+1 608 262-6617                        UW-Madison Computer Sciences Department
dave@cs.wisc.edu                       ...!{harvard,rutgers,ucbvax}!uwvax!dave

rws@EXPO.LCS.MIT.EDU (05/12/89)

    It appears that when the Pointer is grabbed, the server forgets to
    send clients LeaveNotify events when the pointer leaves the client's
    window.

It doesn't forget, the protocol doesn't allow it.  Actually, a LeaveNotify
event does get sent when the pointer gets grabbed, but the Intrinsics
discard them (don't ask me why, I don't know, I think it's a misfeature).
This Leave would be sufficient to "solve" the problem (I think you'll notice
that xterm "works", for some definition of "works").  All of this is
complicated by the fact that the protocol doesn't have Focus events sent on
pointer-based focus change; if it did, things would be easier.

steve@acorn.co.uk (Steve "Daffy" Hunt) (05/15/89)

In article <8905112217.AA00444@expire.lcs.mit.edu> rws@EXPO.LCS.MIT.EDU writes:
>
>    It appears that when the Pointer is grabbed, the server forgets to
>    send clients LeaveNotify events when the pointer leaves the client's
>    window.
>
>It doesn't forget, the protocol doesn't allow it.  Actually, a LeaveNotify
>event does get sent when the pointer gets grabbed, but the Intrinsics
>discard them (don't ask me why, I don't know, I think it's a misfeature).


Yes indeed.  The following piece of code was spotted languishing in
Xt/TMstate.c:-

	static void _XtTranslateEvent (w, closure, event)
	    Widget w;
	    caddr_t closure;
	    register    XEvent * event;
	{
	[ stuff removed ... ]

	/* gross disgusting special case ||| */
	    if ((event->type == EnterNotify || event->type == LeaveNotify)
		&&( event->xcrossing.detail == NotifyInferior
		||  event->xcrossing.mode != NotifyNormal) )
		return;


Seems rather out of place amongst all that well crafted table-driven code!

Would the toolkit implementors care to comment on this?

-----
				Steve Hunt.