[comp.windows.x] beginer needs help client messages

aed@netcom.COM (Andrew Davidson) (03/05/91)

Hi

I am having some trouble with interclient communication in X11r4. I am
trying to use client messages. I have a slider, with a call back. the
last thing this call back does is call XSendEvent. The first call to
XSendEvent appear to work, but the second time it is call I get the
following message from the server, then my program dies

cataed:8% X Error of failed request:  BadValue (integer parameter out
of range for operation)
  Major opcode of failed request:  25 (X_SendEvent)
  Minor opcode of failed request:  0
  Resource id in failed request:  0xffffffff
  Serial number of failed request:  98
  Current serial number in output stream:  99

what does this mean?

here is the call back. It is based on Doug Youngs Chapter 11. I had to
cast the event in the XsendEvent() becuase I am working in C++ and
could not get it to compile with out it.

void SliderMoved(Widget w, CurveData *data, XmScaleCallbackStruct
*callData)
{
  data->rate = callData->value;
  DisplayValue(data);

  /*
   * send client message
   */
  Display *dpy = XtDisplay(w);
  Window root = DefaultRootWindow(dpy);


  MSG_ATOM = XInternAtom(dpy, "MARKET_MOVEMENT", FALSE);

  XClientMessageEvent event;
  event.display = dpy;
  event.window = root;
  event.type = ClientMessage;
  event.format = 8;
  event.message_type = MSG_ATOM;
  event.data.b[0] = '\0';

  XSendEvent(dpy, root, TRUE, XtAllEvents, (XEvent *)&event);
  XFlush(dpy);
}


Thanks Andy
-- 
-----------------------------------------------------------------
                  "bede-bede-bede Thats all Folks"
				Porky Pig
Andy Davidson
Woodside CA.
aed@netcom.COM
-----------------------------------------------------------------

gildea@expo.lcs.mit.EDU (Stephen Gildea) (03/05/91)

You are not checking the return value of XInternAtom.  Also, since
XInternAtom only needs to be called once, you might consider moving
it out of the callback.

 < Stephen
   MIT X Consortium