[comp.windows.x] problem using XGrabKeyboard under X11.2

u-jmolse%sunset.utah.edu@utah-cs.UUCP (John M. Olsen) (08/19/88)

I've written a small menu system which uses lots of windows as buttons
used to select various features.  (Ugly, but useful)  I have a window which
is used for entering a string, and when I click in that window I use 
XGrabKeyboard when I get a button up event in that window so I don't have 
to leave the mouse pointer on top of what I'm typing.

The problem occurs when I move the pointer just after letting the button
up.  It grabs the keyboard and attaches it to the wrong window.  I tried
putting the keyboard grab and free inside a pointer grab and free, and it
attaches the pointer to the window just fine, but still messes up which
window the keyboard should be hooked to.

I've noticed it only goes weird when I do the XGrabKeyboard when I have 
events pending.

Does this sound like a problem with XGrabKeyboard, my code, or just a
hallucination?  Anyone who wants to look at the code itself, let me know
and I can email a few pieces.  Here's how I called it:

i=XGrabKeyboard(dpy, sel->win, 1, GrabModeSync, GrabModeAsync, CurrentTime);

Any help or pointers to help would be appreciated.  I don't regularly read
this group, so mail is preferred to follow-ups.

 /|  |     /|||  /\|       | John M. Olsen, 1547 Jamestown Drive
 \|()|\|\_  |||. \/|/)@|\_ | Salt Lake City, UT  84121-2051     
  |	u-jmolse%ug@cs.utah.edu or ...!utah-cs!utah-ug!u-jmolse
	"...if cows ate plankton whales would die off." Randy Meyers