[comp.windows.x] how do I pass a display pointer to another process

jturmell@hawk.ulowell.edu (Jeff Turmelle) (04/07/89)

 I am having a problem passing a display pointer between two 
processes.  What I want to do is have one process run my 
application, and another process handle events.  I was wondering
if there is a way to do this, and if not, how might I handle 
this otherwise ? 

   Since I have to pass the display pointer, as well as
other variables, back and forth constantly, I just want
to be able to access the same address space, and not pass
a buffer back and forth after every X event. 

   Any ideas ?

   Thanks for the help,

       Jeff Turmelle
       jturmell@hawk.ulowell.edu

klee@daisy.UUCP (Ken Lee) (04/08/89)

In article <12661@swan.ulowell.edu> jturmell@hawk.ulowell.edu (Jeff Turmelle) writes:
> I am having a problem passing a display pointer between two 
>processes.  What I want to do is have one process run my 
>application, and another process handle events.

Passing the display pointer won't work.  Remember, the display pointer
is just a pointer to local memory.  Passing it to another process won't
work unless the processes share an address space and the data in the
display structure is applicable to both processes (which it probably
isn't).  Instead, you can pass window tags and atoms back and forth
between processes using any inter-process communication mechanism.
With these, any process can select or grab events.  Each process should
get its own display pointer (and, thus, its own connection to the X
server).  We do this with one of our products and it works pretty
well.

>   Since I have to pass the display pointer, as well as
>other variables, back and forth constantly, I just want
>to be able to access the same address space, and not pass
>a buffer back and forth after every X event. 

You might be able to do this if your operating system supports shared
memory.  Otherwise, you'll probably want to design some sort of stream
protocol between your processes.  Minimizing traffic will improve your
performance.
-- 
Ken Lee
Daisy Systems Corp., Interactive Graphics Tools Dept.
Internet and Smail:  klee@daisy.uucp
              uucp:  uunet!daisy!klee