Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

NAME

XGetDefault − extract an option value from the resource database. 

Synopsis

char *XGetDefault(display, program, option)
Display *display;
char *program;
char *option;

Arguments

displaySpecifies a connection to an X server; returned from XOpenDisplay(). 

programSpecifies the program name to be looked for in the resource database.  The program name is usually argv[0], the first argument on the UNIX command line. 

optionSpecifies the option name or keyword.  Lines containing both the program name and the option name, separated only by a period or asterisk, will be matched. 

Description

XGetDefault() returns a character string containing the user’s default value for the specified program name and option name.  XGetDefault() returns NULL if no key can be found that matches option and program.  For a description of the matching rules, see XrmGetResource().  The strings returned by XGetDefault() are owned by Xlib and should not be modified or freed by the client.  Lines in the user’s resource database look like this:

xterm.foreground:          #c0c0ff
xterm.geometry:            =81x28
xterm.saveLines:           256
xterm.font:                8x13
xterm.keyMapFile:          /usr/black/.keymap
xterm.activeIcon:          on
xmh.header.font            9x15

The portion on the left is known as a key; the portion on the right is the value.  Upper or lower case is important in keys.  The convention is to capitalize only the second and successive words in each option, if any.  Resource specifications are usually loaded into the XA_RESOURCE_MANAGER property on the root window at login.  If no such property exists, a resource file in the user’s home directory is loaded.  On a UNIX-based system, this file is $HOME/.Xdefaults.  After loading these defaults, XGetDefault() merges additional defaults specified by the XENVIRONMENT environment variable.  If XENVIRONMENT is defined, it contains a full path name for the additional resource file.  If XENVIRONMENT is not defined, XGetDefault() looks for $HOME/.Xdefaults-name, where name specifies the name of the machine on which the application is running.  The first invocation of XGetDefault() reads and merges the various resource files into Xlib so that subsequent requests are fast.  Therefore, changes to the resource files from the program will not be felt until the next invocation of the application.  For more information, see Volume One, Chapter 11, Managing User Preferences. 

See Also

XAutoRepeatOff(), XAutoRepeatOn(), XBell(), XChangeKeyboardControl(), XGetKeyboardControl(), XGetPointerControl(). 

Copyright O’Reilly & Assoc.  —  

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026