[comp.windows.x] XSendEvent, how do I use it...

hkbirke@mit-amt (Hal Birkeland) (10/08/88)

Release: X11R2
System:  4.3 BSD UVaxII with Parallax running Xplx (ucode 7.xx)
Routine: XSendEvent

how do I use it... the following syntax seems to never succeed (status
returned as zero and event never is generated.)

	XEvent ev;

	ev.type = Expose;
	ev.xexpose.display = dpy;
	ev.xexpose.window = window;
	ev.xexpose.x = 0;
	ev.xexpose.y = 0;
	ev.xexpose.width = 30;
	ev.xexpose.height = 30;
	ev.xexpose,count = 0;
	XSendEvent (dpy, window, False, ExposureMask, &ev);

returns a 0 -- call fails.

One other question -- is there a need for this much code duplication?
I mean, I pass the display and window to the command as well as in the
structure.

Please correct my stupidity... it must be something obvious.

-- hal
hkbirke@media-lab.media.mit.edu
...!mit-amt!hkbirke

THESE ARE MY OWN OPINIONS, USUALLY NOT THOSE OF MY SUPERIORS.

stergios@athsys.uucp (Stergios Marinopoulos) (10/12/88)

Do not forget to fill in the 'format' field in the XClientMessageEvent
or else none of your data will be copied by the server. Use  one of 8,
16,   or 32 depending  on your  use   of  char,  short,   or int field
respectively in XClientMessageEvent union member data.

I do not believe this is documented in the O'Reilly  manuals, and I am
not sure about the Xlib manual (read  my  search was  not exhaustive).
When I noticed  the problem I  started  digging in  the X11r2  mit sun
server and found what I was doing wrong.

This may not solve your particular problem but it will be necessary
inorder for correct usage OF XSendEvent.


Stergios Marinopoulos