Xlib: drawing into window of other process

[b][red]This message was edited by baldo23 at 2005-10-5 7:37:22[/red][/b][hr]

i'm looking for a way to draw calculation-results from multiple processes into one single window (processes might run on cluster later). i know there is a library called mpe (within mpich) solving this problem. unfortunately this library only provides very poor functionality and as far as i know only works within mpi (also non mpi-version planned).

i tried serveral toolkits (qt, fltk, ...) but couldn't find a solution. now i'm trying to do so using xlib directly (mpe does so) somehow like this:

- create 2 processes via fork()
- in process 1:
[code]Display *dpy = XOpenDisplay(0);
Window w = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0, 200, 100, 0, blackColor, blackColor);
XSelectInput(dpy, w, StructureNotifyMask);
XMapWindow(dpy, w);
GC gc = XCreateGC(dpy, w, 0, NIL);
XSetForeground(dpy, gc, whiteColor);
for(;;) {
XEvent e;
XNextEvent(dpy, &e);
if (e.type == MapNotify)
XDrawLine(dpy, w, gc, 10, 60, 180, 20); // works

-then passing w and gc to process 2 via shared memory (later via mpi?!?)
-in process 2:
[code]Display *dpy = XOpenDisplay(0);
XDrawRectangle(dpy, w, gc, 10, 10, 20, 20); // does not take any effect

any solutions?


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!