|
From: Ethan M. <merritt@u.washington.edu> - 2006-02-27 19:02:49
|
On Monday 27 February 2006 03:07 am, Dave Denholm wrote:
>> Instead, the x11 server reads the file when you
> > begin a new X-session, and applies the values in finds there to
> > answer queries from any applications (like gnuplot) that run later.
>
> I don't think that's the entire story.
I do not know whether it is some official policy change or just
natural selection, but the app-defaults mechanism does not seem
to be commonly used anymore. It used to be (back in R4/R5 days)
that most x11 applications came with a corresponding app-defaults
file. Now hardly any do. It did not help general users much
because it required root access to change, which I suspect is why
it fell out of favor.
Nevertheless, an app-defaults file can be a useful template for
modifying or adding entries to your personal configuration.
I have it on my TODO list to stuff the gnuplot_x11 X-resources
into an app-defaults file for that reason.
The traces you show below are very interesting. I did not know about
this at all. So you are quite right that my generic explanation was not
the end of the story. Thanks for the education!
Based on your traces, it seems one would need a separate
"~/.Xdefaults-<hostname>" file for each server.
Notice that it doesn't try to open the generic ~/.Xdefaults file.
[After a bit of poking through the gplt_x11.c code]
Huh. I see that the code does try to open such files, but apparently
it only does so if the window manager has not already initialized the
database:
server_defaults = XResourceManagerString(dpy);
[...]
if (server_defaults)
dbDef = XrmGetStringDatabase(server_defaults);
else {
strcpy(buffer, home);
strcat(buffer, "/.Xdefaults");
dbDef = XrmGetFileDatabase(buffer);
}
XrmMergeDatabases(dbDef, &db);
What a curious thing to do. So if your machine is properly
configured to initialize your X environment on startup, then
gnuplot_x11 will not look in the files. But if your machine is
not configured to use the standard mechanism, then
gnuplot_x11 will look for itself. I guess since my machines
initialize the database at the start of each X session, I've
never seen this.
I have always have to update the resource database myself,
using xrdb, in order to see the effect of any change in the
.Xdefaults file.
> On linux (hostname "twoflower"):
>
> $ echo test | strace -f gnuplot
>
> ...
> open("/usr/lib/X11/app-defaults/Gnuplot", O_RDONLY) = -1 ENOENT (No
> such file or directory) ...
> uname({sys="Linux", node="twoflower", ...}) = 0
> open("/home/eclipse/ddenholm/.Xdefaults-twoflower", O_RDONLY) = -1
> ENOENT (No such file or directory)
>
>
>
> On solaris (hostname "eclipse")
>
> $ echo test | truss -f gnuplot
>
> 16820: open("/usr/lib/X11/app-defaults/Gnuplot", O_RDONLY) Err#2
> ENOENT ...
> 16820: sysinfo(SI_HOSTNAME, "eclipse", 64) = 8
> 16820: open("/home/eclipse/ddenholm/.Xdefaults-eclipse", O_RDONLY) =
> 6 16820: xstat(2, "/home/eclipse/ddenholm/.Xdefaults-eclipse",
> 0x08046C94) = 0
>
>
>
> so on my local setup at least, the application itself is looking for
> files with application defaults. It actually seems to append the
> local hostname to the filename - in both cases, DISPLAY was eclipse.
>
>
>
> dd
--
Ethan A Merritt
Biomolecular Structure Center
University of Washington, Seattle WA
|