[comp.windows.x] XSendEvent followup -- problems with masks

kadel@manta.NOSC.MIL (Rich Kadel) (12/06/90)

This is to followup my previous posting on my problems getting XSendEvent
to work.  I had to put the server into debug to figure this one out.
My problem was with the event mask parameter.  As instructed in Doug Young's
book (Xt programming/Motif Edition), I gave it the value "XtAllEvents".
This doesn't work (at least in X11R4--no offense Doug).  The simple
solution is to use NoEventMask when sending a client message.

OK.  For anyone that's interested, here's why it doesn't work (I don't know
whether I'd call this a bug or not, but it IS misleading):

Client sees:
  #define XtAllEvents ((EventMask) -1L) /* 0xFFFFFFFF */

Server sees (in dix/events.c):
  #define OwnerGrabButtonMask (1L<<24)
  #define AllEventsMask (lastEventMask|(lastEventMask-1)) /* 0x1FFFFFF */
  lastEventMask = OwnerGrabButtonMask;

in server function ProcSendEvent():
  if (stuff->eventMask & ~AllEventMasks)
    return BadValue;

This check stops events with the supplied mask XtAllEvents!  I suggest 
that XtAllEvents should be defined more explicitly in the future.

"Thanks!" to those who responded so quickly to my question.

(P.S. I don't know why XIconifyWindow() didn't work for me.  It looks like
it should have.  I'll try it again later.)

Rich Kadel

ken@csis.dit.csiro.au (Ken Yap) (12/10/90)

>Client sees:
>  #define XtAllEvents ((EventMask) -1L) /* 0xFFFFFFFF */

Tsk. Did some Xt programmer assume all the world's a 2's complement machine?