|
|
|
An Introduction to XCopyright © 1998 Glenn RamalhoWith today's high availability of graphics capable stations windows based environments have become very valuable in aiding people to get their work done. Under UNIX, one of the most popular windows based systems is the X Window System. This makes it a must to learn how to use, but to understand this system we must look at a overall of how X works and the parts involved it it. X server/X clientThe X Window System can be separated in two parts, the X server and the X client. This differs from the definitions of 'server' and 'client' that you might have heard in other places, so let's push out the idea of the big central server and several little clients connected to them. These are the definitions of X's server and client:
Users who are familiar with other windowing systems like NeXT Step, MacOS, SunView and Microsoft Windows, might notice that these systems are structured similarly to X. These other environments provide a graphical engine under which several clients can be started. Two main differences give X a lot of flexibility over several other systems. The first one, covered in the next section, is X's internal communication mechanism. The other one is X's user interface, which I will explain later in the Window Managers section. Client/Server Communication: The X protocolOther windowing systems typically provide some Application Programmer Interface (API) that handles getting messages between the different programs. The API is usually implemented using function calls and system calls. The engine then has direct access to the memory of the client. Depending on how this API operates, the system can work with little overhead. Unfortunately, these techniques usually constrain the communications to one computer as all the clients and the graphical engine share a set of local resources. By contrast, X is based on an asynchronous network protocol. Any time an X server needs to send a message to an X client, the client must prepare a bit stream with details of what needs to be done. The same occurs in the opposite direction. If an X client needs its window updated on the screen, for example, it must generate a message with exactly what changes must be made. This message is then sent via the X protocol to the server that then interprets and processes the request. This encoding and decoding of messages adds some overhead to the system, but it is usually quite low. The major advantage is all communication is done through a networking protocol, so X clients are already network ready without special extra work from the programmer. X tries to hide the idea of multiple machines by moving towards a distributed environment. Let's take a network with five machines as an example: Window ManagersThe other difference between X and many other windowing systems is where the interface is processed. Under X, the X server does not handle the user interface. This task is performed by one of the clients, the window manager, that is responsible for setting up the aspect of the borders of the windows and any pop up menus that may come up when you click on the root window - the space on the screen behind the other X clients. Other common tasks handled by the window manager include starting other X clients, moving, rearranging and switching between X programs. Some window managers also provide an area on the screen with a set of icons that start different X clients by clicking on them. You may only have one window manager running on each X server at a time. This X client usually is on the same computer as the X server but this is not required. In particular, the X terminals use a remote window manager. There is nothing wrong with a user using one window manager for some time and then switch over to another one on the same X server. Each X distribution comes with a set of window managers. If you do not like them, there are also several third party ones, both commercial and free. Find something you feel comfortable and use it. Some of the commercial distributions X come with a small set of window managers that they consider standard. As Prof. Jose' Fortes, one of my professors in college once told me: "The nice thing about standards is there are so many to choose from", (orig. author is Andrew Tannenbaum -- ed.) so this list varies quite a bit. If you use a lot of commercial software, you might want to check with any companies that you have support contracts with to make sure they do not require a specific window manager to be used. To reduce their work, some commercial software vendors will not provide technical support to users that do not use specific window managers. Incompatibilities between X programs and the window manager are rare but they do occur. A wide selection of window managers is available. Each provides its own look and feel and list of features. Some window managers can get an X session look like other windowing environments, like NeXT Step, Plan 9, Windows 95, MacOS, etc. There are also window managers that specialized low memory usage, ease to use, high configurability, etc. Some popular window managers are: twm, vtwm, olwm, olvwm, fvwm, fvwm95, afterstep, dtwm, vuewm. Some come bundled in other larger packages while others are available separately. The NewHoo search engine provides several links to different window manager home pages and window manager comparisons. You also can search the Ports/Packages collection for FreeBSD, OpenBSD and NetBSD. All three provide extensive lists of window managers. If all this is not enough, there is a site (http://www2.osk.3web.ne.jp/~heuy/html3/index.shtml) with one of the largest lists of window managers I have ever seen. Unfortunately, this site is in Japanese. Even if you do not understand Japanese, you can still use the site to get screen shots and down load copies of the programs. LibrariesTo make the programmer's job easier, X comes with a set of libraries with functions that communicate with the X server. The Xlib library (libX11) is the most basic level and it is just enough to use X, which makes it cumbersome to program with. To make life easier for the programmers and help standardize the look of X programs, there are several other libraries, referred to as toolkits, that can be used in conjunction with Xlib. They contain functions that implement common tasks. Of course, it is possible to use Xlib directly, but that requires more effort and tedious, repetitive work. Some examples of common tool kits are the X toolkit (libXt), the Motif Toolkit (libXm) and the Tk toolkit (libtk). Several libraries are available, each one with different features and short cuts. Some of them are commercial and others are freely available on the net. Most libraries are available both as static or as shared libraries. For precompiled binaries, you might need to install some of these shared libraries. Note that usually it is the X client, not the X server, that makes calls to these libraries, so they need to be on the same machine the X client starts up from. AvailabilityA version of the X Window System is licensed by The Open Group to third party developers that distribute ports of the software together with their own work. For the free UNIXes, there are both commercial and free X distributions. Each one usually comes with one or more X servers plus a window manager and a few other basic X clients. The standard X libraries are also included. The XFree86 Project, Inc. has an X package that is freely distributed and many times found bundled together with the installation CDs for the three free BSDs. S.u.S.E, GmbH provides a freely available enhanced X server developed jointly with The XFree86 Project, Inc. that runs on all three OSes. Metro Link, Inc. and Xi Graphics, Inc. also provide commercial versions of enhanced versions of the X Windows System for FreeBSD. You can purchase these versions with support contracts. You can also run an X server or X clients on non-UNIX systems. Exceed is an X server from Hummingbird Communications Ltd. that runs on PCs under several versions of Microsoft Windows and Apple Macintosh computers running MacOS. MacX is an X server that Apple Computer, Inc. made for Macs. WinDD is an X client from Tektronix, Inc. that sends the output of Microsoft Windows NT based programs to any X server on any system including UNIX based systems. The X clients and X libraries mentioned here are distributed either separately or incorporated in several versions of the X Window System. There is a set of window managers and other X clients that come with most X Window System distributions. There are several other files also available on the net. One of the popular places to find them is the X Consortium's ftp site. NewHoo also has a nice list on their XWindows page. X clients are sometimes bundled in a package that includes a set of clients and libraries that work together. Common examples of these packages are the Common Desktop Environment (CDE) from The Open Group, OpenWindows from Sun Microsystems, Inc. and the K Desktop Environment (KDE). Xi Graphics provides a port CDE to the free BSDs for a price. OpenLook's window managers, olwm and olvwm, were ported to FreeBSD and can be found in the FreeBSD's ports collection. KDE was fully ported to all three UNIXes and it is distributed under the GPL. As the X clients come from different people they usually have very different sets of features and looks. To make X easier to use, the KDE developers are porting and are standardizing the apparence and features of many X tools. The X Window System is an advanced windowing environment that works well over a network or on a single computer. Its portability and flexibility also make it very popular. X provides a modular system that gives the users freedom to modify different parts while maintaining portability between different systems. X is available for free. Some vendors also sell enhanced versions of X with technical support.
Glenn Ramalho, ramalho@best.com
|
||