Compiling you example has been extremely helpful, thanks. It worked! I had in fact tried the following code earlier:

QX11EmbedContainer *test=new QX11EmbedContainer(parent);
test->embedClient(winid);
test->show();

which is very very similar, but doesn't work. The only difference I can think of is that in my case, there has not been time enough for the container window to be realised, so the embedding fails. It seems you need to wait for the container to appear on screen. That will probably be possible some way.

Next is the problem of knowing the winid of the process you forked, automatically, as I can't expect my users to use xwininfo....

Cheers.

Martin

Quote Originally Posted by Brandybuck View Post
I have done this. If the window is not an XEmbedClient, then you need to know its window ID. You can get this with xwininfo or similar methods. I am attaching a sample program that does this, which I have used to embed XEmacs, xterm, etc.

XEmbed is intended for XEmbed-aware clients. Otherwise all it does is swallow apps, making it a poor-man's window manager.

p.s. There was a bug in 4.2.0-rc1, but it has been resolved.