X Window Components

Checking Direct Rendering Infrastructure (DRI) Installation

DRI is a framework for allowing software to access graphics hardware in a safe and efficient manner. It is installed in X by default if you have a supported video card. To check if DRI is installed properly, check the log file /var/log/XFree86.0.log or /var/log/Xorg.0.log for statements like:

(II) R128(0): Direct rendering enabled

From an xterm, run glxinfo and look for the phrase:

direct rendering: Yes

You can also run the test program glxgears. This program brings up a window with three gears turning. The xterm will display how many frames were drawn every five seconds so this is a reasonable benchmark. The window is scalable, and the frames drawn per second is highly dependent on the size of the window.

For troubleshooting problems, check the DRI Users Guide at http://dri.sourceforge.net/doc/DRIuserguide.html.

Adding TrueType fonts to X

TrueType font support is built into X. The following items need to be completed to make the fonts available.

  • Establish a directory for the fonts and move any TrueType fonts you want into that directory.

  • Create the fonts.scale and fonts.dir files in the TrueType font directory.

  • Ensure the TrueType module is loaded in the XF86Config or xorg.conf.

  • Ensure the FontPath in XF86Config or Xorg.conf contains the TrueType font directory.

Establish a TrueType font directory

The build of X as given above automatically creates a TrueType font directory: /usr/X11R6/lib/X11/fonts/TTF. This directory already has some TrueType fonts and is set up correctly. If this directory is satisfactory, copy any other TrueType fonts you want into that directory. If not, create a new directory, preferably in the /usr/X11R6/lib/X11/fonts/ directory and put your TrueType fonts there.

Create fonts.scale and fonts.dir

Now change to the directory where you have your TrueType fonts and run

mkfontscale &&
mkfontdir

Ensure TrueType is loaded in XF86Config or xorg.conf

The "Module" section should look like:

Section "Module"
        ...
        Load  "freetype"
        ...
EndSection

Ensure the FontPath in XF86Config points to the TrueType font directory

The "Files" section should look like

Section "Files"
        ...
        FontPath "/usr/X11R6/lib/X11/fonts/[TrueTypeDir]/"
        ...
EndSection

Update the font cache files

Finally, to update all the font cache files specified in /etc/fonts/fonts.conf, run

fc-cache

X will now be able to use TrueType fonts when it is restarted. You can check to see if the new fonts are available with the xlsfonts or xfontsel program.

[Note]

Note

You should re-run mkfontscale and mkfontdir any time you add or delete TrueType fonts. You should also rerun fc-cache each time you add or remove any fonts.

Setting up keyboards

In this version of X, it has been reported that non-Latin keyboard layouts do not include Latin configurations as was previous practice. To set up a keyboard for Latin and non-Latin input, change the XkbLayout keyboard driver option in the InputDevice section of the XF86Config or xorg.conf file. For example:

   Section "InputDevice"
     Identifier          "Keyboard0"
     Driver              "Keyboard"
     Option "XkbModel"   "pc105"
     Option "XkbLayout"  "en_US,ru"
     Option "XkbOptions" "grp:switch,grp:alt_shift_toggle,grp_led:scroll"
   EndSection

In this example, you can use the Alt-Shift combination to switch between keyboard layouts and use the Scroll Lock LED to indicate when the second layout is active.

Setting up XDM

xdm provides a graphical logon capability and is normally set up in /etc/inittab. Most of the information you need to customize xdm is found in its man page. To execute xdm during bootup, change the initdefault level to 5 and add the following lines to /etc/inittab:

# Run xdm as a separate service
x:5:respawn:/usr/X11R6/bin/xdm -nodaemon

Using X Resources

There are many options that can be set in X and X clients via resources. Typically resources are set in the ~/.Xresources file.

The layout of the ~/.Xresources file consists if a list of specifications in the form of

object.subobject[.subobject...].attribute: value

Components of a resource specification are linked together by either tight, represented by a dot (.), or loose, represented by an asterisk (*), bindings. A tight binding indicates that the components on either side of the dot must be directly next to each other as defined in a specific implementation. An asterisk is a wildcard character that means that any number of levels in a defined hierarchy can be between the components. For example, X offers two special cursors: redglass and whiteglass. To use one of these resources, you need to add the following line:

Xcursor.theme: whiteglass

However, you can specify the background for all clients with:

*background: blue

More specific resource variables will override less specific names.

Resource definitions can be found in the man pages for each respective client.

In order to load your resources, the xrdb program must be called with the appropriate parameters. Typically, the first time resources are loaded, you use:

xrdb -load <filename>

To add resources to X's database in memory use:

xrdb -merge <filename>

The xrdb instruction is usually placed in ~/.xinitrc or ~/.xsession. To get more information, see the xrdb man page.