@begin(header)
author: ackerman@ics.uci.edu
show_author: ShowNone
author_organization: MIT
node_expert: 
expiration_date: 06/25/93
last_modifier: ackerman@ics.uci.edu
last_mod_date: 07/02/91
mod_num: 2
@end(header)
@begin(A)
Date: 11 May 89 18:01:14 GMT

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

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?
@end(Q)

@begin(A)
Date: Thu, 11 May 89 18:17:24 -0400
From: Bob Scheifler

    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.
@end(A)

@begin(M)
Date: 23 Jun 89 19:02:11 GMT
From: Phil Karlton
Organization: Silicon Graphics, Inc., Mountain View, CA

>Now I have a couple of different questions.  (1) Is the passive grab
>mechanism really working the way I think it is, and is that the way it
>is supposed to work, and (2) any ideas for how to fix this problem?  I
>am not sure why awm busy waits for the release event, but given that
>it does, my feeling is that awm should just do an active grab on the
>pointer to be sure that it gets that release event.  Comments?

(1) Yes and yes.

On page 381 of the Digital Press "X Window System" book it says (under the
description for UngrabPointer)

    An UngrabPointer request is performed automatically if the event
    window or confine-to window for an active pointer grab becomes not
    viewable or ...

(2) One thing awm could be doing is to grab the button syncronously, and
then "convert" the pointer grab to be asyncronous and relative to the root 
window by doing an appropriate GrabPointer call.

@end(M)






