rhl55.htm
来自「linux的初学电子书」· HTM 代码 · 共 1,689 行 · 第 1/3 页
HTM
1,689 行
<HTML>
<HEAD>
<TITLE>Red Hat Linux Unleashed rhl55.htm </TITLE>
<LINK REL="ToC" HREF="index-1.htm" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/index.htm">
<LINK REL="Index" HREF="htindex.htm" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/htindex.htm">
<LINK REL="Next" HREF="rhl56.htm" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/rhl56.htm">
<LINK REL="Previous" HREF="rhl54.htm" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/rhl54.htm"></HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080">
<A NAME="I0"></A>
<H2>Red Hat Linux Unleashed rhl55.htm</H2>
<P ALIGN=LEFT>
<A HREF="rhl54.htm" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/rhl54.htm" TARGET="_self"><IMG SRC="purprev.gif" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/purprev.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Previous Page"></A>
<A HREF="index-1.htm" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/index.htm" TARGET="_self"><IMG SRC="purtoc.gif" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/purtoc.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="TOC"></A>
<A HREF="rhl56.htm" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/rhl56.htm" TARGET="_self"><IMG SRC="purnext.gif" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/purnext.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Next Page"></A>
<HR ALIGN=CENTER>
<P>
<UL>
<UL>
<UL>
<LI>
<A HREF="#E68E420" >What Is PEX?</A>
<LI>
<A HREF="#E68E421" >PEX Server</A>
<LI>
<A HREF="#E68E422" >Building a Server</A>
<UL>
<LI>
<A HREF="#E69E541" >Writing Your Own Driver</A></UL>
<LI>
<A HREF="#E68E423" >Getting PEX</A>
<LI>
<A HREF="#E68E424" >Sample PEX Source File</A>
<LI>
<A HREF="#E68E425" >PEXlib and Motif</A>
<UL>
<LI>
<A HREF="#E69E542" >Initializing the Toolkit</A>
<LI>
<A HREF="#E69E543" >Creating the Window</A></UL>
<LI>
<A HREF="#E68E426" >Where To Look for More Information</A>
<LI>
<A HREF="#E68E427" >Summary</A></UL></UL></UL>
<HR ALIGN=CENTER>
<A NAME="E66E55"></A>
<H1 ALIGN=CENTER>
<CENTER>
<FONT SIZE=6 COLOR="#FF0000"><B>55</B></FONT></CENTER></H1>
<BR>
<A NAME="E67E55"></A>
<H2 ALIGN=CENTER>
<CENTER>
<FONT SIZE=6 COLOR="#FF0000"><B>Adding Server Support for PEX</B></FONT></CENTER></H2>
<BR>
<P>This chapter is really two chapters in one. I will discuss two topics here:
<BR>
<UL>
<LI>Building a new server for X.
<BR>
<BR>
<LI>To build this new server, we will add PEX support to it. This will serve as an example of how to add more capabilities to the X server.
<BR>
<BR>
</UL>
<P>After you read this chapter, you will have an idea of how to draw to an X drawable, and use Motif and PEX together. This chapter is not a tutorial on PEX, nor will you become the world's expert on writing additions to X servers. This chapter will
introduce you to techniques that you can use to add features to the X server. You will also learn where to look for more information about PEX and X servers.
<BR>
<BR>
<A NAME="E68E420"></A>
<H3 ALIGN=CENTER>
<CENTER>
<FONT SIZE=5 COLOR="#FF0000"><B>What Is PEX?</B></FONT></CENTER></H3>
<BR>
<P>The X Window system is primarily a two-dimensional graphical system. Due to the lack of standards in the three-dimensional (3-D) area, there hasn't been an evolution of good 3-D developmental tool libraries. However, PEX is supposed to alleviate this
problem by providing a consistent set of toolkit calls, which enables a user to support 3-D software with little effort.
<BR>
<P>PEX originally stood for PHIGS Extensions to X. PHIGS stands for Programmer's Hierarchical Interactive Graphics System. PEX has been adopted by the Common Open Software Environment (COSE) for X11 releases that are later than 2.2.
<BR>
<P>However, PEX is simply historical at this point, because the last version of the PEX protocol (Version 6.0) is not designed specifically for PHIGS at all. PEX is now designed to support 3-D application programs. PEX is an extension to the Core X
Protocol to provide 3-D graphics support within the X Window environment. Included in the X11R5 distribution is code for the Sample Implementation of the extensions to the X Window server, which implements the functionality defined by the PEX Protocol
Extensions.
<BR>
<P>In order to access the PEX functional extensions to the X server, one must use an application that generates PEX Protocol. The application can either generate the Protocol bytestream itself, or use something called an Application Protocol Interface
(API). One such API provided with the X11R5 distribution is the PHIGS 3D graphics standard. This is a port of the PHIGS C language binding onto an internal layer, which generates the PEX Protocol enabling this particular PHIGS implementation to work within
the X Window environment. Other alternate APIs are available via anonymous FTP from <A HREF="tppmsgs/msgs0.htm#85" tppabs="ftp://export.lcs.mit.edu/">export.lcs.mit.edu</A>.
<BR>
<P>When discussing PEX, it is important not to confuse the protocol with the API. The API is the conceptual model of 3-D graphics that the application developer sees when developing a client program. The PEX protocol is generated by the API, and is
interpreted by the X server to perform graphics requests on behalf of the client program.
<BR>
<P>One API provided with the R5 PEX-SI is a PHIGS/PHIGS-PLUS API. The PHIGS/PHIGS-PLUS standards are specified in two parts. First, a functional description explains each operation conceptually, in a language-independent manner. Second, language bindings
are used to bind the particular PHIGS functions to the semantics of the language. The PEX-SI comes with an application programmer interface that conforms to the latest revision of the PHIGS/PHIGS-PLUS C language binding.
<BR>
<P>If your version of R5 is patched through patch number 22, you have a second MIT-supplied API called PEXlib. PEXlib is to the PEX protocol what Xlib is to the core X protocol. PEXlib provides an interface that is as close as possible to a one-to-one
correspondence between functions and protocol requests. It is intended to be a systems programming interface (so, people developing graphics toolkits and graphics systems will implement their system on top of PEXlib). It is proposed that the PHIGS API be
ported to PEXlib when PEXlib is finalized. This change would not affect programs written to the existing PHIGS API.
<BR>
<P>However, because PEXlib is intimately tied to the protocol, it is expected that there will be changes between the current PEXlib (which supports Version 5.0 and 5.1 of the PEX protocol) and the PEXlib that supports the next major version of the PEX
protocol, Version 6.0. Naturally, every attempt will be made to make the changes to the API minimal. The nature of the changes from 5.1 to 6.0 are not such that every primitive will be affected; rather the changes deal with the sticky problems of subsets,
multibuffering, and other issues of global rendering semantics.
<BR>
<BR>
<A NAME="E68E421"></A>
<H3 ALIGN=CENTER>
<CENTER>
<FONT SIZE=5 COLOR="#FF0000"><B>PEX Server</B></FONT></CENTER></H3>
<BR>
<P>Find out whether you have PEX available on your X server first. By default, PEX support is not built into the servers you received for Linux. The xdpyinfo command displays all the extensions supported by a server.
<BR>
<P>Output from the PEX command should contain strings of the following form:
<BR>
<PRE>
<FONT COLOR="#000080">number of extensions: 7
XTestExtension1
SHAPE
MIT-SHM
X3D-PEX (<— This is the line you are looking for)
Multi-buffering
MIT-SUNDRY-NONSTANDARD</FONT></PRE>
<P>If one of the extensions listed is X3D-PEX, your server supports PEX. If you do not see this line, you must build the server yourself.
<BR>
<BR>
<A NAME="E68E422"></A>
<H3 ALIGN=CENTER>
<CENTER>
<FONT SIZE=5 COLOR="#FF0000"><B>Building a Server</B></FONT></CENTER></H3>
<BR>
<P>To build a server that only includes the drivers you need, use the LinkKit instead of compiling the complete X system. Using the LinkKit package is much easier. The LinkKit package can be found in /usr/X386/lib/Server.
<BR>
<P>The LinkKit package contains a file called site.def for you to edit. The site.def file contains the site-specific information for your system. Edit the site.def file to define which servers you want to build, and the drivers and font renderers (programs
that generate fonts for display) you want to include.
<BR>
<BLOCKQUOTE>
<BLOCKQUOTE>
<HR ALIGN=CENTER>
<BR>
<NOTE>You must run all the commands in this section as root.</NOTE>
<BR>
<HR ALIGN=CENTER>
</BLOCKQUOTE></BLOCKQUOTE>
<P>Let's examine the site.def file in a bit of detail. See Listing 55.1 for the site.def file that I used to create a PEX server for my machine.
<BR>
<P>
<FONT COLOR="#000080"><B>Listing 55.1. Sample </B><B>site.def</B><B> file.</B></FONT>
<BR>
<PRE>
<FONT COLOR="#000080">XCOMM $XFree86: mit/server/ddx/x386/LinkKit/site.def.LK,v 2.11
1994/04/10 05:49:56 dawes Exp $
/* Configuration file for Server Link Kit */
#ifdef BeforeVendorCF
/*
* Change these definitions if you need to override the defaults:
*/
/*
* HasGcc: defaults:
* SVR3,4: YES
* Mach, 386bsd: YES
*/
/* #define HasGcc NO */
/*
* HasGcc2: (should also set HasGcc)
* defaults:
* SVR3,4: YES
* Mach: YES
* 386bsd: NO
*/
/* #define HasGcc2 NO */
/*
* If the link kit you are using was built with gcc2, and you are using
* a different compiler:
* 1. Install libgcc.a in a directory searched by your 'ld'
* 2. Set NeedLibGcc to YES
*/
#define NeedLibGcc NO
/*
* Uncomment this if you want to link with the Gnu malloc library
*/
/* #define GnuMalloc YES */
/*
* GnuMallocLib: link-time flags to include the Gnu malloc library.
* this is only used when GnuMalloc is set to YES.
* defaults:
* 386bsd: -lgnumalloc
* others: -lgmalloc
*/
/* #define GnuMallocLib -L/usr/local/gnu -lmalloc */
/*
* Server configuration parameters
*/
#define FontRenderers Speedo Type1
#define X386Vga2Drivers et4000 et3000 pvga1 gvga tvga8900 ncr \
compaq oak generic
#define X386Vga16Drivers et4000 tvga8900 generic
#define X386Vga256Drivers et4000 et3000 pvga1 gvga ati tvga8900 cirrus \
ncr compaq oak
#define X386Hga2Drivers /**/
/* To enable the hga2 driver, replace the above line with the following */
/* #define X386Hga2Drivers hga6845 */
/*
* To include the generic banked monochrome driver in the monochrome server,
* uncomment this with one of the following low level drivers
* hgc1280 [Hyundai HGC-1280 1280x1024]
* sigma [Sigma L-View]
* visa [???]
* apollo [???]
* ...
* (list is subject to grow)
*/
/* #define X386Bdm2Drivers hgc1280 sigma visa apollo */
/* #define XF86S3Drivers mmio_928 s3_generic */
/*
* Set which servers to build. Change the YES to NO for servers you don't
* want to build.
*/
/* The SVGA color server */
#define XF86SVGAServer YES
/* The 16-color VGA server */
#define XF86VGA16Server NO
/* The VGA mono server */
#define XF86MonoServer NO
/* The S3 server */
#define XF86S3Server NO
/* The IBM 8514/A server */
#define XF86I8514Server NO
/* The Mach8 server */
#define XF86Mach8Server NO
/* The Mach32 server */
#define XF86Mach32Server NO
/* Set the default server (ie the one that gets the sym-link to "X") */
/* #define XFree86DefaultServer XF86_S3 */
/*
* If you want PEX (and this link kit was built with PEX support), uncomment
* the following
*/
/* #define BuildPexExt YES */
#define BuildPexExt YES
#endif /* BeforeVendorCF */
#ifdef AfterVendorCF
/* If you are using a different ProjectRoot, set it here */
/*
#ifdef ProjectRoot
#undef ProjectRoot
#endif
#define ProjectRoot /usr/X11R5
*/
#endif /* AfterVendorCF */</FONT></PRE>
<P>Note the following items about this site.def file:
<BR>
<UL>
<LI>The HasGcc and HasGcc2 definitions have been commented out for Linux.
<BR>
<BR>
<LI>If the LinkKit was built with gcc-2.x and you are using some other compiler, you must install libgcc.a and set NeedLibGcc to YES.
<BR>
<BR>
</UL>
<P>For Linux, NeedLibGcc is set to NO.
<BR>
<P>The servers available to you via LinkKit are shown in Table 55.1. To create any of these servers, you have to set the value of the corresponding variable to YES.
<BR>
<BR>
<P ALIGN=CENTER>
<CENTER>
<FONT COLOR="#000080"><B>Table 55.1. Server types in </B><B>site.def</B><B>.</B></FONT></CENTER>
<BR>
<TABLE BORDERCOLOR=#000040 BORDER=1 CELLSPACING=2 WIDTH="100%" CELLPADDING=2 >
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
<I>Server Type</I>
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
<I>Variable To Set</I></FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
256-color server
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
XF86SVGAServer</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
16-color server
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
XF86VGA16Server</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Monochrome server
</FONT>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?