Re: XForms: launching X applications

Frank Stefani (EAD-Frank.Stefani@t-online.de)
Fri, 05 Sep 1997 10:28:55 +0200

To subscribers of the xforms list from EAD-Frank.Stefani@t-online.de (Frank Stefani) :

Steve Lamont wrote:
>
> To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :
>
> > I just want to include a button on one of my forms that runs an external X
> > program. I have a callback function attached to this button that just
> > forks a new process and runs the application in this child process.
> > Unfortunately, the child process can't open the X display for some reason.
> > If, I were to try to run xv for instance, I would get an error like "xv
> > can't open display" or something.
>
> The exact error message would be helpful. You might check to see if
> the DISPLAY environment variable is passed correctly.
>
> This worked perfectly for me in an admittedly quick test:
>
> void launch_cb(FL_OBJECT *ob, long data)
> {
>
> if ( fork() == 0 )
> execl( "/usr/X11R6.1/bin/xv", "xv", NULL );
>
> }
>

If this doesn't help, you can force it with the system() function,
either:

system("/usr/X11R6/bin/xv -display :0");

or

system("export DISPLAY=:0 ; /usr/X11R6/bin/xv");

HTH,
Frank.

-- 
---------------------------------------------------------------
     _/_/_/_/     _/_/     _/_/_/    EAD-Systeme GmbH
    _/          _/  _/    _/    _/   Nachfeldstr. 4
   _/_/_/     _/    _/   _/     _/   D-82490 Farchant, Germany
  _/        _/_/_/_/_/  _/     _/    Phone: +49 8821 9623-0
 _/_/_/_/ _/        _/ _/_/_/_/      Fax: +49 8821 9623-20
---------------------------------------------------------------
Email: EAD-Frank.Stefani@t-online.de
---------------------------------------------------------------

_________________________________________________ To unsubscribe, send the message "unsubscribe" to xforms-request@bob.usuf2.usuhs.mil or see http://bob.usuf2.usuhs.mil/mailserv/xforms.html Xforms Home Page: http://bragg.phys.uwm.edu/xforms List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/