XGetDefault()XGetDefault()NameXGetDefault – extract an option value from the resource database.
Synopsis
char *XGetDefault(display, program, option)
Display *display;
char *program;
char *option;
Arguments
display Specifies a connection to an X server; returned from XOpenDis‐
play().
program Specifies 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.
option Specifies 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.
Returns
The resource value.
DescriptionXGetDefault() 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. Uppercase or lowercase is important in keys. The conven‐
tion 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.
If length of ".Xdefaults-name" is greater than 255, then $HOME/.Xde‐
faults-IP address is looked for instead, where IP address is the inter‐
net address of the host.
The first invocation of XGetDefault() reads and merges the various
resource files into Xlib so that subsequent requests are fast. There‐
fore, 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 13, Managing User Prefer‐
ences.
See AlsoXAutoRepeatOff(), XAutoRepeatOn(), XBell(), XChangeKeyboardControl(),
XGetKeyboardControl(), XGetPointerControl().
Xlib - User Preferences XGetDefault()