[comp.windows.x.motif] system, motif

olu@sysauto.UUCP (Olumide O. Emuleomo) (09/25/90)

Hi Xworld,
I am noticing something quite peculiar with Motif 1.0.

From within my code, if I do I do a  system("xterm -e foo &");

where foo is an X program,  the menus in the current window of the 
"parent" process disappear and cannot be redrawn!
Also that "parent" window can no longer be closed (with ALT-F4)!

The child process however, works fine!

Interestingly, sh -c "xterm -e foo &" works fine when issued from 
the "command line"!

Pls what's going on here!

Any suggestions will be most welcome!

-- olu@sysauto.UUCP
-- 
Editor MACroS: Eight Megabytes And Constantly Swapping!

dbrooks@osf.org (David Brooks) (09/25/90)

In article <188@sysauto.UUCP>, olu@sysauto.UUCP (Olumide O. Emuleomo) writes:
|> From within my code, if I do I do a  system("xterm -e foo &");
|> where foo is an X program,  the menus in the current window of the 
|> "parent" process disappear and cannot be redrawn!
|> Also that "parent" window can no longer be closed (with ALT-F4)!

(I redirected from "poster" because this is quite a common problem).

You don't say, but I guess the parent program has exited, leaving its
children as orphans.  You are running into the shared-fd experience,
and you need to arranged that the parent's file descriptors get closed
on exec.  Otherwise the server gets confused.

There are several ways of training the display fd to close at the
right time.  I do this immediately after initializing the toolkit:

	#include <fcntl.h>
	fcntl(ConnectionNumber(XtDisplay(toplevel)), F_SETFD, 1);

This probably belongs in the FAQ (is xug listening?).
-- 
David Brooks				dbrooks@osf.org
Systems Engineering, OSF		uunet!osf.org!dbrooks
"A Loaf of Bread, a Jug of Wine, and Six Spades Redoubled -- Omar somebody.