[comp.windows.x] Sharing window ID's between processes

koch@cadfx.ccad.uiowa.edu (Peter Koch) (07/26/90)

  I am having trouble getting an application program 
to draw into a window of another application. I get a
X Protocol error "not a valid window ID". 

  The program that creates the drawing window calls a function
which creates a pipe between the other program, forks the 
parent process and calls execvp to execute the drawing program.
The window ID is used as a command line option for the drawing program.
The other program is executed, opens the display and prints to the screen 
the window ID in question. It is identical to the window ID of the program 
which created the window. The drawing program attempts to retrieve
the window attributes of the window using XGetWindowAttributes but fails
to recognize the window ID.

What am I doing wrong? 

Is it even possible to share window ID's between different processes?

neilb@dcs.leeds.ac.UK (Neil Bowers) (07/26/90)

Hi Peter,

> I am having trouble getting an application program
> to draw into a window of another application. I get a
> X Protocol error "not a valid window ID".

I think your problem may be that the window hasn't actually
been created by the time the second application tries to
draw in it. The CreateWindow call may be buffered up,
and since the applications are using different display
connections, the second application's drawing requests
might get to the server before the CreateWindow.
If this is the case, flushing the buffer after you create
the window will solve you problem.

Hope this helps

Neil

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Neil Bowers,			JANET       : neilb@leeds.dcs
School of Computer Studies,	UUCP        : ukc!leeds.dcs!neilb
University of Leeds,		EARN/BITNET : neilb@dcs.leeds.ac.uk
Leeds LS2 9JT.			CSNET       : neilb%leeds.dcs@nss.cs.ucl.ac.uk
                                phone       : +44 532 335478
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=