[comp.windows.x] events after an XWarpPointer

jthomas@nmsu.edu (James Thomas) (04/27/89)

(I'm using X11R3 on a Sun-3 with SunOS 3.5 .)

I have two label widgets on the screen.  The first has separate routines
XtAddEventHandler'ed for ButtonPressMask, ButtonReleaseMask,
PointerMotionMask, and LeaveWindowMask .  The second has separate routines
XtAddEventHandler'ed for ButtonReleaseMask, PointerMotionMask, and
LeaveWindowMask .

In my ButtonReleaseMask routine for the first widget I call XWarpPointer
with src_w=None and dest_w=<window of the second widget>.  If the user's
next act is to move the pointer, the PointerMotionMask routine for the
second widget is called.  If the next act is to press a button, the
LeaveWindowMask routine for the second widget is called (with x and y
values equal to the warped-to position).  There are no grabs active.

Has anyone seen this?  I know the manual says "There is seldom any reason
for calling this function.", but it also says "it generates events just as
if the user had instantaneously moved the pointer ...".

Jim Thomas    jthomas@nmsu.edu

jthomas@nmsu.edu (James Thomas) (04/27/89)

In article <JTHOMAS.89Apr26165411@tecate.nmsu.edu> I write:

me> (I'm using X11R3 on a Sun-3 with SunOS 3.5 .)

me> I have two label widgets on the screen.  The first has separate routines
me> XtAddEventHandler'ed for ButtonPressMask, ButtonReleaseMask,
me> PointerMotionMask, and LeaveWindowMask .  The second has separate routines
me> XtAddEventHandler'ed for ButtonReleaseMask, PointerMotionMask, and
me> LeaveWindowMask .

If I add an event handler for ButtonPress events to the second widget, it
does get called, but only when the button is released.  (Yes, I just looked
at the code again, and unless the xxxMask symbols are
read-once/redefine-after-use, I have the routines matched with the right
event masks.)  ??

Jim Thomas   jthomas@nmsu.edu

jthomas@nmsu.edu (James Thomas) (04/27/89)

In article <JTHOMAS.89Apr26174542@bonito.nmsu.edu> I too hurriedly write:

dummy> If I add an event handler for ButtonPress events to the second
dummy> widget, it does get called, but only when the button is released.
dummy> (Yes, I just looked at the code again, and unless the xxxMask
dummy> symbols are read-once/redefine-after-use, I have the routines
dummy> matched with the right event masks.)  ??

Sorry!  The event adds were right, but the routine names were swapped.
With the right routine names the whole thing worked OK.  Without the button
pressed handler, the leave window event is still generated on (the first?)
button press.

(Moral: include a button pressed event handler and take care before
posting.)

Jim Thomas   jthomas@nmsu.edu