das15@cunixa.cc.columbia.edu (Douglas A Scott) (04/30/91)
How can a force a newly mapped window to receive an EnterNotify event? I need to do this so that my program can tell which of a possible large number of windows is the currently "selected" one. I have tried mapping it, flushing all the events (to be sure it is actually visible) and then doing an XWarpPointer() into the window, but it is not generating the event I need. If this *should* be doing it, it is possible that it is this X server on my NeXT that is the problem, but I wanted to be sure there was a standard way to generate such an event. Thanks! <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Douglas Scott Columbia University Computer Music Studio Internet: <doug@woof.columbia.edu> <das15@cunixa.cc.columbia.edu> UUCP: ...!columbia!woof!zardoz!doug Phone: (703)765-4771
Stuart.Marks@eng.sun.COM (Stuart Marks) (05/01/91)
das15@cunixa.cc.columbia.edu (Douglas A Scott) wrote:
How can a force a newly mapped window to receive an EnterNotify event?
The only thing you really need to do is to make sure that the window has
selected for the event before it gets mapped. If you map a window and, as
a result of this action, the pointer ends up in the window, you should get
an EnterNotify event.
I need to do this so that my program can tell which of a possible large
number of windows is the currently "selected" one.
I don't know what your application requires, but the "selected" window may
not necessarily be the one under the pointer. Perhaps you should be
tracking the input focus (using FocusIn and FocusOut events) instead.
I have tried
mapping it, flushing all the events (to be sure it is actually visible)
and then doing an XWarpPointer() into the window, but it is not
generating the event I need.
Please don't warp the pointer around. There should be no need to warp the
pointer to generate the EnterNotify event. It's also almost always a bad
idea, but that point has already been belabored on this list.
If this *should* be doing it, it is
possible that it is this X server on my NeXT that is the problem, but I
wanted to be sure there was a standard way to generate such an event.
I'm not familiar with the NeXT X server. It's possible that there is a
server bug. Write a simple test program that selects for crossing events
and then maps the window such that the pointer ends up in the window. The
program should get the EnterNotify event. If it doesn't, it's probably a
server bug. Try it on a different server.
s'marks
Stuart W. Marks ARPA: smarks@eng.sun.com
Windows & Graphics Software UUCP: sun!smarks
Sun Microsystems, Inc.