SourceForge VA Linux Systems
Copyright © 2000 Paul Sheer - Click here for copying permissions       Source by FTP

next up previous contents index
Next: Unix Security Up: Rute Users Tutorial and Previous: Kernel, devices   Contents   Index

Subsections

X

Add comments here 

The X protocol

Before The X Window System (from now on called X), UNIX was terminal based, and had no proper graphical environment, sometimes called a GUI45.1. X was designed to fulfil that need and incorporate into graphics all the power of a networked computer. You may imagine that allowing an application to put graphics on a screen involves nothing more than creating a user library that can perform various graphical functions like line drawing, font drawing and so on. To understand why X is more than merely this, consider the example of terminal applications: these are programs which run on a remote machine while displaying to a local text terminal and recieving feedback (keystrokes) from the local text terminal. There are two distinct entities at work -- firstly the application and secondly the user's display; these two are connected by some kind of serial or network link. Now what if the terminal display could display windows, and other graphics (in addition to text), while giving feedback to the application using a mouse (as well as a keyboard)? This is what X achieves. It is a protocol of commands that are sent and received between an application and a special graphical terminal called an X Server45.2 (from now on called the server). How the server actually draws graphics on the hardware is irrelevant, all the application needs to know is that if it sends a particular sequence of bytes down the TCP/IP link, the server will interpret them to mean that a line, circle, font, box or other graphics entity should be drawn on its screen. In the other direction, the application needs to know that particular sequences of bytes mean that a keyboard key was pressed or that a mouse has moved. This TCP communication is called the X protocol.
When you are using X, you will probably not be aware that this interaction is happening. The server and the application might very well be on the same machine. The real power of X is evident when they are not on the same machine. Consider for example that 20 users can be logged onto a single machine and be running different programs which are displayed on 20 different remote X Servers. It is as though a single machine was given multiple screens and keyboards.
It is for this reason that X is called a network transparent windowing system.
The developer of a graphical application can then dispense with having to know anything about the graphics hardware itself (consider DOS applications where each had to build in support for many different graphics cards), and also dispense with having to know what machine the graphics is going to display on.
The precise program that performs this miracle is /usr/X11/bin/X. A typical sequence of events to get a graphical program to run is as follows (this is an illustration, in practice numerous utilities will perform these functions in a more generalised and user friendly way):
  1. The program /usr/X11R6/bin/X is started and run in the background. X will detect through configuration files (/etc/XF86Config or /etc/X11/XF86Config on LINUX) and possibly though hardware autodetection, what graphics hardware (like a graphics add-on card) is available. It will then initialise that hardware into graphics mode.
  2. It will then open a socket connection to listen for incomming requests on a specific port (usually TCP port 6000), being ready to interpret any connection as a stream of graphics commands.
  3. An application will be started on the local machine or on a remote machine. All X programs have as a configuation option, to be specified (using an IP address) where you would like them to connect to, i.e. to what server you would like the resulting output to display.
  4. The application opens a socket connection to the specified server over the network, This is the most frequent source of errors. Applications fail to connect to a server because the server is not running or because the server was specified incorrectly, or because the server refuses a connection from an untrusted host.
  5. The application commences with sending X protocol requests, waiting for them to be processed, and then recieving and processing the resulting X protocol responses. From the users point of view, the application now appears to be ``running'' on the server's display.
Communication between the application and the server is somewhat more complex than the mere drawing of lines and rectangles and reporting of mouse and key events. The server has to be able to handle multiple applications connecting from multiple different machines, where these applications may interact between each other (think of cutting and pasteing between applications that are actually running on different machines.) Some examples of the fundmental X Protocol requests that an application can make to a server are:
Create Window
A window is a logical rectangle on the screen, owned by particular application, into which graphics can be drawn.
List Fonts
To list fonts available to the application.
Allocate Colour
Will define a colour of the specified name or RGB value for later use.
Create Graphics Context
A Graphics Context is a definition of how graphics are to be drawn within a window.
Get Selection Owner
Find which window (possibly belonging to another application) owns the selection (i.e. a `cut' of text).
In return, the server replies by sending Events back to the application. The application is required to constantly poll the server for these events. Besides events detailing the user's mouse and keyboard input, there are, for example, events that indicate that a window has been exposed (i.e. a window was on top of another window and was moved, thus exposing the window beneath it, and hence the application should send the appropriate commands needed to redraw the graphics within it), as well as events such as to indicate that another application has requested a paste from your application etc.. The file /usr/include/X11/Xproto.h contains the full list of X protocol requests and events.
The programmer of an X application need not be directly concerned with these requests. A high level library handles the details of the server interaction. This library is called the X Library, /home/X11R6/lib/libX11.so.6.
One of the limitations of such a protocol is that one is restricted to the set of commands that have been defined. X overcame this problem by making it extensible45.3 from the start. These days there are extensions to X to allow, for example, the display of 3D graphics on the server, the interpretation of postscript commands, and many others that improve graphics appeal and performance. Each extension comes with a new group of X protocol requests and events, as well as a programmers' library interface for the developer.
An example of real X program is as follows. This is about the simplest an X program is ever going to get. It does the job of displaying a small XPM image file in a window, and waiting for a key press or mouse click before exiting. You can compile it with gcc -o splash splash.c -lX11 -L/usr/X11/lib. (You can see right away why there are few applications written directly in X.) You can see that all X Library functions are prefixed by an X:

 
 
 
 
5 
 
 
 
 
10 
 
 
 
 
15 
 
 
 
 
20 
 
 
 
 
25 
 
 
 
 
30 
 
 
 
 
35 
 
 
 
 
40 
 
 
 
 
45 
 
 
 
 
50 
 
 
 
 
55 
 
 
 
 
60 
 
 
 
 
65 
 
 
 
 
70 
 
 
 
 
75 
 
 
 
 
80 
 
 
 
 
85 
 
 
 
 
90 
 
 
 
 
95 
 
 
 
 
100 
 
 
 
 
105 
 
 
 
 
110 
 
 
 
 
115 
 
 
 
 
120 
 
 
 
 
125 
 
 
 
 
130 
 
 
 
 
135 
 
 
 
 
140 
 
 
 
 
145 
 
 
 
 
150 
 
 
 
 
155 
 
 
 
 
160 
 
 
 
 
165 
 
 
 
 
170 
 
 
 
 
175 
 
 
 
 
180 
 
 
 
 
185 
 
 
 
 
190 
 
 
 
 
195 
 
 
 
 
200 
 
 
 
 
205 
 
 
 
 
210 
 
 
 
 
215 
/* splash.c - display an image */

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include <X11/Xlib.h>

/* XPM */
static char *obs_splash[] = {
/* columns rows colors chars-per-pixel */
"28 32 16 1",
"  c #111111", ". c #640c0e", "X c #645f5f", "o c #75807f",
"O c #9e0d12", "+ c #a36264", "@ c #e41929", "# c #eb3847",
"$ c #e05b68", "% c #bb3741", "& c #df7d86", "* c #a39d9d",
"= c #e49fa6", "- c #fefefe", "; c #e6d5d6", ": c #e4bec2",
/* pixels */
"-----------------;----------", "----------------=:----------",
"---------------:O;----------", "--------------$@O;----------",
"-------------;@O.-----------", "--------------@OX----;------",
"--------------@O+---;;------", "--------------@.O---:---;*X*",
"--------------#.X---=:XX   X", "-----------;--#O$-;*+o*-;  ;",
"-----------:--#O***:+---X --", "-----------:--#.*--:+--XX---",
"----------;:;*%O;--&=;X*----", "----------:+;-$.---$.X;-----",
"---------*+:--#O--:.+-------", "-------:o;$:--#O;X*O*-------",
"-----;X*--%;--%.o;-@*-------", "----*X:--;@;*X.+--;O+-------",
"---* ;---:.X*-%*--=@+-------", "--o X-**X..;--%:--#O+-------",
"-*     X;=O;--%;--$O+-------", "-o X*:---=O;--$---#.+-------",
"---------#O:-;$---OX;-------", "--------;@.;-;&--;*---------",
"--------;@O:-;=-------------", "--------;@.:-::-------------",
"--------=.+;-:;-------------", "--------=*---;;-------------",
"--------;----;--------------", "-------------;--------------",
"----------------------------", "----------------------------"
};

int main (int argc, char **argv)
{
    int i, j, x, y, width, height, n_colors;
    XSetWindowAttributes xswa;
    XGCValues gcv;
    Display *display;
    char *display_name = 0;
    int depth = 0;
    Visual *visual;
    Window window;
    Pixmap pixmap;
    XImage *image;
    Colormap colormap;
    GC gc;
    int bytes_per_pixel;
    unsigned long colors[256];
    unsigned char **p, *q;
    for (i = 1; i < argc - 1; i++)
        if (argv[i])
            if (!strcmp (argv[i], "-display"))
               display_name = argv[i + 1];
    display = XOpenDisplay (display_name);
    if (!display) {
        printf ("splash: cannot open display\n");
        exit (1);
    }
    depth = DefaultDepth (display, DefaultScreen (display));
    visual = DefaultVisual (display, DefaultScreen (display));
    p = (unsigned char **) obs_splash;
    q = p[0];
    width = atoi ((const char *) q);
    q = (unsigned char *) strchr (q, ' ');
    height = atoi ((const char *) ++q);
    q = (unsigned char *) strchr (q, ' ');
    n_colors = atoi ((const char *) ++q);

    colormap = DefaultColormap (display, DefaultScreen (display));
    pixmap =
        XCreatePixmap (display, DefaultRootWindow (display), width, height,
                      depth);
    gc = XCreateGC (display, pixmap, 0, &gcv);

    image =
        XCreateImage (display, visual, depth, ZPixmap, 0, 0, width, height,
                     8, 0);
    image->data = (char *) malloc (image->bytes_per_line * height + 16);

/* create color pallete */
    for (p = p + 1, i = 0; i < n_colors; p++, i++) {
        XColor c, c1;
        unsigned char *x;
        x = *p + 4;
        if (*x == '#') {
            unsigned char *h = (unsigned char *) "0123456789abcdef";
            x++;
            c.red =
               ((unsigned long) strchr (h, *x++) -
                (unsigned long) h) << 12;
            c.red |=
               ((unsigned long) strchr (h, *x++) -
                (unsigned long) h) << 8;
            c.green =
               ((unsigned long) strchr (h, *x++) -
                (unsigned long) h) << 12;
            c.green |=
               ((unsigned long) strchr (h, *x++) -
                (unsigned long) h) << 8;
            c.blue =
               ((unsigned long) strchr (h, *x++) -
                (unsigned long) h) << 12;
            c.blue |=
               ((unsigned long) strchr (h, *x++) -
                (unsigned long) h) << 8;
            if (!XAllocColor (display, colormap, &c))
               printf ("splash: could not allocate color cell\n");
        } else {
            if (!XAllocNamedColor (display, colormap, (char *) x, &c, &c1))
               printf ("splash: could not allocate color cell\n");
        }
        colors[(*p)[0]] = c.pixel;
    }

    bytes_per_pixel = image->bytes_per_line / width;

/* cope with servers having different byte ordering and depths */
    for (q = (unsigned char *) image->data, j = 0; j < height; j++, p++) {
        unsigned char *r;
        unsigned long c;
        r = *p;
        if (image->byte_order == MSBFirst) {
            switch (bytes_per_pixel) {
            case 4:
               for (i = 0; i < width; i++) {
                   c = colors[*r++];
                   *q++ = c >> 24;
                   *q++ = c >> 16;
                   *q++ = c >> 8;
                   *q++ = c;
               }
               break;
            case 3:
               for (i = 0; i < width; i++) {
                   c = colors[*r++];
                   *q++ = c >> 16;
                   *q++ = c >> 8;
                   *q++ = c;
               }
               break;
            case 2:
               for (i = 0; i < width; i++) {
                   c = colors[*r++];
                   *q++ = c >> 8;
                   *q++ = c;
               }
               break;
            case 1:
               for (i = 0; i < width; i++)
                   *q++ = colors[*r++];
               break;
            }
        } else {
            switch (bytes_per_pixel) {
            case 4:
               for (i = 0; i < width; i++) {
                   c = colors[*r++];
                   *q++ = c;
                   *q++ = c >> 8;
                   *q++ = c >> 16;
                   *q++ = c >> 24;
               }
               break;
            case 3:
               for (i = 0; i < width; i++) {
                   c = colors[*r++];
                   *q++ = c;
                   *q++ = c >> 8;
                   *q++ = c >> 16;
               }
               break;
            case 2:
               for (i = 0; i < width; i++) {
                   c = colors[*r++];
                   *q++ = c;
                   *q++ = c >> 8;
               }
               break;
            case 1:
               for (i = 0; i < width; i++)
                   *q++ = colors[*r++];
               break;
            }
        }
    }

    XPutImage (display, pixmap, gc, image, 0, 0, 0, 0, width, height);

    x = (DisplayWidth (display, DefaultScreen (display)) - width) / 2;
    y = (DisplayHeight (display, DefaultScreen (display)) - height) / 2;

    xswa.colormap = colormap;
    xswa.background_pixmap = pixmap;

    window =
        XCreateWindow (display, DefaultRootWindow (display), x, y, width,
                      height, 0, depth, InputOutput, visual,
                      CWColormap | CWBackPixmap, &xswa);
    XSelectInput (display, window, KeyPressMask | ButtonPressMask);

    XMapRaised (display, window);

    while (1) {
        XEvent event;
        XNextEvent (display, &event);
        if (event.xany.type == KeyPress || event.xany.type == ButtonPressMask)
            break;
    }
    XUnmapWindow (display, window);
    XCloseDisplay (display);
    return 0;
}

You can learn to program X from the documentation in the X Window System sources -- See below.

Widget libraries and desktops

To program in X is tedious. Therefore most developers will use a higher level widget library. Most users of GUI's will be familiar with buttons, menus, text input boxes and so on. These are called widgets. X programmers have to implement these manually. The reason these were not built into the X protocol is to allow different user interfaces to be built on top of X. This flexibility makes X the enduring technology that it is.45.4

Background

The X Toolkit (libXt.so) is a widget library that has always come free with X. It is crude looking by todays standards. It doesn't feature 3D (shadowed) widgets, although it is comes free with X. Motif is modern full featured widget library that had become an industry standard. Motif is however bloated and slow, and depends on the X toolkit. It has always been a expensive proprietary library. Tk (tee-kay) is a library that is primarily used with the Tcl scripting language. It was probably the first platform independent library (running on both Windows, all UNIX variants, and the Apple Mac). It is however slow and has limited features (this is progressively changing). Both Tcl and Motif are not very elegant looking.
Around 1996, there was the situation of a lot of widget libraries popping up with different licenses. V, xforms, and graphix come to mind. (This was when I started to write Coolwidgets -- my own widget library.) There was no efficient, multipurpose, free, and elegant looking widget library for UNIX. This was a situation that sucked, and was retarding Free software development.

Qt

At about that time a new GUI library was released. It was called Qt and was developed by Troll Tech. It was not free, but was an outstanding technical accomplishment from the point of view that it worked efficiently and cleanly on many different platforms. It was shunned by some factions of the Free software community because it was written in C++45.5, and was only free for non-commercial applications to link with.
Nevertheless, advocates of Qt went ahead and began producing the outstanding KDE desktop project -- a set of higher level development libraries, a window manager, and many core applications that together comprise the KDE Desktop. The Licensing issues with Qt have relaxed somewhat, and it will soon be available under the GPL.

Gtk

At one point, before KDE was substantially complete, Qt antagonists reasoned that since there were more lines of Qt code, than KDE code, it would be better to develop a widget library from scratch. The Gtk widget library is a GPL'd and written entirely in C in low level X calls (i.e. without the X Toolkit), completely object oriented, fast, clean, extensible and having a staggering array of features. It is comprised of Glib, a library meant to extend standard C, providing higher level functions usually akin only to scripting languages, like hash tables and lists; Gdk, a wrapper around raw X Library to give X GNU naming conventions, and give a slightly higher level interface to X; and the Gtk library itself.
Using Gtk, the Gnome project began, analogous to KDE, but written entirely in C.

GNUStep

OpenStep (based on NeXTStep) was a GUI specification published in 1994 by Sun Microsystems and NeXT Computers meant for building applications with. It uses the Objective-C language which is an object orientated extension to C, that is arguably more suited to this kind of development than C++.
OpenStep requires a PostScript display engine, that is analogous to the X Protocol, but considered superior to X because all graphics are independent of the pixel resolution of the screen. In other words, high resolution screens would just improve the picture quality, and not make the graphics smaller.
The GNUStep project has a working PostScript display engine, and is meant as a Free replacement to OpenStep.

Using XFree86

X was development by the X consortium as a standard as well as a reference implementation of that standard. There are ports to every platform that supports graphics. The current version of the standard is 11 release 6 (hence the directory /usr/X11R6/). There will probably never be another version.
XFree86 <http://www.xfree86.org> is a free port of X that includes Linux Intel boxes amongst its supported hardware. X has some peculiarities that are worth noting as a user, and XFree86 has some over those.
We will not explain how to install and configure X here. You distribution should have properly configured X for you.

The X program

(See Section 45.6 for configuring X).
At a terminal prompt, you can type:

 
X

to start X (provided X is not already running). If X has been configured properly (including having /usr/X11R6/bin in your PATH), it will initiate the graphics hardware and a black and white stippled background will appear with a single X as the mouse cursor. Contrary to intuition, this means that X is actually working properly.

To kill the X server use the key combination Ctrl-Alt-Backspace.
To switch to the text console, use Ctrl-Alt-F1 ...Ctrl-Alt-F6.
To switch to the X console, use Alt-F7. The seven common virtual consoles of LINUX are 1-6 as text terminals, and 7 as an X terminal.
You can start up a second X server on your machine:

 
/usr/X11R6/bin/X :1

starts up a second X session in the virtual console 8. You can switch to it using Ctrl-Alt-F8 or Alt-F8.

To zoom in or out of your X session, do Ctrl-Alt-+ and Ctrl-Alt--. (We are talking here of the + and - on your keypad only.)

Running X utilities

/usr/X11R6/bin/ contains a large number of X utilities that most other operating systems have based theirs on. Most of these begin with a x. The basic XFree86 programs are:

 
 
 
 
5 
 
 
 
 
10 
 
SuperProbe   dga         mkfontdir  showrgb      xclock      xfd         xkbprint    xmessage     xsetroot
X            editres     nxterm     smproxy      xcmsdb      xfindproxy  xkbvleds    xmh          xsm
Xmark        gccmakedep  proxymngr  startx       xconsole    xfontsel    xkbwatch    xmodmap      xstdcmap
Xprt         iceauth     reconfig   twm          xcutsel     xfwp        xkill       xon          xterm
Xwrapper     ico         resize     viewres      xditview    xgc         xload       xprop        xvidtune
appres       lbxproxy    rstart     x11perf      xdm         xhost       xlogo       xrdb         xwd
atobm        listres     rstartd    x11perfcomp  xdpyinfo    xieperf     xlsatoms    xrefresh     xwininfo
bdftopcf     lndir       scanpci    xauth        xedit       xinit       xlsclients  xrx          xwud
beforelight  makeg       sessreg    xbiff        xev         xkbbell     xlsfonts    xset
bitmap       mergelib    setxkbmap  xcalc        xeyes       xkbcomp     xmag        xsetmode
bmtoa        mkdirhier   showfont   xclipboard   xf86config  xkbevd      xman        xsetpointer

To run an X program, you need to tell it what remote server to connect to. Most programs take an option -display to specify the X server. With X running in your seventh virtual console, type into your first virtual console:

 
xterm -display localhost:0.0

The localhost refers to the machine on which the X server is running -- in this case out own. The first 0 means the screen which we would like to display on (X supports multiple physical screens in its specification). The second 0 refers to the root window we would like to display on. Consider a multi-headed45.6 display -- we would like to specify which monitor the application pops up on.

Switching to your X session, should reveal a character terminal where you can type commands.
A better way to specify the display is using the DISPLAY environment variable:

 
 
DISPLAY=localhost:0.0
export DISPLAY

causes subsequent X applications to display to localhost:0.0, although a -display on the command-line takes first priority.

The X utilities listed above are pretty ugly and un-intuitive. Try for example xclock, xcalc, and xedit. For fun, try xbill. Also do a

 
rpm -qa | grep '^x'

The X distribution

The official X distribution comes as an enormous source package available in tgz format at www.xfree86.org <http://www.xfree86.org/>. It is traditionally packed as three tgz files to be unpacked over each other -- the total of the three is about 50 megabytes compressed45.7. This package has nothing really to do with the version number X11R6 -- it is a subset of X11R6.
Downloading and installing the distribution is a major undertaking, but should be done if you are interested in X development.
All UNIX distributions come with a compiled and (mostly) configured X installation, hence the official X distribution should never be needed except by developers.

X documentation

Programming

X Windows comes with tens of megabytes of documentation. For instance, all the books describing all of the programming API's are included inside the X distribution. Most of these will not be including in the standard RedHat directory tree -- download the complete distribution if you want these. You can then look inside xc/doc/specs (especially xc/doc/specs/X11) to begin learning how to program under X.

Configuration documentation

Important to configuring X is the directory /home/X11R6/lib/X11/doc/. It contains

 
 
 
 
5 
 
AccelCards  QuickStart.doc  README.I128     README.NVIDIA  README.Video7  README.ati      README.i740       RELNOTES
BUILD       README          README.LinkKit  README.Oak     README.W32     README.chips    README.mouse      ServersOnly
BetaReport  README.3DLabs   README.Linux    README.P9000   README.WstDig  README.cirrus   README.neo        VGADriver.Doc
COPYRIGHT   README.Config   README.MGA      README.S3      README.agx     README.clkprog  README.rendition  VideoModes.doc
Devices     README.DECtga   README.Mach32   README.S3V     README.apm     README.cyrix    README.trident    xinput
Monitors    README.DGA      README.Mach64   README.SiS     README.ark     README.epson    README.tseng

(Note that this may have changed considerably with X version 4.) As you can see, there is documentation for each type of graphics card. To learn how to configure X is a simple matter of reading the QuickStart guide and then checking the specifics for your card.

XFree86 Web Site

New graphics cards are coming out all the time. XFree86 <http://www.xfree86.org> contains FAQ's about cards and the latest binaries, should you not be able to get your card working from the information below. Please always search the XFree86 site for info on your card and for newer X releases before reporting a problem45.8.

Configuring X

The above documentation is a lot to read. A simple and reliable way to get X working is given by the following steps (if this fails, then you will have to read more):
1
Backup your /etc/X11/XF86Config to /etc/X11/XF86Config.ORIG
2
Run SuperProbe. It will cause you screen to blank, then spit out what graphics card you have. Leave that info on your screen and switch to a different virtual terminal.
3
Run xf86config. This is the official X configuration script. Run through all the options, being very sure not to guess. You can set your monitor to 4 31.5, 35.15, 35.5; Super VGA... if you have no other information to go on. Vertical sync can be set to 50-90. Select your card from the card database (check the SuperProbe output), and check which X server the program recommends -- this will be one of XF86_SVGA, XF86_S3, XF86_S3V, etc. Whether you ``set the symbolic link'' or not is irrelevant.
4
Do not run X at this point.
5
The xf86config file should have given you an initial /etc/X11/XF86Config file to work with. You need not run it again. You will notice that the file is divided into sections. Search for the Section "Monitor" section. A little down you will see lots of lines like:

 
 
 
 
5 
 
 
 
# 640x400 @ 70 Hz, 31.5 kHz hsync
Modeline "640x400"     25.175 640  664  760  800   400  409  411  450
# 640x480 @ 60 Hz, 31.5 kHz hsync
Modeline "640x480"     25.175 640  664  760  800   480  491  493  525
# 800x600 @ 56 Hz, 35.15 kHz hsync
ModeLine "800x600"     36     800  824  896 1024   600  601  603  625
# 1024x768 @ 87 Hz interlaced, 35.5 kHz hsync
Modeline "1024x768"    44.9  1024 1048 1208 1264   768  776  784  817 Interlace

These are timing settings for different monitors and screen resolutions. Choosing one too fast could blow an old monitor, but will at best give you a lot of garbled fuzz on your screen. We are going to eliminate all but the first four -- do so by commenting them out with # or deleting the lines entirely. (You may want to backup the file first.) You could leave it up to X to choose the correct mode-line to match the capabilities of the monitor, but this doesn't always work. I always like to explicitly choose my Modelines.
Then further on, replace all "640x480" "800x600" "1024x768" with "1024x768" "800x600" "640x480" wherever you see it in the file. Delete "1280x1024" wherever you see it.
Finally, you can exit and run the server suggested previously by xf86config. If this works, create a shell script /etc/X11/X.sh with (execute permissions), containing:

 
 
#!/bin/sh
exec /usr/X11R6/bin/<server> -bpp 16

and then link /usr/X11R6/bin/X to this script; and also link /etc/X11/X to this script. -bpp stands for bytes-per-pixel, but I think will change to -depth in X version 4. Note that this is not a clean way of doing things -- but is often the easiest way to get your X server running in TrueColor45.9 mode.

Window managers

Manually starting X and then running an application is not the way to use X. We want a window manager to run applications properly. The best window manager available is icewm, available from icewm.cjb.net <http://icewm.cjb.net/>. Window managers enclose each application inside a resizable bounding box, and give you minimise and maximise buttons, as well as possibly a task bar and a ``start'' button that you may be familiar with. A window manager is just another X application has the additional task of managing the positions of basic X applications on your desktop.
If you don't have icewm, the twm window manager will almost always be installed. Run twm and click on the background with different mouse buttons.
Clicking on the background is a common convention of X user interfaces. Different mouse buttons may bring up a menu or a list of actions. It is often analogous to a ``start'' button.
There is an enormous amount of religious attention given to window managers. There are about 20 useful choices to date. Remember that any beautiful graphics a window manager displays are going to irritate you after a few hundred hours sitting in front of the computer. You also don't want a window manager that eats to much memory, or uses to much space on the screen.

Login screen

The action of starting an X server, then a window manager should obviously be automated. init runs mgetty which displays a login: prompt to every attached character terminal. init can also run xdm which displays a graphical login box to every X server. Usually there will only be one X server: the one on your very machine.
The interesting lines inside your inittab file are

 
id:5:initdefault:

and

 
x:5:respawn:/usr/X11R6/bin/xdm -nodaemon

which states that the default run-level is 5 and that xdm should be started at run level 5. This should only be attempted if you are sure that X works. If it doesn't then xdm will keep trying to start X, effectively disabling the console.

If your machine is not configured to run X from startup, after logging in at the terminal, you can type startx. The command xinit was used historically, but LINUX has the more sophisticated startx wrapper script in place.

Soap

A general rule of thumb in interface design is that you don't know how you are going to feel about being with a feature for a thousand hours, until you have actually been with that feature for a thousand hours. In other words, GUI design is an empirical and not a philosophical exercise. It is for this reason that many applications fail to be excellent user interfaces because the designers try to think ahead instead of thinking back.
Another rule is that its faster to keep your keys on the keyboard and never use a mouse (drawing applications excluded of course).
If you do any serious work with LINUX you are going to spend 99.5% of the time inside 5 different applications. You don't need a fancy desktop to organise these. You are going to tend toward minimalism. For this reason, these large desktop user interfaces like Gnome and KDE are really only for the inexperienced user.

next up previous contents index
Next: Unix Security Up: Rute Users Tutorial and Previous: Kernel, devices   Contents   Index
Paul Sheer 2000-10-07