casey@gauss.llnl.gov (Casey Leedom) (10/08/90)
I execute xrn out of my twm menu via: !"rsh gauss.llnl.gov -n xrn -display $RDISPLAY \ '</dev/null' '>&/dev/null' '&' &" This means that the environment that xrn inherits is very sparse. Ex: HOME=/u0/casey PATH=/u0/casey/bin:/usr/local/bin/mh:/usr/local/bin/X11:... PWD=/u0/casey SHELL=/bin/csh USER=casey (In fact I only get a PATH because I moved my csh ``set path = ...'' out of the ``if ($?prompt) then ... endif'' interactive csh commands section.) Note that, in particular, DISPLAY isn't defined ... This means that my xrn.editorCommand of ``xterm -e ...'' fails because xterm inherits that same sparse environment from xrn so xterm can't figure out what my display is. My question is: should XOpenDisplay or XtInitialize or some other X11 connection initialization routine pump DISPLAY into the environment? If it did, then xrn opening a connection to the display would cause DISPLAY to be put into the environment solving my problem. In any case, I've decided to do two things for now: 1. Change my twm menu entry to: !"rsh gauss.llnl.gov -n setenv DISPLAY $RDISPLAY \; \ xrn -display $RDISPLAY \ '</dev/null' '>&/dev/null' '&' &" 2. Modify and submit a bug fix to xrdb to add DISPLAY as one of the xrdb supplied defines. SERVERHOST isn't good enough since I have a GraphOn OptimaX at home which might start up with almost any display number. This will allow me to specify my xrn.editorCommand as ``xterm -display DISPLAY -e ...'' in my xrdb loaded resources. Casey
casey@gauss.llnl.gov (Casey Leedom) (10/08/90)
| From: casey@gauss.llnl.gov (Casey Leedom) | | In any case, I've decided to do two things for now: | | 1. Change my twm menu entry to: | | !"rsh gauss.llnl.gov -n setenv DISPLAY $RDISPLAY \; \ | xrn -display $RDISPLAY \ | '</dev/null' '>&/dev/null' '&' &" This works quite nicely. | 2. Modify and submit a bug fix to xrdb to add DISPLAY as one of the | xrdb supplied defines. SERVERHOST isn't good enough since I have | a GraphOn OptimaX at home which might start up with almost any | display number. | | This will allow me to specify my xrn.editorCommand as ``xterm | -display DISPLAY -e ...'' in my xrdb loaded resources. This didn't work out at all. I execute xrdb on my workstation via a twm menu entry of: !"xrdb $X/resources" Thus XDisplayName(hostname) returns "1:0.0" (and xrdb's SERVERHOST define becomes "1") Since I execute xrn on a different host, "1:0.0" doesn't help me much. And I'd have similar problems any client using xrdb's defined values for host relative items in resource specification when those clients weree run on different hosts. Thus, I think that the right way to handle this, if we want to at all, is to have XOpenDisplay do a putenv/setenv for DISPLAY. Since XOpenDisplay is called from the application, the value XOpenDisplay installed for the DISPLAY environment variable would correct for any children the application forked off. Perhaps something like the following: mit/lib/X/XOpenDis.c: Line ~128: ... /* * If the display specifier string supplied as an argument to this * routine is NULL or a pointer to NULL, read the DISPLAY variable. */ if (display == NULL || *display == '\0') { if ((display_name = getenv("DISPLAY")) == NULL) { /* Oops! No DISPLAY environment variable - error. */ return(NULL); } } else { /* Display is non-NULL, copy the pointer */ display_name = (char *)display; + (void)setenv("DISPLAY", display, 1); } ... Casey