bw@hpcvlx.HP.COM (Bill Wilhelmi) (05/13/88)
Help! I'm confused about the Xlib Resource Manager and particularly the resource database. I have bounced around the Xlib manual (chapters 4 and 10), the toolkit manual, and the Inter-client Communication Conventions Manual (Feb 25 draft) trying to figure out: 1. Who owns a resource database? A client? A window? 2. There are specific references to a resource database loaded into the server, or stored as a property on the root window. Which is true? To quote the Xlib manual: Your personal resource database usually is stored in a file and is loaded onto a server property when you log in. This database is retrieved automatically by Xlib when a connection is opened. (10.11) Also: When an application looks up a resource (for example, a color), it passes the complete name and complete class of the resource to a lookup routine. After lookup, the resource manager returns the resource value and representation type. (10.11) And: Defaults are usually loaded into the RESOURCE_MANAGER property on the root window at login. (10.2) These quotes make references to _the_database_. Which data base is this? Is this a property on the root window? 3. What does the first quote above mean by "when you log in"? Does that mean when you fire up the X server? Or does it mean when you open a display? 4. Can a client have more than one resource database attached to it? 5. Is the resouce database and the resource manager referred to in the Xlib manual the same as that used by the toolkit? 6. In section 10.11.2 of the Xlib manual, it says that a resource database is an opaque type. What does this mean? 7. Section 4 of the Inter-client Communication Conventions Manual discusses resources that are allocated to clients. Are these the same types of resouces as are discussed in the Xlib manual, chapter 10? Thanks in advance for whoever can clear up my fog. Bill Wilhelmi Hewlett-Packard Company Corvallis Workstation Operation Corvallis, Oregon ______________________________________________________________________________
jim@EXPO.LCS.MIT.EDU (Jim Fulton) (05/13/88)
More complete explanations can be found in the "Using and Specifying X Resources" tutorial that was sent out a couple months ago and will be a part of R3. I'll mail a copy of it to you separately. However, for the sake of discussion, > 1. Who owns a resource database? A client? A window? A client. > 2. There are specific references to a resource database loaded into the > server, or stored as a property on the root window. Which is true? Resources are obtained from the following places: 1. from the RESOURCE_MANAGER property on the root window of screen 0; these are stored using the xrdb program. If this property is not defined, then $HOME/.Xdefaults will be read to provide compatibility with X10 (although the resource specification format has changed somewhat). 2. from any application-specific resource files, usually stored in /usr/lib/X11/app-defaults/. 3. from any user-specific defaults stored in a file whose name is set in the environment variable XENVIRONMENT. 4. from the -xrm command line option (for programs written with the X Toolkit). > 3. What does the first quote above mean by "when you log in"? Does that > mean when you fire up the X server? Or does it mean when you open > a display? It actually means when you run a program like xrdb that sets the RESOURCE_MANAGER property on the root window of screen 0. You do this from whatever mechanism you use to start up your commonly-used X applications (e.g. your window manager, terminal emulators, clocks, load average monitors, editors, mail readers, etc.). I use a little shell script, other people have fancy session managers, etc. An example is given in the Resources Tutorial, but it boils down to running the xrdb program. > 5. Is the resouce database and the resource manager referred to in the > Xlib manual the same as that used by the toolkit? Yes. > 6. In section 10.11.2 of the Xlib manual, it says that a resource > database is an opaque type. What does this mean? An XrmDatabase is defined as: typedef struct _XrmHashBucketRec *XrmDatabase; However, if you look around, you'll find that there is no definition for struct _XrmHashBucketRec in the public include files. As a result, your program cannot access any fields in it; this is a useful way to do abstraction and data hiding. > 7. Section 4 of the Inter-client Communication Conventions Manual > discusses resources that are allocated to clients. Are these the > same types of resouces as are discussed in the Xlib manual, chapter 10? Yes. A copy of "Using and Specifying X Resources" will arrive separately. Jim Fulton X Consortium MIT Laboratory for Computer Science (617) 253-1428 jim@EXPO.LCS.MIT.EDU
haynes@WSL.DEC.COM (05/14/88)
> 1. Who owns a resource database? A client? A window? A client. > 2. There are specific references to a resource database loaded into the > server, or stored as a property on the root window. Which is true? They are stored as a property on the root window of the default screen. They are NOT loaded into the server when the server starts, they are changed everytime someone else "logs in". > To quote the Xlib manual: > > Your personal resource database usually is stored in a file > and is loaded onto a server property when you log in. This > database is retrieved automatically by Xlib when a connection > is opened. (10.11) > > Also: > > When an application looks up a resource (for example, a color), > it passes the complete name and complete class of the resource to > a lookup routine. After lookup, the resource manager returns the > resource value and representation type. (10.11) > > And: > > Defaults are usually loaded into the RESOURCE_MANAGER property > on the root window at login. (10.2) > > These quotes make references to _the_database_. Which data base is this? > Is this a property on the root window? Yes. > 3. What does the first quote above mean by "when you log in"? Does that > mean when you fire up the X server? Or does it mean when you open > a display? It means "when you log in". In the model where there is one user per workstation, when that user is authenticated, the program doing the authenticating loads the property onto the server. > 4. Can a client have more than one resource database attached to it? I don't understand this question. There is a database associated with each connection (in the display structure), the Xlib resource database routines take a database parameter. You are free to pass in whatever database you want. > 5. Is the resouce database and the resource manager referred to in the > Xlib manual the same as that used by the toolkit? Yes. The toolkit currently has a single global database for the application that it builds according to the rules specified in the spec. > 6. In section 10.11.2 of the Xlib manual, it says that a resource > database is an opaque type. What does this mean? That means you aren't allowed to look inside it. You treat it as a unique identifier with no additional semantics. > 7. Section 4 of the Inter-client Communication Conventions Manual > discusses resources that are allocated to clients. Are these the > same types of resouces as are discussed in the Xlib manual, chapter 10? I don't know, but I doubt it. "Resource" is a heavily overloaded term. -- Charles