gah@arnor.uucp (11/29/90)
Two questions... 1) Is it possible to use X to read an X resource files without being connected to a server? If it is possible, how would I do it?? I am currently using r3 & Motif 1.0. If it makes a difference, can r4 or r5 do such stuff .. but not r3?? 2) If I open a display, then fork I presume both processes are sharing a connection to the server. If one process only wishes to read X resource files is there any problem with not explicitly synchronizing the processes? Or does any database operation require server contact? thx, g
argv@turnpike.Eng.Sun.COM (Dan Heller) (11/29/90)
In article <1990Nov28.191838.4990@arnor.uucp> gah@ibm.com (Gary Hoffman) writes: > 1) Is it possible to use X to read an X resource files without > being connected to a server? No. You must be connected to the server in order for the Xlib routines to access the database associated with it (you can have a resource file unique to every server). > 2) If I open a display, then fork I presume both processes are > sharing a connection to the server. Nope. Just the parent. The child's connection *must* be closed. You can reopen a -new- connection to the server and rebuild widgets or do whatever you want. I submitted a program called "vines" to comp.sources.x several months ago which demonstrates this. Basically, it just sits there and forks allowing each child to draw colored vines all over your screen. If you are using Motif to do things, your child process will have to build those widgets specific to that process. Thus, it is best to fork early in a program since forking causes the entire dataspece to be copied. Since running X programs can be large, your forked process should try to do whatever it can quickly and get out soon. > If one process only > wishes to read X resource files is there any problem with > not explicitly synchronizing the processes? Or does any > database operation require server contact? None of this will work. -- dan ---------------------------------------------------- O'Reilly && Associates argv@sun.com / argv@ora.com Opinions expressed reflect those of the author only.
oj@SABER.COM (11/30/90)
In article <1990Nov28.191838.4990@arnor.uucp> gah@ibm.com (Gary Hoffman) writes: > 1) Is it possible to use X to read an X resource files without > being connected to a server? Dan Heller responded... No. You must be connected to the server in order for the Xlib routines to access the database associated with it (you can have a resource file unique to every server). Wait a bit. XrmGetFileDatabase will read a single resource FILE without requiring a connection to a server. There's just one thing a program can't do without a display connection: retrieve a RESOURCE_MANAGER property from a server (presumably written there at the beginning of the user's session with xrdb). You could write a routine to replicate what happens (resource-wise) during XtInitialize for a user who had not run xrdb. This routine would read and merge a series of resource files, including $HOME/.Xdefaults. You would need to look at the Xt sources to be sure you're duplicating the functionality precisely. You might find such a thing useful. However, many users exploit the fact that xrdb defines symbols like WIDTH, HEIGHT, and COLOR, then runs the C preprocessor over its input. This means that resource files designed to be read by xrdb can't necessarily be read correctly by XrmGetFileDatabase. Ollie Jones Saber Software, Inc.