Solaris X Window System Developer's Guide
只搜尋這本書
以 PDF 格式下載這本書

Introduction to the Solaris X Server

1

This chapter provides information on the Solaris X server. The Solaris X server implements the X Window System client-server model for the Solaris product. The chapter includes information on the following topics:
  • Features of the Solaris X server, including supported extensions from the X Consortium and the Display PostScript extension
  • Supported and unsupported X11 applications
  • OpenWindows(TM) directory structure

About the Solaris X Server

The Solaris X server, XSun, is composed of the X Consortium's X11R6 sample server with the Display PostScript (DPS) imaging system extension, additional X Consortium X extensions, and Sun added value. The Solaris X server is the foundation for the Common Desktop Environment (CDE) and underlies the CDE desktop. The server handles communication between client applications, the display hardware, and input devices. By default, the Solaris X server runs with the CDE dtlogin and window manager (dtwm), but any X Window System manager that is ICCCM (Inter-Client Communication Conventions Manual) compliant runs with the server. Software developers can write applications for the Solaris environment using the Xlib library or a variety of toolkits, including the Motif toolkit and the Xt toolkit.
Figure 1-1 illustrates the relationship between the Solaris X server, several desktop client applications, the display, and input devices.

圖形

Figure 1-1

X11R6 Sample Server

An important component of the Solaris X server is the X11R6 sample server from the X Consortium. The X11R6 sample server was designed and implemented to be portable; it hides differences in the underlying hardware from client applications. The sample server handles all drawing, interfaces with device drivers to receive input, and manages off-screen memory, fonts, cursors, and colormaps.
The sample server contains the following parts, or layers:
  • Device-Independent Layer (DIX) - Dispatches client requests, manages the event queue, distributes events to clients, and manages visible data structures. This layer contains functions that do not depend on graphics hardware, input devices, or the host operating system.
  • Device-Dependent Layer (DDX) - Creates and manipulates pixmaps, clipping regions, colormaps, screens, fonts, and graphics contexts. In addition, the DDX layer collects events from input devices and relays them to the DIX layer. This layer contains routines that depend on graphics hardware and input devices the server must accommodate.
  • Operating System Layer (OS) - Manages client connections and connection authorization schemes, and provides routines for memory allocation and deallocation. The OS layer contains functions that rely on the host operating system.
  • Font Management Library - The font management library enables the server to use font files of different formats and to load fonts from the X font server. The server's font features are described in detail in Chapter 4, "Font Support."
Figure 1-2 illustrates the structure of the server. Note that throughout this document, server is used interchangeably with the Solaris X server, and sample server is used interchangeably with the X Consortium's X11R6 sample server.

圖形

Figure 1-2

DPS Extension

In addition to the X11R6 sample server, the Solaris X server includes the Display PostScript system. DPS provides X applications with the PostScript imaging model and with access to the Adobe Type Library. The Display PostScript system is implemented as an extension to the X Window System as part of the client-server network architecture; the extension is sometimes referred to as DPS/X.1
In the DPS system, the PostScript interpreter is implemented as an extension to the X server, and each application is a client. The application sends PostScript language code to the server through single operator calls, and data can be returned from the server in the form of output arguments. DPS client-server communication is implemented transparently using the low-level communication protocols provided by the X Window System. For more information on the DPS system, see Chapter 2, "DPS Features and Enhancements".

X Consortium Extensions

The Solaris X server supports X extensions as defined by the X Consortium. These extensions are briefly described in the sections below. The sections provide the specification name for each extension, as well as the associated file name (on ftp.x.org) in parentheses. For information on the standard X Extension Mechanism, see The X Window System Server and the Xlib Programming Manual.
The X Consortium X11 standards referenced in the following sections are readily available to systems on the World Wide Web. The URL is http://www.rdg.opengroup.org The X11 documentation resides in the /pub/R6untarred/mit/doc/extensions directory on the ftp.x.org machine. Use the file transfer protocol (ftp) to download files from this system. If you need help using ftp, refer to the ftp(1) man page. To determine if your system is connected to the World Wide Web, see your system administrator.

1. This section is based on Chapter 2 of Programming the Display PostScript System with X by Adobe Systems Incorporated (Addison-Wesley Publishing Company, Inc., 1993) and is used with the permission of the copyright holder.

X Input Extension

The X Input Extension is Sun's implementation of the X Consortium standard, X11 Input Extension Protocol Specification
(/pub/X11/R6.1/xc/doc/specs/Xi/protocol.ms). This extension controls access to alternate input devices (that is, other than the keyboard and pointer). It allows client programs to select input from these devices independently of each other and independently of the core devices.

Double Buffer Extension

The double buffer extension (DBE) is Sun's implementation of the X Consortium standard. Double-buffering provides flicker-free animation capabilities by allowing applications to show the user only completely rendered frames. Frames are rendered in a non-displayed buffer and then moved into a displayed buffer.

Shape Extension

The Shape Extension is Sun's full implementation of the X Consortium standard, X11 Nonrectangular Window Shape Extension (shape.ms). This extension provides the capability of creating arbitrary window and border shapes within the X11 protocol.

Shared Memory Extension

The Shared Memory extension is Sun's full implementation of the X Consortium experimental Shared Memory Extension (mit-shm.ms). This extension provides the capability to share memory XImages and pixmaps by storing the actual image data in shared memory. This eliminates the need to move data through the Xlib interprocess communication channel; thus, for large images, system performance increases. This extension is useful only if the client application runs on the same machine as the server.

XTEST Extension

The XTEST extension is Sun's full implementation of the X Consortium proposed standard, X11 Input Synthesis Extension Proposal (xtest1.mm). This extension provides the capability for a client to generate user input and to control user input actions without a user being present. This extension requires modification to the DDX layer of the server.

Miscellaneous Extension

The MIT-SUNDRY-NONSTANDARD extension was developed at MIT and does not have a standard, or specification, on the ftp.x.org machine. This extension handles miscellaneous erroneous protocol requests from X11R3 and earlier clients. It provides a request that turns on bug-compatibility mode so that certain erroneous requests are handled or turns off bug-compatibility mode so that an error for erroneous requests is returned. The extension also provides a request that gets the current state of the mode.
This extension can be dynamically turned on or off with xset, or at server startup with openwin. See the xset(1) and openwin(1) man pages, specifically the -bc option, for more information.

XC-MISC

This standard X Consortium extension allows an application to recycle XIDs. Some applications create and destroy XIDs so rapidly that they exceed the fixed range of XIDs. Most applications do not need to use this extension. The specification is in /pub/X11/xc/doc/specs/Xext/xc-misc.ms

X Imaging Extension

Sun's implementation of X includes the standard X Imaging Extension (XIE); however, it is recommended that you use Sun's XIL(TM) software instead. XIL uses hardware acceleration where possible to speed up imaging operations. XIL is documented in the XIL Programmer's Guide. To view the on-line version of this guide, see the Solaris XIL 1.3 AnswerBook located at the following web site: http://docs.sun.com

AccessX

The Solaris X server also supports keyboard features compliant with the American Disabilities Act (ADA). These features are available through an extension to the server, called AccessX. The AccessX extension provides the following capabilities: sticky keys, slow keys, toggle keys, mouse keys, bounce keys and repeat keys. Use the client program accessx to enable and disable these capabilities. The accessx client controls the toggle, bounce, and repeat keys and their settings. The sticky, slow, and mouse keys can be enabled using shift or other keys. For information on using AccessX, see the Solaris User's Guide.
Before running accessx, set the UIDPATH environment variable to /usr/openwin/lib/app-defaults/accessx.uid.
The accessx client is part of the SUNWxwacx package. To install it, you need to install the All Cluster.

Shared Memory Transport

The Solaris X server includes the Sun extension SUN_SME, Sun's implementation of a shared memory transport mechanism. This extension provides the capability of sending client requests to the server via shared memory. Shared memory is used for client requests only. Replies from the server and events are sent via the default transport mechanism. To enable this transport mechanism, set the DISPLAY environment variable to :x.y, where x is the display number, and y is the screen number, and set the environment variable XSUNTRANSPORT to shmem. The size of the segment can be set by setting the environment variable XSUNSMESIZE to the desired size in Kbytes. By default, XSUNSMESIZE is set to 64.

Visual Overlay Windows

The Solaris X server supports two application programmer's interfaces (APIs) that enable use of overlay windows. An overlay is a pixel buffer (either physical or software-simulated) into which graphics can be drawn. Applications can use overlays to display temporary imagery in a display window. For more information on the overlay APIs, see Chapter 5, "Server Overlay Windows," and Chapter 6, "Transparent Overlay Windows."

X11 Libraries

Table 1-1 lists the X11 libraries. The .so and .a files that comprise these libraries are in /usr/openwin/lib.
Table 1-1


Library


Description
Available
From the X
Consortium


Sun Value Added
libX11XlibYesMT safe

Dynamic loading of locale Search path includes /usr/openwin, New keysyms

libXauX Authorization libraryYesNone
libXawAthena Widget Set libraryYesNone
libXextX Extensions libraryYesBug fixes, transparent overlays
libXinputBinary compatibility library for previous input extensionNoSun library
libXiXinput Extension libraryYesBug fixes

Supports Solaris X extensions

libXmuX Miscellaneous Utilities libraryYesSearch path includes/usr/openwin
libXolOLIT libraryNoSun product--see the preface for a list of OLIT manuals (Available from USL)
libXtXt Intrinsics libraryYesNone
libxviewXView libraryYesSun product donated to X Consortium Bug fixes not included in X11R6 libxview

Applications That Run With the Solaris X Server

You can run the following kinds of applications with the Solaris X server:
  • Applications written with the following toolkits:

    · OpenWindows toolkits: OLIT and XView

    · Motif toolkit

    · Xt toolkit

  • Applications written for the X protocol
  • Applications written for the DPS interface
  • SPARC OpenWindows Version 3 X11 applications compiled under SunOS 4.x

Note - The OpenWindows Version 3 X11 applications must adhere to the system Binary Compatibility Package. See the Binary Compatibility Guide for more information.

  • x86 Applications from Interactive Unix
Applications written with the following interfaces are not supported:
  • TNT, NeWS, and XVPS
  • SunView, SunWindows, and Pixrect

Supported X11 Applications

The Solaris X server supports the following client applications available from the X Consortium. These clients are also included as part of the Solaris environment.
  • xterm....terminal emulator
  • twm.....window manager
  • xdm.....display manager
  • bitmap...bitmap editor
  • xfd.....font display utility
  • xauth....access control program
  • xhost....access control utility
  • xrdb....resource control program
  • xset....user preference setting program
  • xsetroot..root window appearance setting utility
  • xmodmap..keyboard control utility
  • xlsfonts..server font listing utility
  • xfontsel..font selection utility
  • xlswins..window listing utility
  • xwininfo..window information utility
  • xlsclients client applications information utility
  • xdpyinfo..server information display utility
  • xprop....window and font properties utility

Unsupported Applications

The following are some applications and libraries, all of which are available from the X Consortium, that run on the server but are not distributed or supported by Sun:
  • Andrew, InterViews
  • The uwm and wm window managers
  • The CLX Common Lisp interface
  • contrib X Consortium clients
iv>

OpenWindows Directory Structure

The OpenWindows directory structure, which includes the Solaris X server executable and X11 core distribution libraries, is shown in Figure 1-3 on page 11. Note that /openwin/etc is a symbolic link to /openwin/share/etc, /openwin/include is a link to /openwin/share/include, and /openwin/man is a link to /openwin/share/man. The /share directory contains architecture-independent files.
For more information on the X11 libraries in /openwin/lib, see page 8.

圖形

Figure 1-3

Table 1-2 briefly describes the contents of the top level directories in the OpenWindows directory structure.
Table 1-2
DirectorySubdirectoryContent
/etc/keytablesUS and international keytables, and keytable.map
/ttToolTalk(R) data files
/workspace/patterns (.xbm files and attributes)
/include/X11X11 header files, /DPS, /Xaw, /Xmu, /bitmaps, /extensions
/XauSymbolic link to /include/X11
/XolOLIT header files
/configgeneric.h header file
/desktopClassing engine header files
Table 1-2 (Continued)
DirectorySubdirectoryContent

/dgadga.h header file

/helplibhelp header files

/imagesVarious bitmap files

/olgxolgx header file

/pixrectPixrect header files

/portablec_varieties.h and portable.h header files

/xviewXView header files
/lib/X11Server support files, /fonts, and DPS .upr files

/XolOLIT data files

/app-defaultsX applications default files

/cetablesClassing Engine tables

/configimake files

/helpSymbolic link to /locale/C/help

/libpProfiles libraries

/localeLocale libraries (/C, /iso_8859_1)

/xdmXdm configuration files
/man/man1, /man1mOpenWindows command man pages

/man3Library man pages, for XView, OLIT, Xt, Xlib, etc.

/man4AnswerBook man pages

/man5File format man pages

/man6Demos man pages

/man7Non-command man pages
/serverServer private files for internal use only
/share/etcLocation of files in /etc

/images/PostScript, /fish, /raster

/includeLocation of files in /include

/localeLocation of files in /lib/locale
Table 1-2 (Continued)
DirectorySubdirectoryContent

/manLocation of files in /man

/src/dig_samples, /extensions, /fonts, /olit, /tooltalk, /xview

/xnews/client

Notes on X11 Programming

Common X11 programming issues are discussed in the following sections.

Compose Key Support

The OpenWindows version of Xlib supports Compose Key processing through calls to XLookupString.

For x86 systems - On x86 keyboards, use the Control-Shift-F1 key sequence for the Compose Key functionality.

NumLock Key Support

The OpenWindows version of Xlib supports NumLock Key processing through calls to XLookupString. This change does not affect the NumLock processing that exists in XView, OLIT, Motif, or X applications.

For x86 systems - On x86 keyboards, the NumLock Key resides in the top line of the keypad section of the keyboard..

Color Name Database

The color name database provides a mapping between ASCII color names and RGB color values. This mapping increases the portability of color programs and eases programming. Note that this mapping is subjective and has no objective scientific basis.
The source of the database is /usr/openwin/lib/X11/rgb.txt. This file is identical to the one provided in X11R6 from the X Consortium. rgb.txt is compiled into the dbm(3) database files, rgb.dir and rgb.pag. When the server starts up, it builds an internal representation of rgb.dir and rgb.pag used to map a color name to a color value.
X11 clients use XLookupColor or XAllocNamedColor to map a color name to a color value. The color name string passed to these routines is converted to lowercase before it is looked up in the database.

Color Recommendations

This section contains recommendations for using the Solaris X server color support facilities. Use these hints to maximize portability and color sharing:
  • Do not rely on the locations of black and white in the default PseudoColor colormap. Always use XAllocColor to allocate a pixel for rendering.

Note - Do not rely on black and white being in certain pixel locations. Future versions of the Solaris X server and the servers of other vendors may have these colors located in different positions than the current server. For maximum portability and compatibility, always write X11 clients so that they use the XAllocColor function to allocate desired colors for rendering.

  • Do not use a visual before you have checked on all supported visual types, using XGetVisualInfo or XMatchVisualInfo. Note that XGetVisualInfo is the recommended function to use because it has the ability to distinguish between visuals of the same class and depth.
  • To reduce colormap flashing, it is usually a good policy to try to first allocate colors from the default colormap. Only when this allocation fails should you create a private colormap.
  • For more hints on writing portable X11 color clients, see "Hints for Windows Programming With Visuals" on page 37.

Further Reading

There are numerous books on all aspects of X and the X Window System. For more information on the X Window System, see page xvii of the preface for a list of recommended books available through SunExpress and your local book store. For more information on the Solaris X server and the X Consortium sample server, see the following manual pages:
  • Xsun(1) - Solaris X server
  • Xserver(1) - the X Consortium sample server
  • openwin(1) - OpenWindows startup command