Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!uwm.edu!lll-winken!gauss.llnl.gov!casey From: casey@gauss.llnl.gov (Casey Leedom) Newsgroups: comp.windows.x Subject: Re: Should the X11 library install DISPLAY in the environment? Message-ID: <69432@lll-winken.LLNL.GOV> Date: 8 Oct 90 15:06:03 GMT References: <69430@lll-winken.LLNL.GOV> Sender: usenet@lll-winken.LLNL.GOV Reply-To: casey@gauss.llnl.gov (Casey Leedom) Organization: Lawrence Livermore National Laboratory Lines: 59 | 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' '&' &" 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