(original) (raw)
%!PS-Adobe-2.0 %%Creator: dvips(k) 5.92b Copyright 2002 Radical Eye Software %%Title: xlib_impl.dvi %%Pages: 11 %%PageOrder: Ascend %%BoundingBox: 0 0 612 792 %%DocumentFonts: Times-Bold Times-Roman Courier Times-Italic CMSY10 %%+ CMR10 %%EndComments %DVIPSWebPage: (www.radicaleye.com) %DVIPSCommandLine: dvips -t letter -q -Ppdf -G0 -Pcmz -Pamz -o %+ xlib_impl.ps xlib_impl.dvi %DVIPSParameters: dpi=8000, compressed %DVIPSSource: TeX output 2004.04.09:0021 %%BeginProcSet: tex.pro %! /TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S N}B/A{dup}B/TR{translate}N/isls false N/vsize 11 72 mul N/hsize 8.5 72 mul N/landplus90{false}def/@rigin{isls{[0 landplus90{1 -1}{-1 1}ifelse 0 0 0]concat}if 72 Resolution div 72 VResolution div neg scale isls{ landplus90{VResolution 72 div vsize mul 0 exch}{Resolution -72 div hsize mul 0}ifelse TR}if Resolution VResolution vsize -72 div 1 add mul TR[ matrix currentmatrix{A A round sub abs 0.00001 lt{round}if}forall round exch round exch]setmatrix}N/@landscape{/isls true N}B/@manualfeed{ statusdict/manualfeed true put}B/@copies{/#copies X}B/FMat[1 0 0 -1 0 0] N/FBB[0 0 0 0]N/nn 0 N/IEn 0 N/ctr 0 N/df-tail{/nn 8 dict N nn begin /FontType 3 N/FontMatrix fntrx N/FontBBox FBB N string/base X array /BitMaps X/BuildChar{CharBuilder}N/Encoding IEn N end A{/foo setfont}2 array copy cvx N load 0 nn put/ctr 0 N[}B/sf 0 N/df{/sf 1 N/fntrx FMat N df-tail}B/dfs{div/sf X/fntrx[sf 0 0 sf neg 0 0]N df-tail}B/E{pop nn A definefont setfont}B/Cw{Cd A length 5 sub get}B/Ch{Cd A length 4 sub get }B/Cx{128 Cd A length 3 sub get sub}B/Cy{Cd A length 2 sub get 127 sub} B/Cdx{Cd A length 1 sub get}B/Ci{Cd A type/stringtype ne{ctr get/ctr ctr 1 add N}if}B/CharBuilder{save 3 1 roll S A/base get 2 index get S /BitMaps get S get/Cd X pop/ctr 0 N Cdx 0 Cx Cy Ch sub Cx Cw add Cy setcachedevice Cw Ch true[1 0 0 -1 -.1 Cx sub Cy .1 sub]{Ci}imagemask restore}B/D{/cc X A type/stringtype ne{]}if nn/base get cc ctr put nn /BitMaps get S ctr S sf 1 ne{A A length 1 sub A 2 index S get sf div put }if put/ctr ctr 1 add N}B/I{cc 1 add D}B/bop{userdict/bop-hook known{ bop-hook}if/SI save N @rigin 0 0 moveto/V matrix currentmatrix A 1 get A mul exch 0 get A mul add .99 lt{/QV}{/RV}ifelse load def pop pop}N/eop{ SI restore userdict/eop-hook known{eop-hook}if showpage}N/@start{ userdict/start-hook known{start-hook}if pop/VResolution X/Resolution X 1000 div/DVImag X/IEn 256 array N 2 string 0 1 255{IEn S A 360 add 36 4 index cvrs cvn put}for pop 65781.76 div/vsize X 65781.76 div/hsize X}N /p{show}N/RMat[1 0 0 -1 0 0]N/BDot 260 string N/Rx 0 N/Ry 0 N/V{}B/RV/v{ /Ry X/Rx X V}B statusdict begin/product where{pop false[(Display)(NeXT) (LaserWriter 16/600)]{A length product length le{A length product exch 0 exch getinterval eq{pop true exit}if}{pop}ifelse}forall}{false}ifelse end{{gsave TR -.1 .1 TR 1 1 scale Rx Ry false RMat{BDot}imagemask grestore}}{{gsave TR -.1 .1 TR Rx Ry scale 1 1 false RMat{BDot} imagemask grestore}}ifelse B/QV{gsave newpath transform round exch round exch itransform moveto Rx 0 rlineto 0 Ry neg rlineto Rx neg 0 rlineto fill grestore}B/a{moveto}B/delta 0 N/tail{A/delta X 0 rmoveto}B/M{S p delta add tail}B/b{S p tail}B/c{-4 M}B/d{-3 M}B/e{-2 M}B/f{-1 M}B/g{0 M} B/h{1 M}B/i{2 M}B/j{3 M}B/k{4 M}B/w{0 rmoveto}B/l{p -4 w}B/m{p -3 w}B/n{ p -2 w}B/o{p -1 w}B/q{p 1 w}B/r{p 2 w}B/s{p 3 w}B/t{p 4 w}B/x{0 S rmoveto}B/y{3 2 roll p a}B/bos{/SS save N}B/eos{SS restore}B end %%EndProcSet %%BeginProcSet: alt-rule.pro %! % Patch by TVZ % Makes dvips files draw rules with stroke rather than fill. % Makes narrow rules more predictable at low resolutions % after distilling to PDF. % May have unknown consequences for very thick rules. % Tested only with dvips 5.85(k). TeXDict begin /QV { gsave newpath /ruleY X /ruleX X Rx Ry gt { ruleX ruleY Ry 2 div sub moveto Rx 0 rlineto Ry } { ruleX Rx 2 div add ruleY moveto 0 Ry neg rlineto Rx } ifelse setlinewidth 0 setlinecap stroke grestore } bind def end %%EndProcSet %%BeginProcSet: texc.pro %! /TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S N}B/A{dup}B/TR{translate}N/isls false N/vsize 11 72 mul N/hsize 8.5 72 mul N/landplus90{false}def/@rigin{isls{[0 landplus90{1 -1}{-1 1}ifelse 0 0 0]concat}if 72 Resolution div 72 VResolution div neg scale isls{ landplus90{VResolution 72 div vsize mul 0 exch}{Resolution -72 div hsize mul 0}ifelse TR}if Resolution VResolution vsize -72 div 1 add mul TR[ matrix currentmatrix{A A round sub abs 0.00001 lt{round}if}forall round exch round exch]setmatrix}N/@landscape{/isls true N}B/@manualfeed{ statusdict/manualfeed true put}B/@copies{/#copies X}B/FMat[1 0 0 -1 0 0] N/FBB[0 0 0 0]N/nn 0 N/IEn 0 N/ctr 0 N/df-tail{/nn 8 dict N nn begin /FontType 3 N/FontMatrix fntrx N/FontBBox FBB N string/base X array /BitMaps X/BuildChar{CharBuilder}N/Encoding IEn N end A{/foo setfont}2 array copy cvx N load 0 nn put/ctr 0 N[}B/sf 0 N/df{/sf 1 N/fntrx FMat N df-tail}B/dfs{div/sf X/fntrx[sf 0 0 sf neg 0 0]N df-tail}B/E{pop nn A definefont setfont}B/Cw{Cd A length 5 sub get}B/Ch{Cd A length 4 sub get }B/Cx{128 Cd A length 3 sub get sub}B/Cy{Cd A length 2 sub get 127 sub} B/Cdx{Cd A length 1 sub get}B/Ci{Cd A type/stringtype ne{ctr get/ctr ctr 1 add N}if}B/id 0 N/rw 0 N/rc 0 N/gp 0 N/cp 0 N/G 0 N/CharBuilder{save 3 1 roll S A/base get 2 index get S/BitMaps get S get/Cd X pop/ctr 0 N Cdx 0 Cx Cy Ch sub Cx Cw add Cy setcachedevice Cw Ch true[1 0 0 -1 -.1 Cx sub Cy .1 sub]/id Ci N/rw Cw 7 add 8 idiv string N/rc 0 N/gp 0 N/cp 0 N{ rc 0 ne{rc 1 sub/rc X rw}{G}ifelse}imagemask restore}B/G{{id gp get/gp gp 1 add N A 18 mod S 18 idiv pl S get exec}loop}B/adv{cp add/cp X}B /chg{rw cp id gp 4 index getinterval putinterval A gp add/gp X adv}B/nd{ /cp 0 N rw exit}B/lsh{rw cp 2 copy get A 0 eq{pop 1}{A 255 eq{pop 254}{ A A add 255 and S 1 and or}ifelse}ifelse put 1 adv}B/rsh{rw cp 2 copy get A 0 eq{pop 128}{A 255 eq{pop 127}{A 2 idiv S 128 and or}ifelse} ifelse put 1 adv}B/clr{rw cp 2 index string putinterval adv}B/set{rw cp fillstr 0 4 index getinterval putinterval adv}B/fillstr 18 string 0 1 17 {2 copy 255 put pop}for N/pl[{adv 1 chg}{adv 1 chg nd}{1 add chg}{1 add chg nd}{adv lsh}{adv lsh nd}{adv rsh}{adv rsh nd}{1 add adv}{/rc X nd}{ 1 add set}{1 add clr}{adv 2 chg}{adv 2 chg nd}{pop nd}]A{bind pop} forall N/D{/cc X A type/stringtype ne{]}if nn/base get cc ctr put nn /BitMaps get S ctr S sf 1 ne{A A length 1 sub A 2 index S get sf div put }if put/ctr ctr 1 add N}B/I{cc 1 add D}B/bop{userdict/bop-hook known{ bop-hook}if/SI save N @rigin 0 0 moveto/V matrix currentmatrix A 1 get A mul exch 0 get A mul add .99 lt{/QV}{/RV}ifelse load def pop pop}N/eop{ SI restore userdict/eop-hook known{eop-hook}if showpage}N/@start{ userdict/start-hook known{start-hook}if pop/VResolution X/Resolution X 1000 div/DVImag X/IEn 256 array N 2 string 0 1 255{IEn S A 360 add 36 4 index cvrs cvn put}for pop 65781.76 div/vsize X 65781.76 div/hsize X}N /p{show}N/RMat[1 0 0 -1 0 0]N/BDot 260 string N/Rx 0 N/Ry 0 N/V{}B/RV/v{ /Ry X/Rx X V}B statusdict begin/product where{pop false[(Display)(NeXT) (LaserWriter 16/600)]{A length product length le{A length product exch 0 exch getinterval eq{pop true exit}if}{pop}ifelse}forall}{false}ifelse end{{gsave TR -.1 .1 TR 1 1 scale Rx Ry false RMat{BDot}imagemask grestore}}{{gsave TR -.1 .1 TR Rx Ry scale 1 1 false RMat{BDot} imagemask grestore}}ifelse B/QV{gsave newpath transform round exch round exch itransform moveto Rx 0 rlineto 0 Ry neg rlineto Rx neg 0 rlineto fill grestore}B/a{moveto}B/delta 0 N/tail{A/delta X 0 rmoveto}B/M{S p delta add tail}B/b{S p tail}B/c{-4 M}B/d{-3 M}B/e{-2 M}B/f{-1 M}B/g{0 M} B/h{1 M}B/i{2 M}B/j{3 M}B/k{4 M}B/w{0 rmoveto}B/l{p -4 w}B/m{p -3 w}B/n{ p -2 w}B/o{p -1 w}B/q{p 1 w}B/r{p 2 w}B/s{p 3 w}B/t{p 4 w}B/x{0 S rmoveto}B/y{3 2 roll p a}B/bos{/SS save N}B/eos{SS restore}B end %%EndProcSet %%BeginProcSet: 8r.enc % File 8r.enc as of 2002-03-12 for PSNFSS 9 % % This is the encoding vector for Type1 and TrueType fonts to be used % with TeX. This file is part of the PSNFSS bundle, version 9 % % Authors: S. Rahtz, P. MacKay, Alan Jeffrey, B. Horn, K. Berry, W. Schmidt % % Idea is to have all the characters normally included in Type 1 fonts % available for typesetting. This is effectively the characters in Adobe % Standard Encoding + ISO Latin 1 + extra characters from Lucida + Euro. % % Character code assignments were made as follows: % % (1) the Windows ANSI characters are almost all in their Windows ANSI % positions, because some Windows users cannot easily reencode the % fonts, and it makes no difference on other systems. The only Windows % ANSI characters not available are those that make no sense for % typesetting -- rubout (127 decimal), nobreakspace (160), softhyphen % (173). quotesingle and grave are moved just because it's such an % irritation not having them in TeX positions. % % (2) Remaining characters are assigned arbitrarily to the lower part % of the range, avoiding 0, 10 and 13 in case we meet dumb software. % % (3) Y&Y Lucida Bright includes some extra text characters; in the % hopes that other PostScript fonts, perhaps created for public % consumption, will include them, they are included starting at 0x12. % % (4) Remaining positions left undefined are for use in (hopefully) % upward-compatible revisions, if someday more characters are generally % available. % % (5) hyphen appears twice for compatibility with both ASCII and Windows. % % (6) /Euro is assigned to 128, as in Windows ANSI % /TeXBase1Encoding [ % 0x00 (encoded characters from Adobe Standard not in Windows 3.1) /.notdef /dotaccent /fi /fl /fraction /hungarumlaut /Lslash /lslash /ogonek /ring /.notdef /breve /minus /.notdef % These are the only two remaining unencoded characters, so may as % well include them. /Zcaron /zcaron % 0x10 /caron /dotlessi % (unusual TeX characters available in, e.g., Lucida Bright) /dotlessj /ff /ffi /ffl /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef % very contentious; it's so painful not having quoteleft and quoteright % at 96 and 145 that we move the things normally found there down to here. /grave /quotesingle % 0x20 (ASCII begins) /space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quoteright /parenleft /parenright /asterisk /plus /comma /hyphen /period /slash % 0x30 /zero /one /two /three /four /five /six /seven /eight /nine /colon /semicolon /less /equal /greater /question % 0x40 /at /A /B /C /D /E /F /G /H /I /J /K /L /M /N /O % 0x50 /P /Q /R /S /T /U /V /W /X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore % 0x60 /quoteleft /a /b /c /d /e /f /g /h /i /j /k /l /m /n /o % 0x70 /p /q /r /s /t /u /v /w /x /y /z /braceleft /bar /braceright /asciitilde /.notdef % rubout; ASCII ends % 0x80 /Euro /.notdef /quotesinglbase /florin /quotedblbase /ellipsis /dagger /daggerdbl /circumflex /perthousand /Scaron /guilsinglleft /OE /.notdef /.notdef /.notdef % 0x90 /.notdef /.notdef /.notdef /quotedblleft /quotedblright /bullet /endash /emdash /tilde /trademark /scaron /guilsinglright /oe /.notdef /.notdef /Ydieresis % 0xA0 /.notdef % nobreakspace /exclamdown /cent /sterling /currency /yen /brokenbar /section /dieresis /copyright /ordfeminine /guillemotleft /logicalnot /hyphen % Y&Y (also at 45); Windows' softhyphen /registered /macron % 0xD0 /degree /plusminus /twosuperior /threesuperior /acute /mu /paragraph /periodcentered /cedilla /onesuperior /ordmasculine /guillemotright /onequarter /onehalf /threequarters /questiondown % 0xC0 /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla /Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis % 0xD0 /Eth /Ntilde /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply /Oslash /Ugrave /Uacute /Ucircumflex /Udieresis /Yacute /Thorn /germandbls % 0xE0 /agrave /aacute /acircumflex /atilde /adieresis /aring /ae /ccedilla /egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis % 0xF0 /eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide /oslash /ugrave /uacute /ucircumflex /udieresis /yacute /thorn /ydieresis ] def %%EndProcSet %%BeginProcSet: texps.pro %! TeXDict begin/rf{findfont dup length 1 add dict begin{1 index/FID ne 2 index/UniqueID ne and{def}{pop pop}ifelse}forall[1 index 0 6 -1 roll exec 0 exch 5 -1 roll VResolution Resolution div mul neg 0 0]FontType 0 ne{/Metrics exch def dict begin Encoding{exch dup type/integertype ne{ pop pop 1 sub dup 0 le{pop}{[}ifelse}{FontMatrix 0 get div Metrics 0 get div def}ifelse}forall Metrics/Metrics currentdict end def}{{1 index type /nametype eq{exit}if exch pop}loop}ifelse[2 index currentdict end definefont 3 -1 roll makefont/setfont cvx]cvx def}def/ObliqueSlant{dup sin S cos div neg}B/SlantFont{4 index mul add}def/ExtendFont{3 -1 roll mul exch}def/ReEncodeFont{CharStrings rcheck{/Encoding false def dup[ exch{dup CharStrings exch known not{pop/.notdef/Encoding true def}if} forall Encoding{]exch pop}{cleartomark}ifelse}if/Encoding exch def}def end %%EndProcSet %%BeginProcSet: special.pro %! TeXDict begin/SDict 200 dict N SDict begin/@SpecialDefaults{/hs 612 N /vs 792 N/ho 0 N/vo 0 N/hsc 1 N/vsc 1 N/ang 0 N/CLIP 0 N/rwiSeen false N /rhiSeen false N/letter{}N/note{}N/a4{}N/legal{}N}B/@scaleunit 100 N /@hscale{@scaleunit div/hsc X}B/@vscale{@scaleunit div/vsc X}B/@hsize{ /hs X/CLIP 1 N}B/@vsize{/vs X/CLIP 1 N}B/@clip{/CLIP 2 N}B/@hoffset{/ho X}B/@voffset{/vo X}B/@angle{/ang X}B/@rwi{10 div/rwi X/rwiSeen true N}B /@rhi{10 div/rhi X/rhiSeen true N}B/@llx{/llx X}B/@lly{/lly X}B/@urx{ /urx X}B/@ury{/ury X}B/magscale true def end/@MacSetUp{userdict/md known {userdict/md get type/dicttype eq{userdict begin md length 10 add md maxlength ge{/md md dup length 20 add dict copy def}if end md begin /letter{}N/note{}N/legal{}N/od{txpose 1 0 mtx defaultmatrix dtransform S atan/pa X newpath clippath mark{transform{itransform moveto}}{transform{ itransform lineto}}{6 -2 roll transform 6 -2 roll transform 6 -2 roll transform{itransform 6 2 roll itransform 6 2 roll itransform 6 2 roll curveto}}{{closepath}}pathforall newpath counttomark array astore/gc xdf pop ct 39 0 put 10 fz 0 fs 2 F/|______Courier fnt invertflag{PaintBlack} if}N/txpose{pxs pys scale ppr aload pop por{noflips{pop S neg S TR pop 1 -1 scale}if xflip yflip and{pop S neg S TR 180 rotate 1 -1 scale ppr 3 get ppr 1 get neg sub neg ppr 2 get ppr 0 get neg sub neg TR}if xflip yflip not and{pop S neg S TR pop 180 rotate ppr 3 get ppr 1 get neg sub neg 0 TR}if yflip xflip not and{ppr 1 get neg ppr 0 get neg TR}if}{ noflips{TR pop pop 270 rotate 1 -1 scale}if xflip yflip and{TR pop pop 90 rotate 1 -1 scale ppr 3 get ppr 1 get neg sub neg ppr 2 get ppr 0 get neg sub neg TR}if xflip yflip not and{TR pop pop 90 rotate ppr 3 get ppr 1 get neg sub neg 0 TR}if yflip xflip not and{TR pop pop 270 rotate ppr 2 get ppr 0 get neg sub neg 0 S TR}if}ifelse scaleby96{ppr aload pop 4 -1 roll add 2 div 3 1 roll add 2 div 2 copy TR .96 dup scale neg S neg S TR}if}N/cp{pop pop showpage pm restore}N end}if}if}N/normalscale{ Resolution 72 div VResolution 72 div neg scale magscale{DVImag dup scale }if 0 setgray}N/psfts{S 65781.76 div N}N/startTexFig{/psf$SavedState save N userdict maxlength dict begin/magscale true def normalscale currentpoint TR/psf$ury psfts/psf$urx psfts/psf$lly psfts/psf$llx psfts /psf$y psfts/psf$x psfts currentpoint/psf$cy X/psf$cx X/psf$sx psf$x psf$urx psf$llx sub div N/psf$sy psf$y psf$ury psf$lly sub div N psf$sx psf$sy scale psf$cx psf$sx div psf$llx sub psf$cy psf$sy div psf$ury sub TR/showpage{}N/erasepage{}N/setpagedevice{pop}N/copypage{}N/p 3 def @MacSetUp}N/doclip{psf$llx psf$lly psf$urx psf$ury currentpoint 6 2 roll newpath 4 copy 4 2 roll moveto 6 -1 roll S lineto S lineto S lineto closepath clip newpath moveto}N/endTexFig{end psf$SavedState restore}N /@beginspecial{SDict begin/SpecialSave save N gsave normalscale currentpoint TR @SpecialDefaults count/ocount X/dcount countdictstack N} N/@setspecial{CLIP 1 eq{newpath 0 0 moveto hs 0 rlineto 0 vs rlineto hs neg 0 rlineto closepath clip}if ho vo TR hsc vsc scale ang rotate rwiSeen{rwi urx llx sub div rhiSeen{rhi ury lly sub div}{dup}ifelse scale llx neg lly neg TR}{rhiSeen{rhi ury lly sub div dup scale llx neg lly neg TR}if}ifelse CLIP 2 eq{newpath llx lly moveto urx lly lineto urx ury lineto llx ury lineto closepath clip}if/showpage{}N/erasepage{}N /setpagedevice{pop}N/copypage{}N newpath}N/@endspecial{count ocount sub{ pop}repeat countdictstack dcount sub{end}repeat grestore SpecialSave restore end}N/@defspecial{SDict begin}N/@fedspecial{end}B/li{lineto}B /rl{rlineto}B/rc{rcurveto}B/np{/SaveX currentpoint/SaveY X N 1 setlinecap newpath}N/st{stroke SaveX SaveY moveto}N/fil{fill SaveX SaveY moveto}N/ellipse{/endangle X/startangle X/yrad X/xrad X/savematrix matrix currentmatrix N TR xrad yrad scale 0 0 1 startangle endangle arc savematrix setmatrix}N end %%EndProcSet %%BeginFont: CMR10 %!PS-AdobeFont-1.1: CMR10 1.00B %%CreationDate: 1992 Feb 19 19:54:52 % Copyright (C) 1997 American Mathematical Society. All Rights Reserved. 11 dict begin /FontInfo 7 dict dup begin /version (1.00B) readonly def /Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def /FullName (CMR10) readonly def /FamilyName (Computer Modern) readonly def /Weight (Medium) readonly def /ItalicAngle 0 def /isFixedPitch false def end readonly def /FontName /CMR10 def /PaintType 0 def /FontType 1 def /FontMatrix [0.001 0 0 0.001 0 0] readonly def /Encoding 256 array 0 1 255 {1 index exch /.notdef put} for dup 1 /Delta put readonly def /FontBBox{-251 -250 1009 969}readonly def /UniqueID 5000793 def currentdict end currentfile eexec D9D66F633B846A97B686A97E45A3D0AA052A014267B7904EB3C0D3BD0B83D891 016CA6CA4B712ADEB258FAAB9A130EE605E61F77FC1B738ABC7C51CD46EF8171 9098D5FEE67660E69A7AB91B58F29A4D79E57022F783EB0FBBB6D4F4EC35014F D2DECBA99459A4C59DF0C6EBA150284454E707DC2100C15B76B4C19B84363758 469A6C558785B226332152109871A9883487DD7710949204DDCF837E6A8708B8 2BDBF16FBC7512FAA308A093FE5CF7158F1163BC1F3352E22A1452E73FECA8A4 87100FB1FFC4C8AF409B2067537220E605DA0852CA49839E1386AF9D7A1A455F D1F017CE45884D76EF2CB9BC5821FD25365DDEA6E45F332B5F68A44AD8A530F0 92A36FAC8D27F9087AFEEA2096F839A2BC4B937F24E080EF7C0F9374A18D565C 295A05210DB96A23175AC59A9BD0147A310EF49C551A417E0A22703F94FF7B75 409A5D417DA6730A69E310FA6A4229FC7E4F620B0FC4C63C50E99E179EB51E4C 4BC45217722F1E8E40F1E1428E792EAFE05C5A50D38C52114DFCD24D54027CBF 2512DD116F0463DE4052A7AD53B641A27E81E481947884CE35661B49153FA19E 0A2A860C7B61558671303DE6AE06A80E4E450E17067676E6BBB42A9A24ACBC3E B0CA7B7A3BFEA84FED39CCFB6D545BB2BCC49E5E16976407AB9D94556CD4F008 24EF579B6800B6DC3AAF840B3FC6822872368E3B4274DD06CA36AF8F6346C11B 43C772CC242F3B212C4BD7018D71A1A74C9A94ED0093A5FB6557F4E0751047AF D72098ECA301B8AE68110F983796E581F106144951DF5B750432A230FDA3B575 5A38B5E7972AABC12306A01A99FCF8189D71B8DBF49550BAEA9CF1B97CBFC7CC 96498ECC938B1A1710B670657DE923A659DB8757147B140A48067328E7E3F9C3 7D1888B284904301450CE0BC15EEEA00E48CCD6388F3FC3C8578EF9A20A0E06E 4F7ADDAF0E7D1E182D115BF1AD931977325AD391E72E2B13CC108E3726C11099 E2000623188AAAC9F3E233EB253BDD8B0A4759A66A113E066238B0086AC1B634 5ABFF90E4B5ED3FA69C22541981B2BFC9710AEF6B50A8BB53431C7B4D380D721 639E005D6B4688EE16BFF48443E7C9E5FB5BC5883E271CB0342893C0BBC0A879 B7220832FB50103F72F8B5D9A7077D42DA07CF9607F2A18F50F1EF5400034080 B2857F4470211BEBCB125C4274860A1A33C04C0BCD3102C8EA07B8D481B73562 F0FDE26339AB0C1B2CBF6C36960BB5BCE91C9510D276C7EA3EB94D2B6FAC7627 D63A99848FC802757CF800D532437DAB1A1739F731E7096CFC9E056C79328257 58ADE62032984366B635556428DF4E2493B304B4E0D84A375E360CB4F8C2127D E74318474AFAC589CDB6D8596CD89862FBD8E7C3F4D24DC19E42FFFA7B43E14B BB165367D5F35EADC4447C12620BBDD452195FF34DD636F859EB48ACB69AA888 1CE9C23D1244BD67B698852209D66AA442F1592121ED3E5B5E 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 cleartomark %%EndFont %%BeginFont: CMSY10 %!PS-AdobeFont-1.1: CMSY10 1.0 %%CreationDate: 1991 Aug 15 07:20:57 % Copyright (C) 1997 American Mathematical Society. All Rights Reserved. 11 dict begin /FontInfo 7 dict dup begin /version (1.0) readonly def /Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def /FullName (CMSY10) readonly def /FamilyName (Computer Modern) readonly def /Weight (Medium) readonly def /ItalicAngle -14.035 def /isFixedPitch false def end readonly def /FontName /CMSY10 def /PaintType 0 def /FontType 1 def /FontMatrix [0.001 0 0 0.001 0 0] readonly def /Encoding 256 array 0 1 255 {1 index exch /.notdef put} for dup 15 /bullet put readonly def /FontBBox{-29 -960 1116 775}readonly def /UniqueID 5000820 def currentdict end currentfile eexec D9D66F633B846A97B686A97E45A3D0AA052F09F9C8ADE9D907C058B87E9B6964 7D53359E51216774A4EAA1E2B58EC3176BD1184A633B951372B4198D4E8C5EF4 A213ACB58AA0A658908035BF2ED8531779838A960DFE2B27EA49C37156989C85 E21B3ABF72E39A89232CD9F4237FC80C9E64E8425AA3BEF7DED60B122A52922A 221A37D9A807DD01161779DDE7D31FF2B87F97C73D63EECDDA4C49501773468A 27D1663E0B62F461F6E40A5D6676D1D12B51E641C1D4E8E2771864FC104F8CBF 5B78EC1D88228725F1C453A678F58A7E1B7BD7CA700717D288EB8DA1F57C4F09 0ABF1D42C5DDD0C384C7E22F8F8047BE1D4C1CC8E33368FB1AC82B4E96146730 DE3302B2E6B819CB6AE455B1AF3187FFE8071AA57EF8A6616B9CB7941D44EC7A 71A7BB3DF755178D7D2E4BB69859EFA4BBC30BD6BB1531133FD4D9438FF99F09 4ECC068A324D75B5F696B8688EEB2F17E5ED34CCD6D047A4E3806D000C199D7C 515DB70A8D4F6146FE068DC1E5DE8BC5703711DA090312BA3FC00A08C453C609 C627A8BECD6E1FA14A3B02476E90AAD8B4700C400380BC9AFFBF7847EB28661B 9DC3AA0F44C533F2E07DCC4DE19D367BF223E33DC321D0247A0E6EF6ABC8FA52 15AE044094EF678A8726CD7C011F02BFF8AB6EAEEE391AD837120823BED0B5D8 F8B15245377871A64F78378BB4330149D6941F7A86FBFFC49B93C94155F5FA7D F22E7214511C0A92693F4CDBF38411651540572F2DD70D924AE0F18E1CD581F3 C871399127FF5D07A868885B5FF7CDEB50B8323B2533DEF8DC973B1AE84FA0A2 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 cleartomark %%EndFont TeXDict begin 40258431 52099146 1000 8000 8000 (xlib_impl.dvi) @start /Fa 254[922 1[{}1 1106.96 /CMR10 rf /Fb 130[664 1[664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 1[664 664 664 664 664 664 664 664 664 1[664 1[664 664 664 2[664 2[664 664 664 3[664 664 1[664 2[664 2[664 664 664 2[664 2[664 664 664 664 664 1[664 664 664 2[664 664 664 664 664 664 664 664 664 664 664 664 664 664 2[664 1[664 33[{ TeXBase1Encoding ReEncodeFont }67 1106.96 /Courier rf /Fc 240[553 15[{}1 1106.96 /CMSY10 rf /Fd 134[491 491 738 491 553 308 431 431 1[553 553 553 799 308 491 1[308 553 553 308 491 553 491 553 553 8[676 922 1[799 615 553 676 1[676 1[738 922 615 2[369 1[799 676 676 799 738 1[676 6[369 1[553 1[553 2[553 553 553 553 2[369 277 4[369 36[553 2[{ TeXBase1Encoding ReEncodeFont }51 1106.96 /Times-Italic rf /Fe 105[553 1[491 491 24[491 553 553 799 553 553 308 431 369 553 553 553 553 861 308 553 308 308 553 553 369 491 553 491 553 491 3[369 1[369 1[799 799 1045 799 799 676 615 738 799 615 799 799 984 676 799 431 369 799 799 615 676 799 738 738 799 1[491 3[308 308 553 553 553 553 553 553 553 553 553 553 308 277 369 277 624 1[369 369 2[922 33[615 615 2[{ TeXBase1Encoding ReEncodeFont }79 1106.96 /Times-Roman rf /Ff 133[590 664 664 959 664 739 442 517 590 739 739 664 739 1107 369 739 1[369 739 664 442 590 739 590 739 664 8[959 1328 1[959 886 739 959 1[812 1033 1[1254 886 2[517 1[1033 812 886 959 959 886 959 6[442 664 664 664 664 664 664 664 664 664 664 1[332 42[739 3[{ TeXBase1Encoding ReEncodeFont }56 1328.35 /Times-Bold rf /Fg 134[797 797 2[797 797 797 797 1[797 797 1[797 1[797 797 1[797 797 797 797 797 797 797 797 32[797 5[797 10[797 797 46[{ TeXBase1Encoding ReEncodeFont }23 1328.35 /Courier rf /Fh 105[664 28[664 2[664 664 369 517 442 1[664 664 664 1033 369 2[369 664 2[590 664 590 1[590 11[959 1[739 886 1[739 959 4[517 5[959 886 1[959 7[664 1[664 1[664 2[664 664 664 3[332 44[{ TeXBase1Encoding ReEncodeFont }34 1328.35 /Times-Roman rf /Fi 136[1151 1[886 531 620 708 1[886 797 886 1328 443 2[443 886 797 1[708 886 1[886 797 8[1151 1594 13[620 1240 3[1151 2[1151 23[531 531 531 39[{ TeXBase1Encoding ReEncodeFont }26 1594.02 /Times-Bold rf end %%EndProlog %%BeginSetup %%Feature: *Resolution 8000dpi TeXDict begin %%BeginPaperSize: Letter letter %%EndPaperSize end %%EndSetup %%Page: 1 1 TeXDict begin 1 0 bop 17107 3487 a Fi(Ho)-16 b(w)399 b(Xlib)g(is)f(Implemented)14127 5479 y(\(And)h(What)f(W)-104 b(e')-32 b(r)j(e)399 b(Doing)g(About)f(It\))22397 8025 y Fh(Jame)-20 b(y)333 b(Sharp)17610 9575 y(Computer)h(Science)d (Department)19111 11125 y(Portland)i(State)f(Uni)-33 b(v)-20 b(ersity)17147 12675 y(Portland,)333 b(OR)f(USA)664 b(97207\2260751)19424 14224 y Fg(jamey@cs.pdx.edu)15439 15774 y(http://xcb.freedesktop.org)9929 19449 y Ff(Abstract)1107 21947 y Fe(The)244 b(X)f(W)-44 b(indo)-28 b(w)243 b(System)h(is)e(the)h Fd(de)h(facto)f Fe(standard)h(graph-)0 23276 y(ical)e(en)-44 b(vironment)245 b(for)d(Linux)h(and)g(Unix)g(hosts,)249 b(and)243 b(is)f(usable)0 24604 y(on)k(nearly)g(an)-17 b(y)247 b(class)e(of)g(computer)i(one)g(could)g(\002nd)f(today)-72 b(.)334 b(Its)0 25932 y(success)277 b(is)g(partially)g(due)h(to)f(its)f (\003e)-17 b(xible,)278 b(e)-17 b(xtensible)279 b(design.)1107 27353 y(Unfortunately)-72 b(,)448 b(as)412 b(research)h(proceeds)h(on)f (cutting-edge)0 28681 y(windo)-28 b(w)380 b(system)e(functionality)-72 b(,)404 b(the)379 b(brittleness)e(of)h(the)g(un-)0 30010 y(derlying)406 b(softw)-11 b(are)404 b(is)g(a)g(critical)g(impediment)j (to)d(progress.)0 31338 y(Xlib,)273 b(the)g(client-side)g (implementation)h(of)e(the)h(netw)-11 b(ork)274 b(pro-)0 32666 y(tocol)495 b(that)g(underlies)g(X,)f(is)g(one)h(source)h(of)e (these)h(issues.)0 33995 y(Man)-17 b(y)282 b(de)-28 b(v)-17 b(elopers)283 b(w)-11 b(orking)281 b(on)g(ne)-28 b(w)282 b(features)f(in)f(the)h(X)f(pro-)0 35323 y(tocol)323 b(are)f(disco)-17 b(v)g(ering)325 b(that)e(Xlib)f(requires)g(changes)j (to)d(sup-)0 36651 y(port)335 b(these)h(features,)350 b(b)-22 b(ut)336 b(Xlib)f(mak)-11 b(es)336 b(those)g(changes)i(dif)-28 b(\002-)0 37980 y(cult.)723 b(F)-17 b(or)404 b(more)g(than)h(15)f (years,)435 b(ne)-28 b(w)405 b(features)f(ha)-22 b(v)-17 b(e)405 b(been)0 39308 y(added)328 b(to)e(Xlib)g(by)h(accretion,)340 b(rather)326 b(than)h(with)f(careful)g(de-)0 40636 y(sign.)1107 42057 y(W)-89 b(e)412 b(discuss)e(the)i(implementation)h(of)e(Xlib)g (and)h(analyze)0 43385 y(some)259 b(speci\002c)g(dif)-28 b(\002culties)259 b(in)f(it)g(that)g(cause)h(problems)g(in)f(un-)0 44714 y(derstanding)454 b(and)g(maintaining)g(this)e(code)i(base.)871 b(W)-89 b(e)453 b(also)0 46042 y(present)429 b(our)g(current)g(w)-11 b(ork)428 b(on)i(migrating)f(the)f(X)h(W)-44 b(indo)-28 b(w)0 47370 y(System)402 b(to)g(a)g(more)g(maintainable,)435 b(carefully)403 b(designed)g(ar)-22 b(-)0 48699 y(chitecture.)0 51381 y Ff(1)1329 b(Intr)-24 b(oduction)0 53311 y Fe(At)377 b(the)h(core)h(of)e(the)h(X)g(W)-44 b(indo)-28 b(w)379 b(System)f([SG86)q(])f(is)g(a)h(net-)0 54639 y(w)-11 b(ork)381 b(protocol,)408 b(allo)-28 b(wing)382 b(an)-17 b(y)382 b(number)g(of)f(X)f(applications)0 55968 y(running)370 b(on)f(f)-11 b(ar)-22 b(-\003ung)368 b(machines)i(to)e(interact)h(with) f(a)h(single)0 57296 y(k)-11 b(e)-17 b(yboard,)390 b(mouse,)e(and)366 b(monitor)-61 b(.)608 b(Nearly)366 b(all)f(applications)0 58624 y(currently)h(use)g(Xlib)f([SGFR92)r(],)387 b(a)366 b(C)f(library)g(dating)i(to)e(the)0 59953 y(mid-1980s,)278 b(to)f(interact)g(with)g(the)h(X)f(protocol.)1107 61373 y(Softw)-11 b(are)479 b(de)-28 b(v)-17 b(elopers)481 b(ha)-22 b(v)-17 b(e)480 b(collecti)-28 b(v)-17 b(ely)480 b(learned)g(a)e(lot)0 62702 y(about)383 b(the)e(engineering)j(of)d (softw)-11 b(are)381 b(in)g(the)h(decades)h(since)0 64030 y(X)320 b(w)-11 b(as)320 b(created.)474 b(This)320 b(f)-11 b(act)320 b(e)-17 b(xplains)322 b(some,)331 b(though)322 b(not)e(all,)0 65358 y(of)394 b(the)g(dif)-28 b(\002culties)394 b(that)g(users)g(and)h(de)-28 b(v)-17 b(elopers)396 b(e)-17 b(xperience)0 66687 y(when)319 b(w)-11 b(orking)319 b(with)f(X.)f (\(Other)h(issues)f(are)h(e)-17 b(xplained)321 b(later)0 68015 y(in)243 b(this)f(paper)-61 b(.\))333 b(Our)243 b(pre)-28 b(vious)244 b(w)-11 b(ork)244 b(on)f(a)g(ne)-28 b(w)245 b(X-protocol)f(C)0 69343 y(Binding)343 b([MS01)q(])d(and)j (subsequently)g(an)f(Xlib)f(Compatibil-)0 70672 y(ity)231 b(Layer)i([SM02)q(])e(were)h(ef)-28 b(forts)230 b(to)i(apply)h(current) f(best)f(prac-)0 72000 y(tices)407 b(in)g(softw)-11 b(are)407 b(engineering)j(to)d(the)g(core)h(of)f(the)h(client-)26800 19449 y(side)251 b(implementation)i(of)e(the)h(X)f(protocol,)257 b(with)251 b(goals)h(of)e(im-)26800 20778 y(pro)-17 b(ving)279 b(the)e(usability)g(of)g(X)g(in)g(se)-28 b(v)-17 b(eral)279 b(cases:)27907 22568 y Fc(\017)554 b Fe(Resource-constrained)228 b(en)-44 b(vironments,)237 b(such)225 b(as)g(PD)-44 b(As.)27907 23896 y Fc(\017)554 b Fe(De)-28 b(v)-17 b(elopers)279 b(w)-11 b(anting)279 b(to)e(understand)i(ho)-28 b(w)278 b(X)f(w)-11 b(orks.)27907 25225 y Fc(\017)554 b Fe(De)-28 b(v)-17 b(elopers)279 b(implementing)g(X)e(protocol)i(e)-17 b(xtensions.)27907 26553 y Fc(\017)554 b Fe(Users)276 b(desiring)h(better)-22 b(-performing)278 b(applications.)27907 28344 y(Xlib)305 b(spans)h(more)g(than)g(400)h(source)f(\002les,)313 b(contains)306 b(more)26800 29672 y(than)390 b(150,000)h(lines)d(of)h (code,)418 b(and)390 b(compiles)g(to)e(a)h(roughly)26800 31000 y(750kB)268 b(shared)f(library)f(on)h(Linux/i386.)342 b(On)267 b(a)f(typical)h(Linux)26800 32329 y(system,)412 b(this)384 b(puts)i(Xlib)f(among)i(the)f(top)g(libraries)e(as)h(mea-) 26800 33657 y(sured)277 b(by)h(code)h(size.)27907 35049 y(This)443 b(paper)h(has)f(se)-28 b(v)-17 b(eral)444 b(major)g(parts:)674 b(a)443 b(tour)g(of)g(Xlib,)26800 36377 y(an)376 b(e)-17 b(xplanation)379 b(of)d(se)-28 b(v)-17 b(eral)377 b(current)g(ef)-28 b(forts)374 b(to)i(impro)-17 b(v)g(e)378 b(X,)26800 37706 y(some)328 b(observ)-28 b(ations)330 b(on)e(softw)-11 b(are)328 b(engineering,)343 b(and)329 b(a)f(brief)26800 39034 y(glimpse)277 b(at)g(the)h(future.) 26800 41654 y Ff(2)1329 b(The)331 b(Ar)-24 b(chitectur)g(e)331 b(of)i(Xlib)26800 43521 y Fe(As)254 b(we)i(are)f(not)h(a)-17 b(w)-11 b(are)256 b(of)f(a)g(comprehensi)-28 b(v)-17 b(e)259 b(tour)c(of)f(the)i(Xlib)26800 44849 y(source,)278 b(we)f(present)h(one)g(here.)27907 46241 y(Xlib)399 b(stores)f(more)h (than)h(a)f(kilobyte)h(of)f(data)h(about)g(each)26800 47569 y(X)358 b(serv)-17 b(er)358 b(connection)j(in)d(a)g(structure)g (named)i(a)e Fb(Display)p Fe(.)26800 48898 y(This)277 b(includes)27907 50688 y Fc(\017)554 b Fe(The)303 b(\002le)f (descriptor)g(and)h(other)g(information)f(about)h(the)29014 52017 y(transport.)27907 53345 y Fc(\017)554 b Fe(Other)277 b(\002le)h(descriptors)f(to)g(monitor)g(for)f(ne)-28 b(w)279 b(data.)27907 54673 y Fc(\017)554 b Fe(An)277 b(assortment)g(of)g(v)-28 b(alues)279 b(cached)g(from)e(the)g(serv)-17 b(er)-61 b(.)27907 56002 y Fc(\017)554 b Fe(Pointers)277 b(used)h(for)e(internal)i(memory)g(management.)27907 57330 y Fc(\017)554 b Fe(Function)279 b(pointers)e(to)g(hooks.)26800 59121 y(The)340 b(hooks)f(in)g(Xlib)f(allo)-28 b(w)340 b(e)-17 b(xtensions)340 b(and)g(applications)g(to)26800 60449 y(modify)278 b(the)f(w)-11 b(ay)278 b(Xlib)f(handles)27907 62239 y Fc(\017)554 b Fe(Thread)279 b(synchronization.)27907 63568 y Fc(\017)554 b Fe(Con)-44 b(v)-17 b(ersion)216 b(between)f(wire)f(protocol)h(and)g(C)e(structures.)27907 64896 y Fc(\017)554 b Fe(XID)277 b(allocation.)27907 66224 y Fc(\017)554 b Fe(Management)280 b(of)d(graphics)h(conte)-17 b(xts)279 b(and)f(serv)-17 b(er)277 b(fonts.)27907 67553 y Fc(\017)554 b Fe(Buf)-28 b(fer)277 b(\003ushes.)27907 68881 y Fc(\017)554 b Fe(Connection)280 b(close.)27907 70672 y(When)365 b(an)f(X)g(client)g(successfully)g(establishes)g(a)f (connec-)26800 72000 y(tion)c(to)g(a)h(serv)-17 b(er)-44 b(,)379 b(the)360 b(serv)-17 b(er)359 b(sends)g(se)-28 b(v)-17 b(eral)361 b(hundred)g(bytes)p eop end %%Page: 2 2 TeXDict begin 2 1 bop 0 8698 a @beginspecial 0 @llx 0 @lly 402 @urx 141 @ury 2232 @rwi @setspecial %%BeginDocument: xlib-layers.eps %!PS-Adobe-2.0 EPSF-2.0 %%Title: xlib-layers.fig %%Creator: fig2dev Version 3.2 Patchlevel 5-alpha4 %%CreationDate: Fri Apr 9 00:21:48 2004 %%For: jamey@zoo.minilop.net (Jamey Sharp,,,) %%BoundingBox: 0 0 402 141 %Magnification: 1.0000 %%EndComments /$F2psDict 200 dict def F2psDictbeginF2psDict begin F2psDictbeginF2psDict /mtrx matrix put /col-1 {0 setgray} bind def /col0 {0.000 0.000 0.000 srgb} bind def /col1 {0.000 0.000 1.000 srgb} bind def /col2 {0.000 1.000 0.000 srgb} bind def /col3 {0.000 1.000 1.000 srgb} bind def /col4 {1.000 0.000 0.000 srgb} bind def /col5 {1.000 0.000 1.000 srgb} bind def /col6 {1.000 1.000 0.000 srgb} bind def /col7 {1.000 1.000 1.000 srgb} bind def /col8 {0.000 0.000 0.560 srgb} bind def /col9 {0.000 0.000 0.690 srgb} bind def /col10 {0.000 0.000 0.820 srgb} bind def /col11 {0.530 0.810 1.000 srgb} bind def /col12 {0.000 0.560 0.000 srgb} bind def /col13 {0.000 0.690 0.000 srgb} bind def /col14 {0.000 0.820 0.000 srgb} bind def /col15 {0.000 0.560 0.560 srgb} bind def /col16 {0.000 0.690 0.690 srgb} bind def /col17 {0.000 0.820 0.820 srgb} bind def /col18 {0.560 0.000 0.000 srgb} bind def /col19 {0.690 0.000 0.000 srgb} bind def /col20 {0.820 0.000 0.000 srgb} bind def /col21 {0.560 0.000 0.560 srgb} bind def /col22 {0.690 0.000 0.690 srgb} bind def /col23 {0.820 0.000 0.820 srgb} bind def /col24 {0.500 0.190 0.000 srgb} bind def /col25 {0.630 0.250 0.000 srgb} bind def /col26 {0.750 0.380 0.000 srgb} bind def /col27 {1.000 0.500 0.500 srgb} bind def /col28 {1.000 0.630 0.630 srgb} bind def /col29 {1.000 0.750 0.750 srgb} bind def /col30 {1.000 0.880 0.880 srgb} bind def /col31 {1.000 0.840 0.000 srgb} bind def end save newpath 0 141 moveto 0 0 lineto 402 0 lineto 402 141 lineto closepath clip newpath -48.8 149.2 translate 1 -1 scale /cp {closepath} bind def /ef {eofill} bind def /gr {grestore} bind def /gs {gsave} bind def /sa {save} bind def /rs {restore} bind def /l {lineto} bind def /m {moveto} bind def /rm {rmoveto} bind def /n {newpath} bind def /s {stroke} bind def /sh {show} bind def /slc {setlinecap} bind def /slj {setlinejoin} bind def /slw {setlinewidth} bind def /srgb {setrgbcolor} bind def /rot {rotate} bind def /sc {scale} bind def /sd {setdash} bind def /ff {findfont} bind def /sf {setfont} bind def /scf {scalefont} bind def /sw {stringwidth} bind def /tr {translate} bind def /tnt {dup dup currentrgbcolor 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} bind def /shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul 4 -2 roll mul srgb} bind def /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def /$F2psEnd {$F2psEnteredState restore end} def F2psBegin10setmiterlimit0slj0slc0.060000.06000scF2psBegin 10 setmiterlimit 0 slj 0 slc 0.06000 0.06000 sc % % Fig objects follow % % % here starts figure with depth 50 % Polyline 0 slj 0 slc 7.500 slw n 975 825 m 2550 825 l 2550 1125 l 975 1125 l cp gs col0 s gr /Times-Roman ff 240.00 scf sf 1125 1035 m gs 1 -1 sc (resource db) col0 sh gr % Polyline n 975 300 m 2475 300 l 2475 600 l 975 600 l cp gs col0 s gr /Times-Roman ff 240.00 scf sf 1125 540 m gs 1 -1 sc (cut buffers) col0 sh gr % Polyline n 2700 300 m 3225 300 l 3225 600 l 2700 600 l cp gs col0 s gr /Times-Roman ff 240.00 scf sf 2850 480 m gs 1 -1 sc (gc) col0 sh gr % Polyline n 2775 825 m 3525 825 l 3525 1125 l 2775 1125 l cp gs col0 s gr /Times-Roman ff 240.00 scf sf 2925 1050 m gs 1 -1 sc (cms) col0 sh gr % Polyline n 3450 300 m 4425 300 l 4425 600 l 3450 600 l cp gs col0 s gr /Times-Roman ff 240.00 scf sf 3600 510 m gs 1 -1 sc (image) col0 sh gr % Polyline n 4650 300 m 5625 300 l 5625 600 l 4650 600 l cp gs col0 s gr /Times-Roman ff 240.00 scf sf 4800 540 m gs 1 -1 sc (icccm) col0 sh gr % Polyline n 3750 825 m 4500 825 l 4500 1125 l 3750 1125 l cp gs col0 s gr /Times-Roman ff 240.00 scf sf 3900 1065 m gs 1 -1 sc (xkb) col0 sh gr % Polyline [60] 0 sd n 825 150 m 5775 150 l 5775 1275 l 825 1275 l cp gs col0 s gr [] 0 sd /Times-Roman ff 240.00 scf sf 4800 1050 m gs 1 -1 sc (utility) col0 sh gr % Polyline n 6375 975 m 7050 975 l 7050 1275 l 6375 1275 l cp gs col0 s gr /Times-Roman ff 240.00 scf sf 6525 1215 m gs 1 -1 sc (xlc) col0 sh gr % Polyline n 6375 525 m 7200 525 l 7200 825 l 6375 825 l cp gs col0 s gr /Times-Roman ff 240.00 scf sf 6525 735 m gs 1 -1 sc (xom) col0 sh gr % Polyline n 6375 1425 m 7125 1425 l 7125 1725 l 6375 1725 l cp gs col0 s gr /Times-Roman ff 240.00 scf sf 6525 1665 m gs 1 -1 sc (xim) col0 sh gr % Polyline [60] 0 sd n 6225 150 m 7500 150 l 7500 1950 l 6225 1950 l cp gs col0 s gr [] 0 sd /Times-Roman ff 240.00 scf sf 6525 450 m gs 1 -1 sc (i18n) col0 sh gr % Polyline n 4725 2175 m 6000 2175 l 6000 2475 l 4725 2475 l cp gs col0 s gr /Times-Roman ff 240.00 scf sf 4875 2370 m gs 1 -1 sc (transport) col0 sh gr % Polyline n 6525 2175 m 7500 2175 l 7500 2475 l 6525 2475 l cp gs col0 s gr /Times-Roman ff 240.00 scf sf 6675 2385 m gs 1 -1 sc (region) col0 sh gr % Polyline n 975 1875 m 2700 1875 l 2700 2175 l 975 2175 l cp gs col0 s gr /Times-Roman ff 240.00 scf sf 1125 2085 m gs 1 -1 sc (core protocol) col0 sh gr % Polyline n 2925 1875 m 3900 1875 l 3900 2175 l 2925 2175 l cp gs col0 s gr /Times-Roman ff 240.00 scf sf 3075 2100 m gs 1 -1 sc (events) col0 sh gr % Polyline [60] 0 sd n 825 1425 m 4125 1425 l 4125 2400 l 825 2400 l cp gs col0 s gr [] 0 sd /Times-Roman ff 240.00 scf sf 1050 1725 m gs 1 -1 sc (protocol) col0 sh gr % Polyline gs clippath 4571 2418 m 4737 2431 l 4742 2371 l 4575 2358 l 4575 2358 l 4693 2398 l 4571 2418 l cp eoclip n 1800 2175 m 4725 2400 l gs col0 s gr gr % arrowhead n 4571 2418 m 4693 2398 l 4575 2358 l 4571 2418 l cp gs 0.00 setgray ef gr col0 s % Polyline gs clippath 2153 1787 m 1999 1853 l 2022 1908 l 2177 1843 l 2177 1843 l 2055 1862 l 2153 1787 l cp eoclip n 2025 1875 m 3450 1275 l gs col0 s gr gr % arrowhead n 2153 1787 m 2055 1862 l 2177 1843 l 2153 1787 l cp gs 0.00 setgray ef gr col0 s % Polyline gs clippath 4570 2337 m 4736 2356 l 4743 2296 l 4577 2277 l 4577 2277 l 4693 2321 l 4570 2337 l cp eoclip n 4725 2325 m 3375 2175 l gs col0 s gr gr % arrowhead n 4570 2337 m 4693 2321 l 4577 2277 l 4570 2337 l cp gs 0.00 setgray ef gr col0 s % Polyline gs clippath 3598 1829 m 3432 1846 l 3438 1906 l 3604 1889 l 3604 1889 l 3482 1872 l 3598 1829 l cp eoclip n 3450 1875 m 6375 1575 l gs col0 s gr gr % arrowhead n 3598 1829 m 3482 1872 l 3604 1889 l 3598 1829 l cp gs 0.00 setgray ef gr col0 s % Polyline gs clippath 6720 823 m 6720 990 l 6780 990 l 6780 823 l 6780 823 l 6750 943 l 6720 823 l cp eoclip n 6750 825 m 6750 975 l gs col0 s gr gr % arrowhead n 6720 823 m 6750 943 l 6780 823 l 6720 823 l cp gs 0.00 setgray ef gr col0 s % Polyline gs clippath 6780 1427 m 6780 1260 l 6720 1260 l 6720 1427 l 6720 1427 l 6750 1307 l 6780 1427 l cp eoclip n 6750 1425 m 6750 1275 l gs col0 s gr gr % arrowhead n 6780 1427 m 6750 1307 l 6720 1427 l 6780 1427 l cp gs 0.00 setgray ef gr col0 s % Polyline gs clippath 2546 1822 m 2380 1847 l 2389 1906 l 2555 1881 l 2555 1881 l 2432 1870 l 2546 1822 l cp eoclip n 6375 675 m 5850 1350 l 2400 1875 l gs col0 s gr gr % arrowhead n 2546 1822 m 2432 1870 l 2555 1881 l 2546 1822 l cp gs 0.00 setgray ef gr col0 s % here ends figure; F2psBegin10setmiterlimit0slj0slc0.060000.06000scF2psEnd rs showpage %%Trailer %EOF %%EndDocument @endspecial 2214 x Fe(Figure)436 b(1:)660 b(Notional)437 b(Xlib)e(components:)662 b(arro)-28 b(ws)435 b(indicate)0 12241 y(\223using\224)278 b(relationships)0 15305 y(of)259 b(information)h(about)h(the)f(capabilities)g(of)f(the)h(display)-72 b(.)338 b(Xlib)0 16634 y(copies)227 b(some)f(of)g(that)g(information)h (into)f(the)g(Display;)243 b(the)227 b(rest)0 17962 y(is)276 b(k)-11 b(ept)278 b(in)f(other)g(structures)g(pointed)h(to)f(by)h(the)g (Display)-72 b(.)1107 19374 y(Once)281 b(connection)i(setup)e(is)e (complete,)j(requests)e(from)f(the)0 20703 y(client)344 b(and)h(responses)f(from)f(the)h(serv)-17 b(er)344 b(are)g(the)g (fundamen-)0 22031 y(tal)410 b(elements)i(of)f(the)g(X)f(protocol.)746 b(Requests)411 b(al)-11 b(w)g(ays)412 b(ha)-22 b(v)-17 b(e)0 23360 y(a)319 b(\223major)h(opcode\224)j(identifying)d(the)g (kind)g(of)f(request,)330 b(and)321 b(a)0 24688 y(length)231 b(\002eld)g(that)f(measures)h(the)f(number)h(of)f(four)-22 b(-byte)231 b(w)-11 b(ords)0 26016 y(needed)310 b(to)d(contain)i(the)f (entire)g(pack)-11 b(et.)436 b(Responses)309 b(come)g(in)0 27345 y(three)319 b(forms:)426 b(replies,)329 b(e)-28 b(v)-17 b(ents,)330 b(and)320 b(errors.)467 b(Replies)320 b(and)f(er)-22 b(-)0 28673 y(rors)423 b(are)h(sent)g(in)g(response)g (to)g(requests,)461 b(while)424 b(e)-28 b(v)-17 b(ents)425 b(are)0 30001 y(sent)277 b(spontaneously)-72 b(.)1107 31414 y(Only)347 b(some)h(request)f(types)h(call)f(for)f(a)h(reply)-72 b(,)365 b(b)-22 b(ut)347 b(for)f(an)-17 b(y)0 32742 y(of)394 b(those)h(requests,)424 b(a)395 b(reply)g(is)f(al)-11 b(w)g(ays)395 b(sent,)424 b(unless)394 b(an)h(er)-22 b(-)0 34070 y(ror)393 b(is)g(sent)h(instead.)695 b(Errors)392 b(can)k(also)d(occur)j(for)d(other)h(re-)0 35399 y(quests.)681 b(Since)391 b(X)f(has)f(a)h(netw)-11 b(ork-transparent)392 b(protocol,)419 b(it)0 36727 y(may)298 b(be)g(run)f(on)h(high-latenc) -17 b(y)300 b(connections)f(such)f(as)f(dial-up)0 38055 y(or)440 b(DSL)g(Internet)g(links,)481 b(and)441 b(on)f(these)h(links)e (replies)h(tak)-11 b(e)0 39384 y(long)325 b(enough)i(to)e(arri)-28 b(v)-17 b(e)325 b(that)f(the)h(delay)h(may)f(ha)-22 b(v)-17 b(e)326 b(a)f(notice-)0 40712 y(able)237 b(ef)-28 b(fect)236 b(on)g(application)i(performance.)332 b(In)235 b(analyzing)j(this)0 42041 y(aspect)229 b(of)g(X)f(performance,)240 b(we)229 b(speak)h(of)e(round-trip)h(latenc)-17 b(y)-72 b(,)0 43369 y(and)278 b(look)g(for)f(techniques)i(to)e(a)-22 b(v)g(oid)278 b(or)f(hide)g(it)g([PG03)q(].)1107 44781 y(Xlib)g(w)-11 b(as)277 b(originally)g(written)g(without)h(much)g (concern)h(for)0 46110 y(type-safety)-72 b(,)318 b(b)-22 b(ut)310 b(with)g(great)g(care)g(to)g(minimize)g(the)g(number)0 47438 y(of)396 b(function)h(calls.)700 b(As)395 b(a)h(result,)425 b(the)397 b(C)f(preprocessor)h(gets)0 48766 y(hea)-22 b(vy)254 b(use)e(when)h(compiling)g(Xlib)-44 b(.)335 b(Man)-17 b(y)253 b(of)f(the)g(most)f(com-)0 50095 y(monly)278 b(e)-17 b(x)g(ecuted)281 b(statements)c(in)g(Xlib)g(are)g(macros.)0 52494 y Ff(2.1)1329 b(Xlib)332 b(Lay)-13 b(ers)0 54406 y Fe(As)304 b(sho)-28 b(wn)307 b(in)e(Figure)h(1,)311 b(Xlib)305 b(can)h(be)g(thought)g(of)f(as)g(ha)-22 b(ving)0 55734 y(se)-28 b(v)-17 b(eral)360 b(distinct)f(layers)f(and)i (components.)592 b(An)359 b(analysis)g(of)0 57062 y(the)331 b(size)f(of)g(these)h(notional)g(components)i(is)d(in)g(Section)i(6.2.) 0 58391 y(Unfortunately)-72 b(,)485 b(within)443 b(the)g(code)h(the)f (boundaries)h(are)f(not)0 59719 y(as)411 b(clear)h(as)g(is)e(suggested) j(by)f(the)g(\002gure.)748 b(In)412 b(f)-11 b(act,)444 b(we)412 b(are)0 61047 y(not)265 b(a)-17 b(w)-11 b(are)266 b(of)e(an)-17 b(y)266 b(pre)-28 b(vious)266 b(ef)-28 b(forts)264 b(to)g(describe)i(Xlib)e(in)g(this)0 62376 y(manner)-61 b(.)337 b(Ho)-28 b(we)g(v)-17 b(er)-44 b(,)259 b(these)253 b(boundaries)i(will)c(be)i(useful)g(in)f(our)0 63704 y(analysis)274 b(of)f(Xlib,)h(and)h(correspond)g(to)f(the)g(v)-22 b(ocab)g(ulary)276 b(com-)0 65032 y(monly)i(used)g(in)f(con)-44 b(v)-17 b(ersation)279 b(among)g(Xlib)e(de)-28 b(v)-17 b(elopers.)0 67431 y Ff(2.1.1)1329 b(T)-98 b(ransport)331 b(Lay)-13 b(er)0 69343 y Fe(The)244 b(transport)f(layer)g(is)f (responsible)i(for)e(con)-44 b(v)-17 b(e)g(ying)247 b(requests)0 70672 y(and)463 b(responses)f(between)i(the)e(X)g(client)g(and)h(serv) -17 b(er)-61 b(.)898 b(This)0 72000 y(layer)278 b(is)e(independent)k (of)d(the)g(semantics)h(of)f(those)g(pack)-11 b(ets.)27907 1107 y(Much)361 b(of)f(the)h(code)g(in)f(this)g(layer)g(comes)h(from)f (xtrans,)380 b(a)26800 2435 y(module)354 b(comprising)f(se)-28 b(v)-17 b(eral)354 b Fb(.c)e Fe(and)h Fb(.h)g Fe(\002les.)569 b(Code)354 b(that)26800 3764 y(uses)393 b(xtrans)g(instantiates)g(it)g (in)g(one)h(of)f(se)-28 b(v)-17 b(eral)394 b(v)-28 b(ariants)394 b(by)26800 5092 y(de\002ning)269 b(an)f(appropriate)h(C)f(preprocessor) g(macro)g(before)g(in-)26800 6420 y(cluding)352 b(not)e(just)f Fb(Xtrans.h)p Fe(,)369 b(b)-22 b(ut)350 b(also)g Fb(transport.c)p Fe(.)26800 7749 y(A)-82 b(v)-28 b(ailable)283 b(v)-28 b(ariants)282 b(are)f(X11,)i(XSER)-89 b(V)-143 b(,)282 b(Xim,)g(FS,)g(F)-17 b(ont,)283 b(Ice,)26800 9077 y(TEST)-82 b(,)241 b(and)g(LBXPR)-44 b(O)g(XY)-102 b(:)241 b(while)f(there)h(are)f (occasional)i(sub-)26800 10405 y(tle)452 b(dif)-28 b(ferences,)497 b(these)453 b(v)-28 b(ariants)453 b(dif)-28 b(fer)452 b(mostly)h(in)f(symbol)26800 11734 y(names.)27907 13119 y(Xlib)307 b(uses)h(tw)-11 b(o)307 b(v)-28 b(ariants)308 b(of)g(xtrans,)314 b(X11T)-39 b(rans)310 b(and)e(Xim-)26800 14447 y(T)-39 b(rans,)432 b(meaning)403 b(that)e(all)f(of)h(the)g(code) h(in)f(xtrans)g(is)f(link)-11 b(ed)26800 15776 y(into)293 b(Xlib)g(twice.)393 b(The)294 b(\002rst)e(v)-28 b(ariant)295 b(is)d(used)i(in)f(the)h(transport)26800 17104 y(layer)-44 b(,)298 b(while)d(the)f(second)i(is)d(used)i(by)g(X)f(input)h(methods.) 395 b(W)-89 b(e)26800 18432 y(focus)277 b(on)h(the)g(\002rst)e(of)g (these)i(here.)27907 19818 y(Nothing)510 b(in)e(the)h(e)-17 b(xtension)510 b(libraries)e(and)h(applications)26800 21146 y(that)247 b(we)g(ha)-22 b(v)-17 b(e)249 b(tested)e(uses)g(X11T) -39 b(rans)248 b(directly)-72 b(.)334 b(W)-44 b(ithin)246 b(Xlib,)26800 22474 y(calls)d(to)h(X11T)-39 b(rans)245 b(are)f(con\002ned)j(to)d(four)f(source)i(\002les:)326 b(Xlib-)26800 23803 y(Int.c,)347 b(OpenDis.c,)h(ConnDis.c,)h(and)334 b(ClDisplay)-72 b(.c.)513 b(As)333 b(a)g(re-)26800 25131 y(sult,)312 b(re)-28 b(writing)306 b(Xlib)g(to)g(eliminate)h (references)g(to)f(X11T)-39 b(rans)26800 26459 y(is)276 b(a)h(relati)-28 b(v)-17 b(ely)279 b(straightforw)-11 b(ard)277 b(task.)26800 28798 y Ff(2.1.2)1329 b(Pr)-24 b(otocol)333 b(Lay)-13 b(er)26800 30650 y Fe(On)266 b(a)g(Cray)g (supercomputer)-44 b(,)270 b(memory)d(is)d(not)i(addressable)i(in)26800 31979 y(single-byte)311 b(increments:)409 b(in)310 b(f)-11 b(act,)317 b(it)309 b(is)g(addressable)i(only)g(in)26800 33307 y(64-bit)412 b(increments.)747 b(In)411 b(X)g(requests)h(and)h (responses,)445 b(ho)-28 b(w-)26800 34636 y(e)g(v)-17 b(er)-44 b(,)325 b(32-bit)315 b(v)-28 b(alues)317 b(are)e(aligned)h(to) f(32-bit)g(boundaries,)326 b(16-)26800 35964 y(bit)374 b(v)-28 b(alues)375 b(to)f(16-bit)h(boundaries,)400 b(and)375 b(so)f(on.)635 b(On)375 b(a)f(Cray)-72 b(,)26800 37292 y(then,)466 b(accessing)430 b(indi)-28 b(vidual)429 b(components)i(of)c (a)h(request)h(or)26800 38621 y(response)278 b(is)e(inef)-28 b(\002cient.)27907 40006 y(Xlib)221 b(is)f(designed)j(to)e(unpack)j (the)e(wire)f(protocol)h(data)g(from)26800 41334 y(responses)d(into)f (structures)g(that)g(may)h(be)g(ef)-28 b(\002ciently)220 b(accessed)26800 42663 y(by)469 b(the)g(host,)516 b(and)470 b(to)e(similarly)g(pack)i(data)f(into)g(requests.)26800 43991 y(Man)-17 b(y)485 b(parts)d(of)h(the)h(protocol)g(are)f (represented)i(by)e(a)h(pair)26800 45319 y(of)454 b(structures)h(in)f (Xlib,)499 b(namely)456 b(the)f(wire)g(protocol)g(struc-)26800 46648 y(ture)281 b(and)h(the)g(host)f(structure.)355 b(By)281 b(con)-44 b(v)-17 b(ention,)285 b(the)d(names)g(of)26800 47976 y(wire)303 b(structures)g(are)h(of)g(the)g(form)f(x)p Fd(ID)p Fe(Req)i(for)e(requests)h(and)26800 49304 y(x)p Fd(ID)p Fe(Reply)386 b(for)d(replies,)410 b(with)384 b(v)-28 b(arious)385 b Fd(ID)p Fe(s,)410 b(and)385 b(in)f(general)26800 50633 y(components)272 b(of)e(these)g(structures)f(correspond)j(only)f (to)e(ar)-20 b(gu-)26800 51961 y(ments)334 b(to)h(functions.)515 b(The)336 b(core)f(e)-28 b(v)-17 b(ent)336 b(wire)e(type)h(is)f(xEv)-17 b(ent)26800 53289 y(and)515 b(corresponds)g(to)f(host)g(structures)g (named)h(X)p Fd(ID)p Fe(Ev)-17 b(ent.)26800 54618 y(The)385 b(core)g(error)f(wire)g(type)h(is)e(xError)-44 b(,)410 b(and)385 b(corresponds)h(to)26800 55946 y(XErrorEv)-17 b(ent.)27907 57331 y(F)g(or)271 b(all)e(of)h(the)h(wire)f(protocol)h (structures,)f(C)h(preprocessor)26800 58660 y(symbols)278 b(with)g(names)h(lik)-11 b(e)278 b Fb(sz)p 39441 58660 333 45 v 399 w(xEvent)h Fe(are)f(de\002ned)i(equal)26800 59988 y(to)273 b(the)g(number)i(of)d(bytes)i(that)f(the)g(structure)g (occupies)i(on)e(the)26800 61316 y(wire.)330 b(Request)240 b(structures)e(also)g(ha)-22 b(v)-17 b(e)241 b(their)d(opcode)j (\(major)e(if)26800 62645 y(core,)270 b(minor)e(if)e(e)-17 b(xtension\))269 b(in)e Fb(#define)p Fe(s.)341 b(Structures)268 b(ha)-22 b(v)-17 b(e)26800 63973 y(\002x)g(ed-length)266 b(parts,)f(b)-22 b(ut)264 b(no)g(v)-28 b(ariable-length)265 b(representation.)27907 65358 y(When)401 b(Xlib)f(accesses)i(a)e (Display)-72 b(,)431 b(perhaps)402 b(to)e(construct)26800 66687 y(a)312 b(request)h(or)f(process)g(a)h(response,)321 b(it)312 b(must)f(protect)i(the)g(Dis-)26800 68015 y(play)213 b(ag)-6 b(ainst)214 b(simultaneous)g(accesses)f(by)g(other)g(threads.) 323 b(The)26800 69343 y(LockDisplay)465 b(and)f(UnlockDisplay)i(macros) d(are)g(pro)-17 b(vided)26800 70672 y(for)296 b(this)f(purpose.)403 b(All)295 b(access)i(to)g(a)f(Display)h(must)f(be)h(brack-)26800 72000 y(eted)278 b(by)g(a)f(LockDisplay)i(and)f(UnlockDisplay)i(pair) -61 b(.)p eop end %%Page: 3 3 TeXDict begin 3 2 bop 1107 1107 a Fe(T)-89 b(o)348 b(deli)-28 b(v)-17 b(er)348 b(a)f(request)g(to)g(the)g(serv)-17 b(er)-44 b(,)364 b(Xlib)347 b(must)f(allocate)0 2435 y(both)292 b(a)g(sequence)i(number)f(and)g(a)f(block)g(of)g(memory)h (to)e(con-)0 3764 y(struct)334 b(the)g(request)h(in.)516 b(Both)335 b(of)f(these)h(allocations)g(are)g(han-)0 5092 y(dled)382 b(by)f(the)g(GetReq)i(macro)f(or)e(its)g(v)-28 b(ariants:)551 b(GetResReq,)0 6420 y(GetEmptyReq,)439 b(and)406 b(GetReqExtra.)728 b(An)-17 b(y)406 b(v)-28 b(ariable-length)0 7749 y(parts)492 b(of)h(the)g(request)h(are)f(then)h (deli)-28 b(v)-17 b(ered)495 b(with)e(the)g(Data)0 9077 y(macro,)434 b(its)401 b(v)-28 b(ariants)403 b(Data16)h(and)g(Data32,) 435 b(or)402 b(the)p 21455 9077 333 45 v 801 w(XSend)0 10405 y(function.)1007 b(The)499 b(Data)f(macro)h(will)e(cop)-11 b(y)499 b(into)f(the)h(output)0 11734 y(b)-22 b(uf)-28 b(fer)226 b(if)f(there)i(is)e(enough)j(room,)237 b(or)225 b(call)p 16557 11734 V 625 w(XSend)j(with)e(its)e(ar)-22 b(-)0 13062 y(guments)212 b(otherwise.)322 b(The)p 10863 13062 V 611 w(XSend)213 b(function)f(uses)f(the)g(write)-28 b(v)0 14390 y(system)288 b(call)f(to)h(write)f(both)i(the)f(b)-22 b(uf)-28 b(fer)288 b(and)h(the)f(e)-17 b(xtra)289 b(data)g(in)0 15719 y(one)396 b(system)e(call,)424 b(without)395 b(further)f(cop)-11 b(ying.)698 b(Finally)-72 b(,)425 b(if)394 b(a)0 17047 y(reply)371 b(is)f(e)-17 b(xpected)375 b(from)370 b(the)i(serv)-17 b(er)-44 b(,)p 15669 17047 V 792 w(XReply)373 b(is)d(called)i(to)0 18376 y(w)-11 b(ait)280 b(for)g(the)h(round-trip)f(to)h(complete)h(so)e (the)h(library)f(can)h(re-)0 19704 y(turn)c(the)g(data)h(to)f(the)h (caller)-61 b(.)1107 21090 y(The)412 b(Display)g(must)g(be)g(lock)-11 b(ed)413 b(during)g(this)d(process)i(for)0 22418 y(tw)-11 b(o)277 b(reasons:)830 24203 y(1.)554 b(The)273 b(block)g(of)f(memory)h (is)e(allocated)i(directly)g(from)e(the)2214 25532 y(output)287 b(b)-22 b(uf)-28 b(fer)285 b(of)h(the)g(Display)-72 b(,)288 b(and)f(then)f(written)f(to)h(by)2214 26860 y(subsequent)279 b(instructions.)830 28188 y(2.)554 b(The)219 b(\223current)h(sequence)h (number\224)f(is)d(stored)i(in)f(the)h(Dis-)2214 29517 y(play)-72 b(.)389 b(It)292 b(is)f(updated)j(by)f(GetReq,)k(b)-22 b(ut)292 b(then)i(if)d(a)h(reply)h(is)2214 30845 y(e)-17 b(xpected,)428 b(that)396 b(number)i(must)d(remain)i(constant)g(until)p 2214 32173 V 2546 32173 a(XReply)278 b(is)f(called.)1107 33958 y(Xlib)254 b(of)-28 b(fers)253 b(a)h(feature)h(called)g (synchronous)h(mode.)337 b(The)255 b(X)0 35286 y(manual)279 b(page)f(says,)2214 37674 y(Since)505 b(Xlib)f(normally)g(b)-22 b(uf)-28 b(fers)504 b(requests)g(to)f(the)2214 39002 y(serv)-17 b(er)-44 b(,)423 b(errors)393 b(do)h(not)g(necessarily)h (get)f(reported)2214 40331 y(immediately)564 b(after)e(the)-17 b(y)564 b(occur)-61 b(.)1200 b(This)563 b(option)2214 41659 y(turns)365 b(of)-28 b(f)365 b(the)h(b)-22 b(uf)-28 b(fering)367 b(so)e(that)h(the)g(application)2214 42987 y(can)260 b(be)g(deb)-22 b(ugged.)340 b(It)258 b(should)i(ne)-28 b(v)-17 b(er)261 b(be)e(used)h(with)2214 44316 y(a)277 b(w)-11 b(orking)278 b(program.)0 46703 y(Inside)574 b(of)f(Xlib,)647 b(this)573 b(is)g(implemented)i(with)f(a)g(function)0 48032 y(pointer)250 b(\(synchandler\))h(stored)f(in)f(the)h(Display)f (structure)h(and)0 49360 y(called)366 b(at)f(the)g(end)h(of)f(e)-28 b(v)-17 b(ery)367 b(protocol)f(stub)-44 b(.)606 b(\(The)366 b(function)0 50688 y(pointer)396 b(is)e(occasionally)j(used)f(for)f (other)g(purposes,)426 b(and)396 b(at)0 52017 y(those)428 b(times)g(the)g(original)g(pointer)g(is)f(sa)-22 b(v)-17 b(ed)430 b(in)d(the)i(sa)-22 b(v)-17 b(ed-)0 53345 y(synchandler)332 b(pointer)-61 b(.\))499 b(The)330 b(SyncHandle)j(macro)d(hides)f(the)0 54674 y(details)277 b(of)g(that)g(function)h(call.)1107 56060 y(In)255 b(the)h(core)g(X)g(protocol,)261 b(an)-17 b(y)257 b(dra)-17 b(wing)257 b(request)f(requires)g(a)0 57388 y(graphics)241 b(conte)-17 b(xt)241 b(\(GC\))e(identi\002er)h(as) g(one)g(of)g(its)e(parameters.)0 58716 y(GCs)365 b(encapsulate)i(a)e (good)h(deal)g(of)e(state)h(that)g(often)g(should)0 60045 y(persist)351 b(between)k(dra)-17 b(wing)354 b(requests,)372 b(and)353 b(so)g(are)g(both)g(con-)0 61373 y(v)-17 b(enient)321 b(and)f(bandwidth-ef)-28 b(\002cient.)473 b(A)319 b(small)g(challenge)i (lies)0 62702 y(in)269 b(creating)g(a)g(con)-44 b(v)-17 b(enient)272 b(C-language)f(interf)-11 b(ace)270 b(for)e(setting)0 64030 y(the)378 b(man)-17 b(y)380 b(properties)e(of)f(a)h(GC,)g(and)h (Xlib)f(pro)-17 b(vides)379 b(a)f(col-)0 65358 y(lection)368 b(of)f(functions)i(allo)-28 b(wing)368 b(the)g(application)h(to)f(set)f (one)0 66687 y(property)328 b(at)e(a)h(time.)492 b(Of)326 b(course,)340 b(it)325 b(w)-11 b(ould)328 b(be)f(inef)-28 b(\002cient)329 b(to)0 68015 y(generate)374 b(a)e(request)g(e)-28 b(v)-17 b(ery)374 b(time)d(an)-17 b(y)373 b(of)f(these)g(functions)h (is)0 69343 y(called,)c(so)350 b(Xlib)g(only)h(constructs)g(a)f (request)h(modifying)g(the)0 70672 y(GC)310 b(when)h(some)f(other)g (request)h(that)e(uses)h(that)g(GC)g(is)e(about)0 72000 y(to)330 b(be)h(constructed,)344 b(and)332 b(then)f(only)f(if)g(the)g (properties)g(of)g(the)26800 1107 y(GC)385 b(are)h(truly)e(dif)-28 b(ferent)386 b(on)f(the)h(client)f(than)h(on)g(the)f(serv)-17 b(er)-61 b(.)26800 2435 y(The)278 b(FlushGC)g(macro)g(hides)g(these)f (details.)27907 3796 y(It)337 b(is)h(frequently)h(con)-44 b(v)-17 b(enient)342 b(to)c(ha)-22 b(v)-17 b(e)340 b(a)f(standardized)h (set)26800 5125 y(of)463 b(strings)f(for)h(inter)-22 b(-client)463 b(communications,)512 b(b)-22 b(ut)463 b(prefer)-22 b(-)26800 6453 y(able)356 b(to)g(compress)g(the)g (representation)h(of)e(the)h(strings.)578 b(The)26800 7781 y(X)274 b(serv)-17 b(er)275 b(maintains)g(a)g(list)d(of)j (\223atoms\224,)g(which)h(are)f(numbers)26800 9110 y(that)224 b(are)g(uniquely)h(mapped)h(to)e(strings)f(for)g(the)h(lifetime)f(of)g (the)26800 10438 y(X)294 b(serv)-17 b(er)295 b(process.)396 b(Applications)295 b(may)h(use)e(the)h(InternAtom)26800 11766 y(request)407 b(to)f(get)g(\(or)f(create,)439 b(if)405 b(necessary)j(and)f(desired\))f(the)26800 13095 y(atom)229 b(associated)h(with)e(a)h(string,)237 b(and)230 b(the)f(GetAtomName)h (re-)26800 14423 y(quest)312 b(to)f(get)h(the)g(string)f(for)g(a)h (particular)g(atom.)447 b(Since)313 b(most)26800 15751 y(applications)307 b(participate)f(in)f(a)g(signi\002cant)h(number)h (of)d(inter)-22 b(-)26800 17080 y(client)416 b(communications)h(using)f (a)g(number)g(of)f(atoms,)450 b(Xlib)26800 18408 y(caches)315 b(part)e(of)g(the)h(mapping)h(held)f(by)g(the)f(serv)-17 b(er)-61 b(.)452 b(The)315 b(size)26800 19736 y(of)277 b(the)g(cache)i(is)d(currently)i(hard-coded)i(to)d(be)h(64)f(atoms.) 26800 22022 y Ff(2.1.3)1329 b(Utilities)333 b(Lay)-13 b(er)26800 23820 y Fe(From)327 b(the)g(point)g(of)f(vie)-28 b(w)327 b(of)f(the)h(X)g(protocol,)339 b(an)-17 b(y)328 b(code)g(not)26800 25149 y(pro)-17 b(viding)368 b(transport)d(or)h (stubs)f(for)g(requests)h(and)h(responses)26800 26477 y(is)441 b(utility)h(code.)841 b(Some)443 b(functions)g(contain)h(both) g(protocol)26800 27805 y(and)412 b(utility)f(functionality)-72 b(.)748 b(XPutImage)413 b(is)d(an)i(e)-17 b(xample)414 b(of)26800 29134 y(this.)334 b(In)250 b(addition)h(to)g(deli)-28 b(v)-17 b(ering)252 b(image)f(data)h(to)e(the)h(X)f(serv)-17 b(er)-44 b(,)26800 30462 y(XPutImage)345 b(splits)c(the)i(image)h(if)e (it)g(e)-17 b(xceeds)346 b(the)d(maximum)26800 31790 y(request)402 b(length;)465 b(byte-sw)-11 b(aps)403 b(indi)-28 b(vidual)404 b(pix)-17 b(els;)464 b(and)403 b(does)26800 33119 y(other)278 b(con)-44 b(v)-17 b(ersions)278 b(as)f(needed.)26800 35404 y Ff(2.2)1329 b(Xlib)332 b(Modules)f(and)g(Interfaces)26800 37203 y Fe(Since)317 b(Xlib)e(contains)h(a)f(wide)h(v)-28 b(ariety)316 b(of)g(distinct)e(interf)-11 b(aces)26800 38531 y(and)264 b(functionality)-72 b(,)267 b(here)d(is)e(a)h(list)e (of)i(the)g(major)g(components.)27907 39892 y Fd(loc)-22 b(king:)621 b Fe(Thread)418 b(synchronization)g(primiti)-28 b(v)-17 b(es,)450 b(serving)26800 41220 y(to)277 b(protect)h(the)f (Display)h(structure.)27907 42581 y Fd(tr)-17 b(ansport:)982 b Fe(Lo)-28 b(w-le)g(v)-17 b(el)599 b(communication)g(with)d(one)i(or) 26800 43909 y(more)215 b(X)g(serv)-17 b(ers,)227 b(encapsulating)218 b(support)d(for)g(a)g(v)-28 b(ariety)216 b(of)e(re-)26800 45238 y(liable)309 b(stream)g(protocols)h(and)h(handling)g(b)-22 b(uf)-28 b(fering)310 b(and)g(con-)26800 46566 y(nection)279 b(setup.)27907 47927 y Fd(cor)-41 b(e)237 b(pr)-50 b(otocol:)324 b Fe(Stubs)237 b(for)f(all)g(requests)h(in)f(the)h(core)g(X)g(pro-) 26800 49255 y(tocol.)27907 50616 y Fd(cut)348 b(b)-22 b(uf)i(fer)-11 b(s:)485 b Fe(Utility)347 b(functions)i(for)e (manipulating)k(selec-)26800 51945 y(tions,)276 b(also)h(kno)-28 b(wn)280 b(as)d(cut)g(b)-22 b(uf)-28 b(fers.)27907 53305 y Fd(gc:)471 b Fe(Graphics)341 b(conte)-17 b(xt)343 b(cache,)358 b(allo)-28 b(wing)342 b(applications)g(to)26800 54634 y(change)325 b(the)e(man)-17 b(y)324 b(properties)f(of)f(a)h(graphics)g (conte)-17 b(xt)324 b(while)26800 55962 y(only)437 b(generating)h (requests)e(when)i(the)e(graphics)i(conte)-17 b(xt)438 b(is)26800 57291 y(used.)27907 58651 y Fd(ima)-11 b(g)g(e:)853 b Fe(An)531 b(assortment)h(of)f(utility)g(functions)h(for)e(op-)26800 59980 y(erating)402 b(on)g(client-side)g(image)g(b)-22 b(uf)-28 b(fers,)432 b(including)403 b(loading)26800 61308 y(bitmaps)277 b(from)g(\002les.)27907 62669 y Fd(e)-17 b(vents:)399 b Fe(Xlib)304 b(pro)-17 b(vides)306 b(a)f(v)-28 b(ariety)305 b(of)g(e)-28 b(v)-17 b(ent)306 b(queue)h(search)26800 63997 y(functions,)269 b(matching)e(on)g(criteria)e(such)i(as)e (whether)i(an)g(e)-28 b(v)-17 b(ent)26800 65326 y(is)276 b(related)i(to)f(a)g(speci\002c)h(windo)-28 b(w)-72 b(.)27907 66687 y Fd(icccm:)900 b Fe(The)556 b(Inter)-22 b(-Client)554 b(Communications)j(Con)-44 b(v)-17 b(en-)26800 68015 y(tions)284 b(Manual)h([Ros])f(standardizes)h(such)g(things)g(as)f (commu-)26800 69343 y(nicating)368 b(windo)-28 b(w)368 b(titles)e(to)g(windo)-28 b(w)369 b(managers.)613 b(Xlib)367 b(pro-)26800 70672 y(vides)311 b(utility)f(functions)h(for)e(the)i (operations)h(documented)i(in)26800 72000 y(the)277 b(manual.)p eop end %%Page: 4 4 TeXDict begin 4 3 bop 1107 1107 a Fd(r)-41 b(e)d(gion:)519 b Fe(The)365 b(re)-17 b(gion)366 b(data)f(structure)g(describes)g (arbitrary)0 2435 y(sets)305 b(of)h(pix)-17 b(els.)432 b(It)305 b(has)i(been)h(re-implemented)g(se)-28 b(v)-17 b(eral)307 b(times)0 3764 y(in)234 b(dif)-28 b(ferent)234 b(parts)f(of)h(the)g(X)f(W)-44 b(indo)-28 b(w)235 b(System)g(because)h (it)c(has)0 5092 y(broad)327 b(utility;)349 b(b)-22 b(ut)326 b(in)g(Xlib)g(it)f(is)g(not)h(useful)g(for)f(much)i(more)0 6420 y(than)278 b(setting)f(arbitrary)g(graphics)h(conte)-17 b(xt)279 b(clipping)f(re)-17 b(gions.)1107 7772 y Fd(r)-41 b(esour)g(ce)610 b(db:)1007 b Fe(Xt)608 b([AS90)q(],)691 b(the)609 b(original)h(X)e(T)-89 b(oolkit,)0 9101 y(gets)240 b(application)j(preferences)e(from)f(the)h(\223resource)h(manager)0 10429 y(database\224,)268 b(which)d(is)e(stored)g(as)h(a)g(property)g (on)g(the)g(root)g(win-)0 11757 y(do)-28 b(w)303 b(of)e(the)h(\002rst)e (screen)j(of)e(each)i(serv)-17 b(er)-61 b(.)417 b(Xlib)301 b(pro)-17 b(vides)303 b(the)0 13086 y(lo)-28 b(w-le)g(v)-17 b(el)316 b(support)e(for)f(this)h(mechanism,)324 b(although)316 b(it)d(is)g(not)0 14414 y(generally)279 b(used)e(in)g(ne)-28 b(w)279 b(applications)f(or)f(toolkits.)1107 15766 y Fd(xom:)365 b Fe(The)288 b(X)f(Output)h(Methods)h(pro)-17 b(vide)289 b(support)f(for)f(dis-)0 17094 y(playing)469 b(te)-17 b(xt)468 b(encoded)i(using)e(ISO)f(2022,)516 b(also)467 b(kno)-28 b(wn)470 b(as)0 18423 y(ECMA-35.)335 b(This)249 b(standard,)256 b(which)250 b(predates)g(Unicode,)257 b(pro-)0 19751 y(vides)282 b(escape)h(sequences)g(for)e(switching)h (between)h(character)0 21079 y(sets.)1107 22431 y Fd(cms:)405 b Fe(A)308 b(\223color)h(management)i(system\224)d(\(CMS\))g(pro)-17 b(vides)0 23760 y(mechanisms)417 b(for)f(transforming)g(colors)g (between)i(dif)-28 b(fering)0 25088 y(color)362 b(spaces,)383 b(including)363 b(de)-28 b(vice-dependent)367 b(spaces.)597 b(W)-44 b(ith)0 26416 y(a)252 b(CMS,)g(users)f(may)h(calibrate)g (scanners,)258 b(printers,)e(and)c(mon-)0 27745 y(itors)336 b(so)h(that)g(colors)g(appear)i(identical.)525 b(Xcms)337 b([Ber95)q(])g(can)0 29073 y(only)278 b(use)f(monitor)h(calibration)g (data.)1107 30425 y Fd(xkb:)405 b Fe(The)309 b(X)e(K)-28 b(e)-17 b(yboard)311 b(Extension)e(generalizes)h(the)e(k)-11 b(e)-17 b(y-)0 31753 y(board)251 b(model)f(of)g(the)g(core)g(protocol.) 335 b(Xlib)249 b(contains)i(code)g(for)0 33082 y(interacting)262 b(with)e(this)g(e)-17 b(xtension)262 b(if)e(supported)i(on)f(the)g (serv)-17 b(er)0 34410 y(and)341 b(compatibility)f(code)h(for)e (applications)i(and)g(serv)-17 b(ers)339 b(un-)0 35738 y(a)-17 b(w)-11 b(are)278 b(of)f(XKB.)1107 37090 y Fd(xlc:)555 b Fe(The)384 b(X)e(Locale)j(implementation)g(maps)e(strings)e(be-)0 38419 y(tween)433 b(a)g(v)-28 b(ariety)433 b(of)f(encodings)j(and)e (formats.)808 b(Supported)0 39747 y(formats)439 b(include)i(C)f (strings,)479 b(wide)440 b(character)i(strings,)479 b(and)0 41075 y(UTF-8,)278 b(among)g(others.)1107 42427 y Fd(xim:)454 b Fe(The)334 b(X)f(Input)g(Methods)h(allo)-28 b(w)333 b(a)g(user)f(to)h(input)g(te)-17 b(xt)0 43756 y(using)266 b(alphabets)i(not)e(ph)-6 b(ysically)268 b(present)e(on)h(his)e(or)g (her)i(k)-11 b(e)-17 b(y-)0 45084 y(board.)514 b(Japanese)335 b(te)-17 b(xt,)348 b(for)332 b(instance,)349 b(can)334 b(be)h(input)f(by)g(typ-)0 46412 y(ing)320 b(the)g(phonetic)h (pronunciation)i(of)c(a)h(w)-11 b(ord)320 b(and)g(searching)0 47741 y(for)302 b(a)h(character)i(with)e(that)g(pronunciation)i(and)f (the)g(intended)0 49069 y(meaning.)0 51601 y Ff(3)1329 b(Some)331 b(Xlib)h(Issues)0 53379 y Fe(Gi)-28 b(v)-17 b(en)348 b(skill)d(at)h(reading)h(softw)-11 b(are)346 b(written)g(in)g(C)g(and)h(a)f(little)0 54708 y(understanding)356 b(of)e(the)f(X)h(protocol,)373 b(almost)354 b(an)-17 b(y)355 b(indi)-28 b(vidual)0 56036 y(Xlib)425 b(source)h(\002le)g(may) g(be)g(understood)i(without)e(too)f(much)0 57365 y(ef)-28 b(fort.)333 b(Dif)-28 b(\002culty)250 b(in)f(comprehending)k(the)c (whole)i(is)c(due)k(pri-)0 58693 y(marily)232 b(to)g(b)-22 b(ulk)233 b(of)f(Xlib)-44 b(.)327 b(The)233 b(broad)h(scope)f(of)f (Xlib,)241 b(together)0 60021 y(with)j(the)h(engineering)h(needed)h(to) d(mak)-11 b(e)246 b(it)d(w)-11 b(ork)245 b(on)g(comput-)0 61350 y(ers)298 b(of)g(the)h(1980s,)304 b(led)299 b(to)f(a)h(lar)-20 b(ge)299 b(implementation,)305 b(and)299 b(this)0 62678 y(implementation)229 b(has)e(gro)-28 b(wn)229 b(dramatically)f(with)f (time.)326 b(Also,)0 64006 y(since)341 b(all)e(of)h(the)h(source)g(of)f (Xlib)f(w)-11 b(as)341 b(written)e(by)i(hand,)357 b(re-)0 65335 y(vising)262 b(design)h(decisions)g(that)f(af)-28 b(fect)262 b(an)-17 b(y)264 b(signi\002cant)f(part)f(of)0 66663 y(the)277 b(code)i(is)d(an)i(e)-17 b(xceedingly)281 b(dif)-28 b(\002cult)278 b(task.)1107 68015 y(As)319 b(a)g(brief)g(e)-17 b(xample,)332 b(xtrans)320 b(\(co)-17 b(v)g(ered)321 b(in)f(Section)g(2.1.1\))0 69343 y(is)390 b(included)j(in)e(Xlib)g(in)f(tw)-11 b(o)391 b(forms:)571 b(X11T)-39 b(rans)392 b(and)g(Xim-)0 70672 y(T)-39 b(rans.)592 b(These)360 b(tw)-11 b(o)360 b(forms)f(produce)j(nearly)f(identical)f (com-)0 72000 y(piled)349 b(code,)367 b(so)347 b(the)-17 b(y)350 b(are)e(essentially)g(redundant.)559 b(The)-17 b(y)349 b(are)26800 1107 y(compiled)368 b(into)e(Xlib)g(using)h(a)f (technique)j(strongly)e(discour)-22 b(-)26800 2435 y(aged)363 b(in)f(C)f(programming:)514 b(the)362 b(C)f(preprocessor)i(is)e(used)h (to)26800 3764 y(include)313 b(source)g(from)f(a)g(.c)f(\002le)i(into)f (another)-44 b(,)321 b(nearly)313 b(empty)-72 b(,)26800 5092 y(.c)354 b(\002le.)573 b(It)353 b(tak)-11 b(es)354 b(a)g(good)h(deal)g(of)f(time)f(for)g(e)-28 b(v)-17 b(en)356 b(an)f(e)-17 b(xperi-)26800 6420 y(enced)303 b(programmer)g(to)e (understand)i(this)e(particular)g(compo-)26800 7749 y(nent.)26800 9986 y Ff(3.1)1329 b(In\003exible)331 b(Implementation)26800 11737 y Fe(Xlib)442 b(pro)-17 b(vides)444 b(tw)-11 b(o)443 b(supported)h(w)-11 b(ays)442 b(of)h(accessing)h(infor)-22 b(-)26800 13065 y(mation)460 b(stored)g(in)f(the)h(Display)g (structure:)707 b(functions)461 b(and)26800 14394 y(macros.)384 b(This)291 b(means)g(that)g(of)-28 b(fsets)289 b(in)i(the)g(Display)g (structure)26800 15722 y(must)403 b(remain)g(constant)h(to)f(maintain)h (binary)g(compatibility)26800 17050 y(with)411 b(an)-17 b(y)413 b(code)g(using)f(these)f(macros.)747 b(Unfortunately)-72 b(,)446 b(the)26800 18379 y(speci\002cation)279 b([SGN88)r(,)d(P12])i (says:)29014 20857 y(The)306 b(macros)g(are)g(used)g(for)f(C)g (programming,)315 b(and)29014 22186 y(their)496 b(corresponding)i (function)f(equi)-28 b(v)g(alents)498 b(are)29014 23514 y(for)276 b(other)i(language)i(bindings.)27907 25993 y(Because)258 b(of)d(this)g(advice,)262 b(X)256 b(applications,)261 b(which)c(are)f(pre-)26800 27321 y(dominantly)521 b(written)e(in)g(C)g (and)i(C++,)580 b(generally)521 b(use)e(the)26800 28649 y(macro)308 b(v)-28 b(ariants)308 b(of)e(the)i(accessors.)434 b(The)-17 b(y)308 b(lea)-22 b(v)-17 b(e)309 b(Xlib)e(de)-28 b(v)-17 b(el-)26800 29978 y(opers)306 b(little)f(\003e)-17 b(xibility)307 b(to)e(re)-28 b(vise)307 b(design)f(decisions.)431 b(F)-17 b(or)306 b(bi-)26800 31306 y(nary)238 b(compatibility)-72 b(,)247 b(neither)238 b(the)g(macros)h(nor)f(the)g(data)g(struc-)26800 32634 y(tures)277 b(that)g(the)-17 b(y)278 b(access)g(can)g(e)-28 b(v)-17 b(er)279 b(be)e(changed.)27907 33973 y(This)364 b(problem)i(is)e(aggra)-22 b(v)-28 b(ated)367 b(by)f(the)f(f)-11 b(act)364 b(that)h(Xlib)f(has)26800 35302 y(traditionally)326 b(installed)f(the)h(\223pri)-28 b(v)g(ate\224)328 b(header)f(\002le)f (Xlibint.h)26800 36630 y(alongside)489 b(the)e(public)h(header)h (\002les)e(intended)i(to)e(be)h(used)26800 37959 y(by)332 b(applications)g(and)g(libraries.)504 b(It)330 b(w)-11 b(as)331 b(made)h(a)-22 b(v)-28 b(ailable)333 b(for)26800 39287 y(the)325 b(sole)f(purpose)i(of)e(pro)-17 b(viding)326 b(e)-17 b(xtension)326 b(libraries)e(access)26800 40615 y(to)317 b(functions,)327 b(macros,)g(and)318 b(data)f(structures)f (con)-44 b(v)-17 b(enient)320 b(for)26800 41944 y(processing)361 b(X)f(protocol)h(messages.)593 b(Ho)-28 b(we)g(v)-17 b(er)-44 b(,)383 b(toolkit)361 b(and)26800 43272 y(application)447 b(writers)d(ha)-22 b(v)-17 b(e)447 b(tak)-11 b(en)446 b(adv)-28 b(antage)449 b(of)c(the)g(direct)26800 44600 y(data)414 b(structure)g(access,)448 b(and)415 b(no)-28 b(w)415 b(some)f(code)h(depends)h(on)26800 45929 y(v)-28 b(ag)-6 b(aries)279 b(of)e(Xlib)g(implementation.)26800 48166 y Ff(3.2)1329 b(Unpr)-24 b(edictable)330 b(Requests)26800 49917 y Fe(Immediately)341 b(after)e(connection)j(setup,)355 b(Xlib)340 b(automatically)26800 51245 y(generates)314 b(se)-28 b(v)-17 b(eral)313 b(requests)f(re)-17 b(g)-6 b(ardless)314 b(of)e(whether)h(the)f(ap-)26800 52574 y(plication)278 b(needs)g(those)g(steps)e(tak)-11 b(en.)345 b(The)278 b(steps)f(are)27907 54311 y Fc(\017)554 b Fe(Setting)278 b(up)f(support)h(for)e(requests)i(lar)-20 b(ger)277 b(than)h(256kB.) 27907 55640 y Fc(\017)554 b Fe(Creating)259 b(a)f(def)-11 b(ault)259 b(graphics)g(conte)-17 b(xt)260 b(for)d(each)j(screen.)27907 56968 y Fc(\017)554 b Fe(Retrie)-28 b(ving)278 b(the)g(resource)g (database.)27907 58296 y Fc(\017)554 b Fe(Initializing)277 b(the)g(XKEYBO)-39 b(ARD)280 b(e)-17 b(xtension.)27907 60034 y(If)340 b(the)h(serv)-17 b(er)341 b(supports)g(both)h(the)g (BIG-REQ)-11 b(UESTS)343 b(and)26800 61362 y(XKEYBO)-39 b(ARD)326 b(e)-17 b(xtensions,)336 b(then)324 b(this)e(process)i(will)e (block)26800 62691 y(application)442 b(startup)e(for)f(the)h(duration)h (of)f(\002)-28 b(v)-17 b(e)442 b(round-trips)26800 64019 y(to)410 b(the)h(serv)-17 b(er)-61 b(.)743 b(On)411 b(modern)g (con\002gurations,)446 b(the)411 b(resource)26800 65347 y(database)353 b(can)f(be)f(easily)g(30)h(times)e(as)h(lar)-20 b(ge)352 b(as)e(the)h(data)h(re-)26800 66676 y(turned)278 b(by)g(the)f(serv)-17 b(er)278 b(during)g(connection)i(setup.)27907 68015 y(This)389 b(is)f(only)i(one)h(e)-17 b(xample)391 b(of)e(the)h(lar)-20 b(ger)389 b(problem)i(that)26800 69343 y(Xlib)220 b(generates)i(X)e(protocol)h(requests)f(that)h(are)f (not)h(ob)-17 b(viously)26800 70672 y(related)270 b(to)f(the)g(needs)h (of)f(the)h(application.)342 b(Another)270 b(e)-17 b(xample)26800 72000 y(is)354 b(that)h(it)g(is)f(impossible)h(to)g(use)h(the)f(public) i(API)e(of)g(Xlib)g(to)p eop end %%Page: 5 5 TeXDict begin 5 4 bop 0 1107 a Fe(send)257 b(a)g(GetW)-44 b(indo)-28 b(wAttrib)-22 b(utes)258 b(request)f(without)g(simultane-)0 2435 y(ously)251 b(sending)g(a)g(GetGeometry)h(request.)335 b(Between)252 b(this)e(sort)0 3764 y(of)214 b(opportunistic)h(request)g (generation)h(and)f(the)g(assortment)f(of)0 5092 y(caches)g (implemented)g(in)e(Xlib,)225 b(an)212 b(application)i(cannot)g(ef)-28 b(fec-)0 6420 y(ti)g(v)-17 b(ely)362 b(predict)f(what)h(protocol)g (requests)f(Xlib)g(will)e(produce)0 7749 y(on)332 b(its)f(behalf.)508 b(That,)346 b(in)332 b(turn,)345 b(suggests)332 b(that)g(these)h (features)0 9077 y(w)-11 b(ould)344 b(ha)-22 b(v)-17 b(e)346 b(been)f(more)f(useful)f(as)h(an)g(e)-17 b(xtra)344 b(layer)g(b)-22 b(uilt)343 b(on)0 10405 y(top)397 b(of)g(functions)g (pro)-17 b(viding)399 b(direct)e(control)g(o)-17 b(v)g(er)399 b(protocol)0 11734 y(generation.)0 14040 y Ff(3.3)1329 b(Thr)-24 b(eading)0 15859 y Fe(One)404 b(aspect)g(of)f(Xlib)g(that)g (is)f(not)i(at)f(all)g(straightforw)-11 b(ard)403 b(is)0 17187 y(the)251 b(support)g(for)e(multi-threaded)j(applications.)336 b(It)249 b(is)g(perhaps)0 18516 y(partly)318 b(due)g(to)g(the)f(comple) -17 b(xity)320 b(of)d(this)g(aspect)h(that)g(the)g(only)0 19844 y(application)243 b(we)f(could)h(\002nd)g(to)e(test)g(Xlib)g(in)h (a)f(multi-threaded)0 21173 y(setting)326 b(is)f(ico,)338 b(a)326 b(sample)h(program)g(from)f(the)g(reference)h(im-)0 22501 y(plementation.)479 b(Whate)-28 b(v)-17 b(er)324 b(the)e(reasons,)333 b(the)322 b(thread)h(support)0 23829 y(in)352 b(Xlib)g(is)f(poorly)j(tested)e(\(though)i(we)e(ha)-22 b(v)-17 b(e)354 b(yet)f(to)f(be)h(able)0 25158 y(to)241 b(demonstrate)h(an)-17 b(y)242 b(actual)g(f)-11 b(aults\),)247 b(almost)240 b(ne)-28 b(v)-17 b(er)243 b(used,)249 b(and)0 26486 y(v)-17 b(ery)278 b(dif)-28 b(\002cult)278 b(to)f(understand)i (in)e(depth.)1107 27856 y(This)319 b(is)f(unfortunate.)472 b(Threads)320 b(pro)-17 b(vide)321 b(a)f(po)-28 b(werful)320 b(w)-11 b(ay)0 29185 y(to)224 b(or)-20 b(g)-6 b(anize)226 b(computation)h(and)e(I/O)e(with)g(a)h(minimum)h(of)f(pro-)0 30513 y(grammer)352 b(ef)-28 b(fort.)566 b(Major)352 b(X)f(applications)i(lik)-11 b(e)352 b(Mozilla)f(use)0 31841 y(threads)365 b(to)f(great)h(ef)-28 b(fect,)386 b(yet)364 b(are)h(careful)f(to)h(mak)-11 b(e)365 b(all)f(Xlib)0 33170 y(calls)229 b(from)g(a)h(single)g(thread.)328 b(Users)229 b(see)g(this)g(as)g(their)h(applica-)0 34498 y(tions)259 b(freezing)h(occasionally)-72 b(,)265 b(for)258 b(e)-17 b(xample)262 b(while)d(rendering)0 35826 y(a)277 b(ne)-28 b(w)278 b(web)g(page)h(in)e(a)g(bro)-28 b(wser)-61 b(.)1107 37197 y(This)445 b(section)g(pro)-17 b(vides)446 b(a)f(sample)h(of)e (confusing)j(thread)0 38525 y(synchronization)320 b(situations)c(in)h (Xlib,)327 b(with)316 b(e)-17 b(xplanations)320 b(of)0 39853 y(ho)-28 b(w)343 b(those)f(situations)f(w)-11 b(ork.)538 b(This)342 b(is)e(by)j(no)f(means)h(an)f(e)-17 b(x-)0 41182 y(hausti)-28 b(v)-17 b(e)279 b(list,)c(ho)-28 b(we)g(v)-17 b(er)-61 b(.)0 43488 y Ff(3.3.1)1329 b(XLockDisplay)0 45307 y Fe(Nearly)346 b(e)-28 b(v)-17 b(ery)348 b(function)f(in)e(Xlib) h(in)-44 b(v)-22 b(ok)-11 b(es)346 b(the)g(LockDisplay)0 46635 y(and)333 b(UnlockDisplay)i(macros.)508 b(Between)334 b(LockDisplay)h(and)0 47964 y(UnlockDisplay)-72 b(,)469 b(the)430 b(function)g(is)e(permitted)i(to)f(mak)-11 b(e)430 b(an)-17 b(y)0 49292 y(changes)342 b(to)e(the)g(state)g(of)g (the)g(Display)g(structure.)532 b(This)340 b(lock)0 50621 y(is)276 b(implemented)j(using)f(a)f(mute)-17 b(x.)1107 51991 y(In)245 b(addition,)253 b(the)246 b(documented)j(interf)-11 b(ace)246 b(to)f(Xlib)h(includes)0 53319 y(XLockDisplay)422 b(and)f(XUnlockDisplay)-72 b(.)774 b(The)421 b(documenta-)0 54648 y(tion)530 b(says)g(that)g(XLockDisplay)j(may)e(be)f(called)h (multiple)0 55976 y(times)259 b(from)h(the)g(same)h(thread)g(without)f (deadlock,)266 b(and)261 b(XUn-)0 57304 y(lockDisplay)435 b(must)e(be)h(called)g(an)g(equal)h(number)f(of)f(times)0 58633 y(before)418 b(the)f(display)g(is)f(actually)i(unlock)-11 b(ed.)765 b(The)418 b(UNIX98)0 59961 y(standard)283 b(calls)e(this)f(a) i(recursi)-28 b(v)-17 b(e)283 b(mute)-17 b(x;)285 b(it)280 b(is)h(also)g(kno)-28 b(wn)284 b(as)0 61289 y(a)277 b(counting)i(mute) -17 b(x.)1107 62660 y(Ho)-28 b(we)g(v)-17 b(er)-44 b(,)230 b(XLockDisplay)219 b(and)e(XUnlockDisplay)i(are)d(not)0 63988 y(implemented)522 b(using)d(a)h(recursi)-28 b(v)-17 b(e)521 b(mute)-17 b(x.)1071 b(Instead,)580 b(the)-17 b(y)0 65316 y(use)508 b(condition)i(v)-28 b(ariables)509 b(together)g(with)e(a)h(non-recursi)-28 b(v)-17 b(e)0 66645 y(\(\223f)-11 b(ast\224\))390 b(mute)-17 b(x.)687 b(Pseudo-code)395 b(for)390 b(this)h(algorithm)h(is)e(pro-)0 67973 y(vided)278 b(in)f(Figure)h(2.)1107 69343 y(A)318 b(f)-11 b(air)317 b(amount)j(of)e(e)-17 b(xperience)322 b(at)c(w)-11 b(orking)319 b(with)f(concur)-22 b(-)0 70672 y(rent)422 b(softw)-11 b(are)422 b(is)f(required)i(to)f(understand)i (this)d(algorithm.)0 72000 y(While)333 b(it)e(does)i(seem)g(to)g (satisfy)e(its)g(speci\002cation,)348 b(a)333 b(clearer)26800 734 y Fb(_XInitDisplayLock)28128 2062 y(level)665 b(=)g(0)26800 4719 y(LockDisplay)28128 6047 y(lock)g(mutex)28128 7376 y(while)g(level)g(>)g(0)f(&&)h(thread)g(!=)f(self)29457 8704 y(wait)h(on)f(condition)i(variable)26800 11361 y(UnlockDisplay) 28128 12689 y(unlock)g(mutex)26800 15346 y(XLockDisplay)28128 16674 y(LockDisplay)28128 18002 y(++level)28128 19331 y(thread)g(=)e(self)28128 20659 y(UnlockDisplay)26800 23316 y(XUnlockDisplay)28128 24644 y(LockDisplay)28128 25973 y(--level)28128 27301 y(if)h(level)g(==)f(0)29457 28629 y(wake)h(up)f(all)h(waiting)g(threads)28128 29958 y(UnlockDisplay)28428 33279 y Fe(Figure)278 b(2:)343 b(Xlib)277 b(thread-synchronization)k(primiti)-28 b(v)-17 b(es)26800 36176 y(equi)-28 b(v)g(alent)360 b(is)d(desirable.)584 b(It)357 b(w)-11 b(ould)358 b(be)g(preferable)h(to)e(use)g(a)26800 37504 y(standard)370 b(mute)-17 b(x)370 b(to)f(implement)h(this)e (counting)j(mute)-17 b(x,)393 b(and)26800 38833 y(in)277 b(f)-11 b(act)277 b(we)g(de)-28 b(vised)279 b(and)f(tested)g(an)f (algorithm)h(to)f(do)h(that.)27907 40161 y(Unfortunately)-72 b(,)317 b(our)309 b(algorithm)g(still)d(w)-11 b(as)308 b(not)h(perfect)f(un-)26800 41490 y(der)455 b(the)g(metric)g(of)g (clarity)-72 b(.)877 b(That)456 b(algorithm)f(had)h(enough)26800 42818 y(problems)217 b(to)f(f)-11 b(all)216 b(back)i(to)e(an)i(e)-28 b(v)-17 b(en)218 b(simpler)e(plan:)314 b(just)216 b(use)g(re-)26800 44146 y(cursi)-28 b(v)-17 b(e)233 b(mute)-17 b(x)g(es.)330 b(The)233 b(UNIX98)g(standard)g(of)-28 b(fers)231 b(them,)242 b(and)26800 45475 y(using)257 b(them)g(reduces)h(all)e(four)h(of)f(the) h(synchronization)i(prim-)26800 46803 y(iti)-28 b(v)-17 b(es)346 b(in)f(Xlib)h(to)f(single-line)h(calls)g(to)f(pthread)p 46210 46803 333 45 v 401 w(mute)-17 b(x)p 49360 46803 V 400 w(lock)26800 48131 y(or)277 b(pthread)p 31383 48131 V 400 w(mute)-17 b(x)p 34532 48131 V 400 w(unlock.)26800 50346 y Ff(3.3.2)1329 b(GetReq)332 b(and)p 38023 50346 399 45 v 810 w(XReply)26800 52074 y Fe(An)-17 b(yone)606 b(reading)f(Xlib)f(sources)g(could)h(be)f(for)-20 b(gi)-28 b(v)-17 b(en)605 b(for)26800 53403 y(thinking)321 b(that)f(the)h (constraints)f(are)g(v)-17 b(ery)321 b(strict)d(on)j(functions)26800 54731 y(that)330 b(may)g(be)g(called)h(in)e(between)j(calls)d(to)g(the) h(GetReq)h(f)-11 b(am-)26800 56059 y(ily)423 b(of)h(macros)h(and)g(to)e (the)p 38508 56059 333 45 v 823 w(XReply)i(function.)785 b(After)423 b(all,)p 26800 57388 V 27132 57388 a(XReply)222 b(disco)-17 b(v)g(ers)222 b(the)f(sequence)i(number)f(that)e(it)g(is)f (w)-11 b(aiting)26800 58716 y(for)405 b(by)h(checking)j(the)d(v)-28 b(alue)408 b(in)d Fb(dpy->request)p Fe(,)440 b(which)26800 60044 y(w)-11 b(as)249 b(set)f(by)h(GetReq,)256 b(so)248 b(clearly)i(nothing)g(should)g(be)f(allo)-28 b(wed)26800 61373 y(to)277 b(touch)h(that)f(v)-28 b(alue)279 b(during)f(that)f (interv)-28 b(al.)27907 62702 y(No)g(w)344 b(note)g(that)f(se)-28 b(v)-17 b(eral)344 b(functions)g(call)f(Data)g(\(Xlibint.h\))26800 64030 y(between)517 b(GetReq)g(\(Xlibint.h\))d(and)p 42298 64030 V 914 w(XReply)j(\(XlibInt.c\);)26800 65358 y(Data)535 b(may)g(call)p 34063 65358 V 933 w(XSend)h(\(XlibInt.c\);)p 43682 65358 V 1060 w(XSend)g(may)g(call)p 26800 66687 V 27132 66687 a(XW)-89 b(aitF)-17 b(orWritable)312 b(\(XlibInt.c\);)325 b(and)p 43011 66687 V 710 w(XW)-89 b(aitF)-17 b(orWritable)26800 68015 y(may)492 b(release)f(the)g(display)h(lock)f(while)g(calling)h (select.)985 b(It)26800 69343 y(should)236 b(seem)f(disturbing)g(that)f (the)h(display)h(lock)f(might)g(be)g(re-)26800 70672 y(leased)316 b(during)g(this)e(period)i(where)g Fb(dpy->request)h Fe(must)26800 72000 y(not)277 b(be)h(touched.)p eop end %%Page: 6 6 TeXDict begin 6 5 bop 0 734 a Fb(#include)666 b()0 2062 y(#include)g()0 4719 y(static)f(char)g (atom_name[32768];)0 7376 y(void)g(*event_loop\(void)i(*arg\))0 8704 y({)1328 10032 y(Display)f(*dpy)f(=)f(arg;)1328 11361 y(XEvent)i(evt;)1328 12689 y(while\(1\))2657 14017 y(XNextEvent\(dpy,)h(&evt\);)0 15346 y(})0 18002 y(void)e(main\(void\)) 0 19331 y({)1328 20659 y(Display)h(*dpy;)1328 21988 y(pthread_t)g (event_thread;)1328 23316 y(Atom)f(atom;)1328 24644 y(int)g(i)f(=)h (sizeof\(atom_name\))i(-)d(1;)1328 25973 y(atom_name[i--])j(=)d('\\0';) 1328 27301 y(while\(i)i(>=)e(0\))2657 28629 y(atom_name[i--])i(=)f ('1';)1328 29958 y(XInitThreads\(\);)1328 31286 y(dpy)g(=)f (XOpenDisplay\(0\);)1328 32614 y(pthread_create\(&event_thread,)670 b(0,)11291 33943 y(event_loop,)c(dpy\);)1328 35271 y(atom)f(=)g (XInternAtom\(dpy,)i(atom_name,)13948 36599 y(False\);)0 37928 y(})3125 41249 y Fe(Figure)278 b(3:)344 b(Does)277 b(this)g(program)h(w)-11 b(ork?)344 b(\(Y)-111 b(es.\))1107 44660 y(This)413 b(situation)g(is)f(v)-17 b(ery)415 b(dif)-28 b(\002cult)414 b(to)f(reason)h(about:)617 b(The)0 45989 y(chain)304 b(of)f(calls)f(is)g(long,)310 b(the)303 b(functions)h(are)f (comple)-17 b(x)305 b(and)f(f)-11 b(ar)0 47317 y(apart)344 b(in)f(the)g(source,)361 b(and)344 b(the)f(circumstances)i(under)g (which)0 48645 y(the)277 b(display)h(lock)g(might)f(be)h(released)g (are)f(complicated.)1107 50231 y(Consider)263 b(Figure)h(3.)338 b(In)262 b(this)g(e)-17 b(xample)265 b(we)e(send)g(a)f(request,)0 51560 y(InternAtom,)399 b(which)374 b(will)f(send)i(back)h(a)e(reply;) 422 b(and)375 b(we)f(en-)0 52888 y(sure)267 b(that)g(the)g(atom)g(name) h(sent)f(in)g(the)g(request)g(is)f(lar)-20 b(ger)267 b(than)0 54216 y(the)293 b(output)h(b)-22 b(uf)-28 b(fer)293 b(in)g(Xlib)f(\(which)i(def)-11 b(aults)293 b(to)f(16kB\).)i(That)0 55545 y(will)337 b(cause)p 4922 55545 333 45 v 737 w(XSend)j(to)e(be)g (called)h(before)p 17398 55545 V 737 w(XReply)g(in)f(XIn-)0 56873 y(ternAtom.)735 b(Ho)-28 b(we)g(v)-17 b(er)-44 b(,)442 b(prior)407 b(to)h(sending)g(this)f(request,)440 b(we)0 58201 y(ensure)363 b(that)f(XNe)-17 b(xtEv)g(ent)365 b(is)c(w)-11 b(aiting)363 b(in)e(another)j(thread)f(to)0 59530 y(read)278 b(an)-17 b(y)278 b(responses)g(that)f(become)i(a)-22 b(v)-28 b(ailable)279 b(on)f(the)g(wire.)1107 61116 y(What)432 b(if)e(the)i(e)-28 b(v)-17 b(ent)434 b(thread)e(reads)g(from)f(the)h (connection)0 62444 y(while)p 3015 62444 V 888 w(XSend)490 b(is)e(trying)h(to)g(deli)-28 b(v)-17 b(er)490 b(the)g(InternAtom)f (re-)0 63772 y(quest?)594 b(Could)361 b(XNe)-17 b(xtEv)g(ent)364 b(read)d(the)f(reply)h(accidentally?)0 65101 y(If)276 b(so,)h(it)f(w)-11 b(ould)278 b(not)f(kno)-28 b(w)279 b(what)f(to)f(do)g(with)g(it.)1107 66687 y(The)311 b(trick)e(is)g(that) h(the)g(reply)g(cannot)i(come)f(back)h(until)d(the)0 68015 y(entire)393 b(request)h(has)g(been)h(written,)421 b(and)p 16747 68015 V 793 w(XSend)395 b(w)-11 b(as)393 b(care-)0 69343 y(fully)378 b(written)g(so)g(that)h(it)e(w)-11 b(ould)379 b(return)g(with)f(the)h(lock)g(held)0 70672 y(and)268 b(without)e(reading)i(as)f(soon)g(as)f(it)f(\002nishes)i (writing)f(its)g(sin-)0 72000 y(gle)333 b(request.)511 b(Therefore,)348 b(no)334 b(other)f(thread)h(has)f(an)h(opportu-)26800 1107 y(nity)277 b(to)g(read)h(the)f(reply)-72 b(.)27907 2478 y(This)219 b(lea)-22 b(v)-17 b(es)219 b(open)i(the)e(question)h (of)e(whether)i(there)f(is)f(some)26800 3806 y(other)436 b(f)-11 b(ault)434 b(in)h(this)f(part)i(of)e(Xlib)-44 b(.)817 b(F)-17 b(or)436 b(instance,)475 b(perhaps)26800 5135 y(GetReq)534 b(could)g(be)g(in)-44 b(v)-22 b(ok)-11 b(ed)534 b(from)e(another)j(thread)e(while)p 26800 6463 V 27132 6463 a(XW)-89 b(aitF)-17 b(orWritable)413 b(has)f(the)h (display)f(unlock)-11 b(ed,)448 b(and)413 b(per)-22 b(-)26800 7791 y(haps)259 b(the)g(sequence)h(number)g(stream)e(w)-11 b(ould)259 b(be)g(corrupted)h(as)26800 9120 y(a)365 b(result.)607 b(W)-89 b(e)366 b(continue)i(to)d(inspect)h(the)f(source)h(of)f(Xlib)g (for)26800 10448 y(cases)277 b(lik)-11 b(e)277 b(this.)26800 13021 y Ff(4)1329 b(Starting)332 b(Ov)-13 b(er:)412 b(XCB)26800 14842 y Fe(W)-89 b(e)613 b(w)-11 b(anted)613 b(a)f(simpler)-44 b(,)695 b(smaller)611 b(base)i(for)e(X)h(de)-28 b(v)-17 b(elop-)26800 16170 y(ment)341 b(than)h(Xlib,)355 b(so)341 b(we)g(wrote)f(XCB.)h(As)f(we)h(e)-17 b(xplained)344 b(in)26800 17498 y([MS01)q(],)29014 19840 y(XCB)671 b(is)g(intended)i (to)e(be)h(a)g(simple)f(and)h(di-)29014 21168 y(rect)433 b(binding)i(of)f(X)f(protocol)h(transactions)g(to)g(C)29014 22497 y(language)541 b(function)e(calls,)603 b(with)538 b(the)g(minimum)29014 23825 y(amount)228 b(of)e(machinery)j(necessary)f (to)e(achie)-28 b(v)-17 b(e)230 b(this)29014 25153 y(aim.)27907 27495 y(As)333 b(a)h(result,)346 b(the)334 b(XCB)g(interf)-11 b(ace)335 b(consists)e(of)g(little)f(more)26800 28823 y(than)368 b(functions)f(that)g(send)h(requests)f(to)g(the)g(X)g(serv) -17 b(er)367 b(and)h(a)26800 30152 y(bit)399 b(of)h(machinery)h(to)f (handle)h(the)f(responses.)711 b(This)400 b(mak)-11 b(es)26800 31480 y(its)372 b(interf)-11 b(ace)373 b(much)h(smaller)f(than)g(that)g (of)g(Xlib)-44 b(.)630 b(The)374 b(most)26800 32809 y(noticeable)252 b(bene\002ts)g(of)e(this)f(limited)h(interf)-11 b(ace)251 b(are)g(that)f(XCB)26800 34137 y(has)e(much)i(less)d(code)j(than)f (Xlib)g(and)g(a)f(much)i(simpler)e(imple-)26800 35465 y(mentation.)716 b(When)402 b(b)-22 b(uilt)400 b(with)h(reasonable)h (compiler)g(opti-)26800 36794 y(mizations,)258 b(XCB)c(is)f(26kB)h (compared)i(with)d(750kB)j(for)c(Xlib)-44 b(.)27907 38165 y(Layers)445 b(and)g(components)i(are)e(or)-20 b(g)-6 b(anized)447 b(in)e(XCB)f(in)g(a)26800 39493 y(manner)424 b(similar)e(to)g(that)h(presented)h(for)e(Xlib)h(in)f(Figure)i(1.)26800 40821 y(In)293 b(contrast)h(with)f(Xlib,)k(ho)-28 b(we)g(v)-17 b(er)-44 b(,)300 b(the)293 b(boundaries)j(are)d(more)26800 42150 y(rigidly)d(enforced,)295 b(and)c(in)f(f)-11 b(act)290 b(XCB)h(of)-28 b(fers)289 b(only)i(a)f(minimal)26800 43478 y(utilities)381 b(layer)-61 b(.)661 b(Most)382 b(utility)g(functionality)h(is)f(e)-17 b(xpected)386 b(to)26800 44806 y(be)278 b(pro)-17 b(vided)279 b(by)f(separate)g (libraries.)26800 47114 y Ff(4.1)1329 b(X)332 b(Pr)-24 b(otocol)332 b(Description)g(Language)26800 48934 y Fe(The)268 b(C)e(programming)j(language)h(is)265 b(not)j(ideal)f(for)f(the)h(task) g(of)26800 50263 y(describing)348 b(the)f(X)g(protocol.)554 b(P)-17 b(atterns)348 b(emer)-20 b(ge)348 b(in)f(the)g(code)26800 51591 y(that)368 b(cannot)h(be)g(eliminated)f(using)h(C)e(language)k (constructs,)26800 52919 y(and)250 b(logically)f(related)h (de\002nitions)g(are)f(forced)g(to)g(be)g(split)e(be-)26800 54248 y(tween)284 b(header)h(and)f(source)g(\002les.)361 b(These)284 b(issues)e(mak)-11 b(e)284 b(main-)26800 55576 y(tenance)352 b(dif)-28 b(\002cult)351 b(and)g(cause)g(problems)g (for)e(those)i(attempt-)26800 56904 y(ing)328 b(to)g(understand)i(the)e (functioning)i(of)d(an)-17 b(y)329 b(particular)g(pro-)26800 58233 y(tocol)278 b(request.)27907 59604 y(W)-89 b(e)491 b(created)h(a)f(domain-speci\002c)i(language)g(to)e(describe)26800 60932 y(the)313 b(essence)h(of)e(the)h(protocol.)451 b(The)314 b(immediate)f(bene\002ts)h(are)26800 62260 y(these:)574 b(all)392 b(information)h(about)h(a)f(request)g(can)g(be)g (found)h(in)26800 63589 y(one)360 b(con)-44 b(v)-17 b(enient)362 b(b)-22 b(undle,)381 b(and)360 b(the)g(implementation)h(is)d(easy)26800 64917 y(to)346 b(change)i(without)e(changing)i(hundreds)g(of)d (protocol)i(stubs)26800 66246 y(by)353 b(hand.)571 b(Ov)-17 b(er)353 b(the)f(longer)i(term,)370 b(these)353 b(protocol)h(descrip-) 26800 67574 y(tions)263 b(ha)-22 b(v)-17 b(e)265 b(further)e(v)-28 b(alue)264 b(because)i(the)-17 b(y)264 b(may)g(be)g(reused)g(in)e(a) 26800 68902 y(number)340 b(of)f(w)-11 b(ays,)355 b(including)341 b(b)-22 b(ut)339 b(not)g(limited)g(to)g(automati-)26800 70231 y(cally)278 b(producing)27907 72000 y Fc(\017)554 b Fe(Bindings)278 b(for)e(other)i(languages.)p eop end %%Page: 7 7 TeXDict begin 7 6 bop 1107 1107 a Fc(\017)554 b Fe(Protocol)278 b(documentation.)1107 2435 y Fc(\017)554 b Fe(A)339 b(te)-17 b(xt)341 b(representation)g(for)e(use)h(in)g(deb)-22 b(uggers)342 b(lik)-11 b(e)339 b(xs-)2214 3764 y(cope)279 b(and)f(x)-17 b(e)-28 b(v)-72 b(.)1107 5092 y Fc(\017)554 b Fe(Serv)-17 b(er)-22 b(-side)278 b(protocol)g(bindings.)0 6819 y(This)239 b(re-usability)f(has)h(been)h(important)f(in)g(our)g(w) -11 b(ork,)246 b(and)240 b(we)0 8147 y(discuss)277 b(it)f(in)h(more)g (detail)h(in)f(section)g(5.2.2.)0 10361 y Ff(4.2)1329 b(Constructing)331 b(Requests)0 12088 y Fe(In)266 b(the)i(initial)e(de) -28 b(v)-17 b(elopment)270 b(of)d(XCB,)g(we)g(follo)-28 b(wed)268 b(the)f(lead)0 13416 y(of)443 b(Xlib)g(on)h(a)f(number)h(of)f (implementation)i(choices.)843 b(F)-17 b(or)0 14745 y(the)326 b(most)f(part,)337 b(these)326 b(choices)h(were)f(harmless,)338 b(b)-22 b(ut)325 b(one)i(e)-17 b(x-)0 16073 y(ample)357 b(is)e(instructi)-28 b(v)-17 b(e.)580 b(Lik)-11 b(e)356 b(Xlib,)375 b(XCB)357 b(needs)g(to)e(allocate)0 17401 y(blocks)465 b(of)g(memory)g(for)f(request)h(construction.)907 b(Lik)-11 b(e)465 b(the)0 18730 y(GetReq)486 b(f)-11 b(amily)485 b(of)g(Xlib)f(macros,)537 b(we)486 b(initially)e(allocated) 0 20058 y(these)436 b(blocks)h(directly)f(out)h(of)e(the)i(output)g(b) -22 b(uf)-28 b(fer)-61 b(.)820 b(Ev)-17 b(ery-)0 21386 y(one)431 b(in)-44 b(v)-22 b(olv)-17 b(ed)432 b(at)d(that)h(time)f (thought)j(this)c(w)-11 b(as)430 b(a)g(perfectly)0 22715 y(reasonable)494 b(choice,)548 b(if)491 b(for)h(no)g(other)h(reason)g (than)g(that)g(it)0 24043 y(a)-22 b(v)g(oids)276 b(cop)-11 b(ying)277 b(data)f(from)f(some)g(other)h(block)g(into)f(the)h(out-)0 25372 y(put)h(b)-22 b(uf)-28 b(fer)-61 b(.)1107 26700 y(Ev)-17 b(entually)-72 b(,)388 b(ho)-28 b(we)g(v)-17 b(er)-44 b(,)389 b(we)364 b(came)i(to)e(feel)g(that)g(this)f(inter)-22 b(-)0 28028 y(f)-11 b(ace)223 b(w)-11 b(as)223 b(e)-17 b(xcessi)-28 b(v)-17 b(ely)225 b(constraining)f(on)g(the)f (implementation)0 29357 y(of)281 b(the)i(transport)e(layer)-61 b(.)358 b(It)281 b(assumed)h(that)g(memory)h(allocated)0 30685 y(for)426 b(requests)g(did)g(not)h(need)h(to)e(be)h(deallocated,) 466 b(and)427 b(it)e(re-)0 32013 y(quired)403 b(that)f(the)g(output)h (b)-22 b(uf)-28 b(fer)403 b(be)f(protected)i(ag)-6 b(ainst)403 b(con-)0 33342 y(current)219 b(access)h(for)e(the)h(entire)g(duration)g (of)g(request)g(construc-)0 34670 y(tion.)1107 35998 y(W)-89 b(e)329 b(decided)h(instead)e(to)g(allocate)h(request)g(b)-22 b(uf)-28 b(fers)328 b(on)g(the)0 37327 y(stack.)738 b(This)408 b(had)i(one)f(immediate)h(adv)-28 b(antage:)609 b(e)-28 b(v)-17 b(ery)411 b(pro-)0 38655 y(tocol)433 b(stub)g(for)g(XCB)g (requires)g(only)h(one)g(function)g(call)f(to)0 39983 y(deli)-28 b(v)-17 b(er)332 b(a)f(request)g(to)g(the)g(X)f(serv)-17 b(er)-44 b(,)344 b(unifying)332 b(the)f(function-)0 41312 y(ality)293 b(of)g(GetReq,)298 b(Data/)p 9894 41312 333 45 v 399 w(XSend,)g(and)p 15771 41312 V 693 w(XReply)-72 b(.)393 b(That)293 b(func-)0 42640 y(tion)320 b(is)f(called)j (XCBSendRequest,)334 b(and)321 b(it)f(hides)g(the)h(details)0 43968 y(of)350 b(computing)i(the)f(length)g(\002eld)g(of)f(requests,) 368 b(including)352 b(re-)0 45297 y(quests)277 b(lar)-20 b(ger)277 b(than)h(256kB.)1107 46625 y(In)410 b(the)g(end,)444 b(replacing)411 b(the)g(GetReq)g(model)g(with)e(XCB-)0 47954 y(SendRequest)428 b(simpli\002es)c(the)h(interf)-11 b(ace)426 b(between)h(protocol)0 49282 y(stubs)433 b(and)h(the)f (transport)g(layer)h(of)f(XCB)h(and)g(reduces)g(the)0 50610 y(duration)325 b(that)f(locks)g(are)g(held)h(and)g(the)f(number)h (of)f(function)0 51939 y(calls)318 b(in)h(man)-17 b(y)320 b(protocol)g(stubs.)467 b(This)318 b(change)j(e)-28 b(v)-17 b(en)321 b(reduces)0 53267 y(the)275 b(size)f(of)h(the)f(compiled)j (code)f(by)f(a)f(small)g(mar)-20 b(gin.)343 b(A)275 b(sim-)0 54595 y(ilar)249 b(approach)j(w)-11 b(ould)251 b(ha)-22 b(v)-17 b(e)252 b(produced)g(v)-17 b(ery)251 b(good)h(results)c(for)0 55924 y(Xlib)216 b(as)h(well,)228 b(at)216 b(the)h(cost)g(of)f(an)h(e) -17 b(xtra)218 b(function)f(call)g(for)f(man)-17 b(y)0 57252 y(protocol)332 b(stubs,)344 b(which)332 b(in)f(the)h(past)f(w)-11 b(ould)332 b(ha)-22 b(v)-17 b(e)333 b(been)g(con-)0 58580 y(sidered)376 b(prohibiti)-28 b(v)-17 b(e.)641 b(Unfortunately)-72 b(,)402 b(since)376 b(Xlib)g(protocol)0 59909 y(stubs)342 b(are)h(entirely)h(hand-coded)i(and)e(use)f(macros)g(lik)-11 b(e)343 b(Get-)0 61237 y(Req)426 b(that)g(ha)-22 b(v)-17 b(e)427 b(all)e(of)g(the)h(problems)g(of)f(in\003e)-17 b(xible)428 b(imple-)0 62565 y(mentation)285 b(discussed)g(in)e (Section)j(3.1,)f(changing)i(the)d(design)0 63894 y(of)358 b(this)f(part)i(of)f(Xlib)g(at)g(this)f(point)i(w)-11 b(ould)359 b(require)g(massi)-28 b(v)-17 b(e)0 65222 y(ef)-28 b(fort.)0 67616 y Ff(5)1329 b(P)-27 b(orting)332 b(Xlib)g(to)h(XCB)0 69343 y Fe(Gi)-28 b(v)-17 b(en)347 b(the)g(man)-17 b(y)347 b(bene\002ts)g(of)e(XCB,)h(we)g(w)-11 b(ould)347 b(lik)-11 b(e)346 b(to)f(see)0 70672 y(applications)275 b(and)f(libraries)e(use)i(XCB)f(as)g(their)g(lo)-28 b(w-le)g(v)-17 b(el)275 b(in-)0 72000 y(terf)-11 b(ace)326 b(to)g(the)g(X)f(serv)-17 b(er)-61 b(.)490 b(Ho)-28 b(we)g(v)-17 b(er)-44 b(,)340 b(nearly)326 b(e)-28 b(v)-17 b(ery)328 b(X)d(appli-)26800 1107 y(cation)428 b(in)f(e)-17 b(xistence)429 b(uses)d(Xlib,)464 b(whether)429 b(through)f(one)g(of)26800 2435 y(the)373 b(man)-17 b(y)374 b(toolkits)f(or)f(directly)-72 b(.)630 b(Quite)373 b(a)g(fe)-28 b(w)373 b(of)f(these)h(ap-)26800 3764 y(plications,)399 b(and)375 b(some)f(of)g(the)g(toolkits,)398 b(are)374 b(closed-source;)26800 5092 y(in)311 b(some)h(cases)g(the)g (source)g(has)g(been)h(lost.)445 b(As)311 b(for)g(the)h(open)26800 6420 y(source)369 b(X)f(applications,)393 b(there)369 b(are)g(too)f(man)-17 b(y)370 b(to)f(count,)392 b(let)26800 7749 y(alone)278 b(port.)27907 9126 y(Clearly)-72 b(,)548 b(some)493 b(means)i(of)e(transitioning)g(Xlib)h(applica-)26800 10454 y(tions)332 b(to)f(XCB)i(is)e(needed.)510 b(It)331 b(should)i(be)g(fully)e(binary)i(com-)26800 11783 y(patible)448 b(with)f(e)-17 b(xisting)448 b(Xlib-based)g(libraries)e(and)j(applica-) 26800 13111 y(tions)336 b(while)h(allo)-28 b(wing)338 b(XCB)f(to)f(manage)j(the)e(connection)j(to)26800 14440 y(the)396 b(X)g(serv)-17 b(er)-61 b(.)700 b(In)395 b([SM02)q(],)425 b(we)396 b(described)i(such)e(a)g(library)-72 b(,)26800 15768 y(and)278 b(called)g(it)e(XCL:)i(the)f(\223Xlib)h(Compatibility)g (Layer\224.)27907 17145 y(XCL)434 b(w)-11 b(as)434 b(intended)i(to)d (be)i(a)f(drop-in,)473 b(source)435 b(compat-)26800 18474 y(ible)399 b(replacement)i(for)d(Xlib,)429 b(adding)400 b(an)g(e)-17 b(xtra)399 b(interf)-11 b(ace)400 b(to)26800 19802 y(allo)-28 b(w)377 b(access)h(to)e(the)h(underlying)i(XCB)e (connection.)644 b(As)377 b(it)26800 21130 y(turned)343 b(out,)359 b(binary)343 b(compatibility)g(w)-11 b(as)342 b(easy)h(to)f(achie)-28 b(v)-17 b(e)345 b(as)26800 22459 y(well.)504 b(The)332 b(intent)f(w)-11 b(as)330 b(that)h(applications)h (w)-11 b(ould)332 b(be)f(able)h(to)26800 23787 y(tak)-11 b(e)329 b(adv)-28 b(antage)331 b(of)d(some)g(of)g(the)h(bene\002ts)g (of)f(XCB)g(without)26800 25115 y(an)-17 b(y)227 b(modi\002cations,)237 b(and)227 b(then)f(use)g(more)f(features)h(of)f(XCB)h(as)26800 26444 y(portions)j(of)g(the)h(source)g(were)g(ported.)328 b(As)229 b(a)g(practical)h(matter)-44 b(,)26800 27772 y(this)334 b(w)-11 b(ould)335 b(mean)h(that)f(applications)h(and)g (libraries)e(that)g(use)26800 29100 y(Xlib)277 b(may)h(be)f(mix)-17 b(ed)279 b(with)e(those)g(that)h(use)f(XCB.)26800 31422 y Ff(5.1)1329 b(Some)331 b(XCL)h(Issues)26800 33257 y Fe(The)509 b(\002rst)f(attempted)i(implementation)g(strate)-17 b(gy)509 b(for)f(XCL)26800 34585 y(w)-11 b(as)433 b(to)h(start)e(from)h (scratch,)473 b(adding)435 b(support)f(for)f(more)h(of)26800 35914 y(the)305 b(Xlib)f(interf)-11 b(ace)304 b(as)g(applications)i (that)e(actually)i(needed)h(it)26800 37242 y(were)334 b(disco)-17 b(v)g(ered.)517 b(This)333 b(ef)-28 b(fort)334 b(w)-11 b(as)333 b(not)i(e)-17 b(xpected)337 b(to)c(result)26800 38571 y(in)c(a)h(full)e(re-implementation)k(of)d(the)g(Xlib)h(interf) -11 b(ace,)343 b(which)26800 39899 y(is)305 b(much)i(too)f(lar)-20 b(ge)307 b(to)e(create)i(with)f(a)g(reasonable)i(amount)f(of)26800 41227 y(ef)-28 b(fort.)353 b(In)280 b(f)-11 b(act,)281 b(that)g(issue)f(w)-11 b(as)280 b(a)h(sho)-28 b(w-stopper)-61 b(.)355 b(Ev)-17 b(ery)282 b(part)26800 42556 y(of)332 b(the)g(Xlib)g(interf)-11 b(ace)332 b(is)f(probably)j(used)f(by)f(some) h(applica-)26800 43884 y(tion,)416 b(some)-28 b(where,)418 b(and)389 b(unless)f(an)h(XCB-based)h(v)-17 b(ersion)389 b(of)26800 45212 y(Xlib)303 b(supports)h(e)-28 b(v)-17 b(ery)305 b(one)g(of)e(those)h(applications,)311 b(the)304 b(tradi-)26800 46541 y(tional)383 b(Xlib)g(must)g(continue)i(to)e(be)h (maintained)h(in)e(parallel.)26800 47869 y(The)412 b(duplicate)h(ef)-28 b(fort)411 b(inherent)h(in)f(such)h(a)f(plan)h(led)f(to)g(the)26800 49197 y(e)-28 b(v)-17 b(entual)280 b(dismissal)c(of)g(the)i(XCL)g (implementation)h(strate)-17 b(gy)-72 b(.)26800 51519 y Ff(5.2)1329 b(Some)331 b(Lessons)g(fr)-24 b(om)332 b(Curr)-24 b(ent)331 b(W)-100 b(ork)26800 53354 y Fe(W)-89 b(e)325 b(are)g(no)-28 b(w)326 b(on)g(our)f(second)h(try)-72 b(,)336 b(and)326 b(are)f(approaching)j(the)26800 54682 y(problem)284 b(from)f(the)g(opposite)h(side.)361 b(Be)-17 b(ginning)286 b(with)d(the)g(full)26800 56011 y(freedesktop.or)-20 b(g)463 b(implementation)f(of)f(Xlib,)506 b(we)461 b(are)g(strip-)26800 57339 y(ping)220 b(out)f(and)h(re-writing)e(small)h(parts.)323 b(This)219 b(led)g(within)g(a)g(fe)-28 b(w)26800 58667 y(days)434 b(to)g(a)g(prototype)h(XCB-based)g(library)e(that)h (supported)26800 59996 y(the)290 b(full)e(Xlib)i(interf)-11 b(ace,)292 b(as)e(well)f(as)g(ha)-22 b(ving)291 b(limited)e(support) 26800 61324 y(for)269 b(the)h(e)-17 b(xtra)270 b(XCL)h(API.)e(The)h (tradeof)-28 b(f)270 b(is)f(that)h(it)e(is)h(not)h(opti-)26800 62652 y(mal)277 b(in)g(code)i(size,)e(clarity)-72 b(,)276 b(or)h(other)h(measures.)27907 64030 y(In)245 b(the)g(v)-17 b(ersion)246 b(of)f(Xlib)g(at)g(freedesktop.or)-20 b(g,)253 b(the)246 b(directory)26800 65358 y(layout)376 b(of)e(the)h(source)h (is)e(notably)i(dif)-28 b(ferent)375 b(than)g(the)g(tradi-)26800 66687 y(tional)461 b(style.)896 b(De)-28 b(v)-17 b(elopers)464 b(at)d(freedesktop.or)-20 b(g)463 b(ha)-22 b(v)-17 b(e)463 b(con-)26800 68015 y(v)-17 b(erted)499 b(the)g(b)-22 b(uild)498 b(system)g(from)g(Imak)-11 b(e)499 b(to)e(autoconf,)555 b(au-)26800 69343 y(tomak)-11 b(e,)282 b(and)f(libtool,)g(and)g(at)f (the)g(same)g(time)g(adopted)j(a)d(lay-)26800 70672 y(out)223 b(f)-11 b(amiliar)222 b(to)h(an)-17 b(yone)226 b(w)-11 b(orking)224 b(with)f(modern)h(open)h(source)26800 72000 y(softw)-11 b(are.)518 b(Public)336 b(headers)h(may)f(be)g(found)h(in)e Fb(include/)p Fe(,)p eop end %%Page: 8 8 TeXDict begin 8 7 bop 0 1107 a Fe(while)306 b(internal)g(headers)h(and) f(all)g(source)g(code)h(are)f(in)g Fb(src/)p Fe(.)0 2435 y(In)374 b(addition,)399 b(while)375 b(all)e(core)i(X)f(softw)-11 b(are)374 b(has)g(traditionally)0 3764 y(been)384 b(maintained)g (together)g(in)e(a)g(single)h(source)g(tree)g(lar)-20 b(ger)0 5092 y(than)467 b(600MB,)h(at)e(freedesktop.or)-20 b(g)468 b(it)e(has)g(been)i(split)e(into)0 6420 y(man)-17 b(y)513 b(smaller)d(modules)i(and)g(se)-28 b(v)-17 b(eral)512 b(CVS)f(repositories.)0 7749 y(Xlib)277 b(is)f(in)h(the)g Fb(X11)h Fe(module)g(in)f(the)h Fb(xlibs)f Fe(repository)-72 b(.)0 10019 y Ff(5.2.1)1329 b(T)-98 b(ransport)331 b(Lay)-13 b(er)0 11802 y Fe(Our)467 b(current)h(w)-11 b(ork)467 b(on)h(Xlib)e(be)-17 b(g)-6 b(an)470 b(with)d(a)g(focus)h(on)f(the)0 13130 y(transport)277 b(layer)-61 b(.)1107 14484 y(Because)348 b(of)e(the)h(mismatch)f(between)j(the)d(internal)h(archi-)0 15812 y(tectures)333 b(of)g(Xlib)g(and)h(XCB,)f(we)g(pro)-17 b(vide)335 b(a)e(minimal)g(set)g(of)0 17141 y(hooks)222 b(in)f(XCB)h(so)e(that)h(Xlib)g(may)h(mak)-11 b(e)222 b(use)g(of)e(the)i(transport)0 18469 y(layer)280 b(of)g(XCB)g(in)f (place)i(of)f(xtrans.)351 b(\(This)279 b(interf)-11 b(ace)280 b(remains)0 19798 y(a)336 b(w)-11 b(ork)336 b(in)g(progress;)365 b(we)337 b(hope)g(to)f(\002nd)h(a)f(clean)i(design)f(that)0 21126 y(could)254 b(be)g(useful)f(to)g(callers)g(besides)h(Xlib,)j(b) -22 b(ut)254 b(such)f(a)h(design)0 22454 y(is)249 b(not)g(yet)h (apparent.\))336 b(These)251 b(hooks)f(enable)i(XCB)e(to)f(replace)0 23783 y(xtrans)347 b(in)g(a)f(manner)j(transparent)e(to)g(e)-28 b(v)-17 b(erything)350 b(other)d(than)0 25111 y(four)277 b(Xlib)g(transport-layer)g(source)h(\002les.)0 27381 y Ff(5.2.2)1329 b(Pr)-24 b(otocol)333 b(Lay)-13 b(er)0 29164 y Fe(Replacing)219 b(the)d(transport)h(layer)f(with)h(XCB)f(pro) -17 b(vides)218 b(notable)0 30492 y(impro)-17 b(v)g(ements)386 b(in)e(code)h(size)f(and)h(clarity)-72 b(,)410 b(as)384 b(we)g(report)g(in)0 31821 y(section)339 b(6.2.)529 b(Y)-111 b(et)340 b(replacing)g(the)f(protocol)h(layer)f(with)g(XCB)0 33149 y(of)-28 b(fers)273 b(much)h(more)f(signi\002cant)i(g)-6 b(ains,)274 b(at)f(the)h(cost)f(of)g(quite)g(a)0 34478 y(bit)325 b(of)h(additional)h(de)-28 b(v)-17 b(elopment)330 b(ef)-28 b(fort.)489 b(F)-17 b(ortunately)-72 b(,)341 b(a)326 b(sig-)0 35806 y(ni\002cant)295 b(part)f(of)g(this)e(e)-17 b(xtra)295 b(ef)-28 b(fort)293 b(is)g(already)i(done:)379 b(The)294 b(old)0 37134 y(XCL)387 b(w)-11 b(ork)387 b(amounted)i(to)d (little)f(more)i(than)g(glue)g(code)h(be-)0 38463 y(tween)278 b(the)g(core)f(protocol)i(interf)-11 b(aces)277 b(of)g(Xlib)g(and)h (XCB.)1107 39816 y(Man)-17 b(y)257 b(functions)f(in)f(the)g(protocol)i (layer)e(serv)-17 b(e)256 b(e)-17 b(xactly)257 b(the)0 41145 y(same)276 b(purpose)i(as)d(their)h(counterparts)h(in)f(XCB.)g (In)g(XCL,)g(we)0 42473 y(b)-22 b(uilt)401 b(part)h(of)g(the)g (infrastructure)g(needed)i(to)e(automatically)0 43802 y(generate)224 b(the)e(code)h(for)f(these)g(functions.)325 b(That)223 b(infrastructure)0 45130 y(combined)373 b(information)d (from)g(se)-28 b(v)-17 b(eral)371 b(sources)g(to)e(produce)0 46458 y(its)276 b(stubs:)1107 48211 y Fc(\017)554 b Fe(The)278 b(descriptions)g(of)e(the)i(protocol)g(from)f(XCB.)1107 49539 y Fc(\017)554 b Fe(A)397 b(machine-readable)k(description)d(of)f (the)g(Xlib)g(inter)-22 b(-)2214 50867 y(f)-11 b(ace.)1107 52196 y Fc(\017)554 b Fe(A)332 b(little)g(bit)g(of)g(hard-coded)j(kno) -28 b(wledge)336 b(about)e(ho)-28 b(w)334 b(to)2214 53524 y(con)-44 b(v)-17 b(ert)279 b(between)g(data)f(types)f(used)h(by)g(XCB) f(and)h(Xlib)-44 b(.)0 55276 y(This)310 b(illustrates)f(one)j (bene\002t)g(of)e(encoding)k(kno)-28 b(wledge,)322 b(lik)-11 b(e)0 56605 y(the)266 b(structure)f(of)g(the)h(X)g(protocol,)i(in)e(a)f (domain-speci\002c)k(lan-)0 57933 y(guage.)423 b(If)302 b(done)j(well,)k(that)303 b(kno)-28 b(wledge)307 b(is)302 b(reusable)i(in)f(a)g(v)-28 b(a-)0 59261 y(riety)277 b(of)g(projects.)1107 60615 y(Other)291 b(functions)h(require)g (careful)f(inspection)i(when)f(port-)0 61944 y(ing)346 b(them)f(to)h(XCB,)f(and)h(are)g(not)g(e)-17 b(xpected)348 b(to)d(bene\002t)i(from)0 63272 y(automatic)279 b(code)f(generation.)0 65808 y Ff(6)1329 b(Results)0 67591 y Fe(W)-89 b(e)386 b(ha)-22 b(v)-17 b(e)388 b(tested)d(our)h(v)-17 b(ersion)386 b(of)g(Xlib)f(on)h(real)g(w)-11 b(orkloads,)0 68919 y(including:)1107 70672 y Fc(\017)554 b Fe(Mozilla,)312 b(with)305 b(the)g(Xt-based)g (plug-in)h(Adobe)h(Acrobat)2214 72000 y(Reader)-61 b(.)27907 1107 y Fc(\017)554 b Fe(Man)-17 b(y)279 b(standard)f(KDE)f(and)h(Gnome) h(applications.)27907 2435 y Fc(\017)554 b Fe(A)277 b(v)-28 b(ariety)278 b(of)f(windo)-28 b(w)278 b(and)h(display)e(managers.)27907 4220 y(W)-89 b(e)305 b(also)g(ran)g(part)g(of)g(the)g(X)g(T)-77 b(est)304 b(Suite,)312 b(which)306 b(is)e(a)h(com-)26800 5549 y(prehensi)-28 b(v)-17 b(e)407 b(test)c(suite)g(of)h(Xlib)g(and)h (the)f(X)g(serv)-17 b(er)-44 b(,)435 b(created)26800 6877 y(from)277 b(the)g(well-documented)j(speci\002cations)f(for)e (both.)27907 8264 y(The)312 b(three)f(metrics)f(of)h(interest)f(in)g (comparing)j(traditional)26800 9592 y(Xlib)277 b(with)g(an)g(XCB-based) i(Xlib)e(are)27907 11377 y Fc(\017)554 b Fe(Correctness:)330 b(has)251 b(the)f(beha)-22 b(vior)252 b(of)e(the)g(code)i(changed?) 27907 12705 y Fc(\017)554 b Fe(Code)334 b(size:)454 b(do)333 b(an)-17 b(y)334 b(changes)h(in)d(code)i(size)f(justify)e(the)29014 14034 y(ef)-28 b(fort)277 b(required)h(to)f(achie)-28 b(v)-17 b(e)280 b(them?)27907 15362 y Fc(\017)554 b Fe(Performance:)890 b(what)550 b(ef)-28 b(fect)549 b(has)h(the)g(w)-11 b(ork)550 b(had)g(on)29014 16690 y(speed?)26800 19032 y Ff(6.1)1329 b(Corr)-24 b(ectness)26800 20887 y Fe(F)-17 b(or)399 b(our)f(real)h(w)-11 b(orkloads,)429 b(we)399 b(initially)f(found)h (quite)g(a)f(fe)-28 b(w)26800 22216 y(b)-22 b(ugs)307 b(both)h(in)e(our)h(v)-17 b(ersion)308 b(of)e(Xlib)h(and)h(in)e(XCB.)h (Ho)-28 b(we)g(v)-17 b(er)-44 b(,)26800 23544 y(a)294 b(rapid)h(series)f(of)g(small)f(\002x)-17 b(es)296 b(resulted)e(in)g (the)h(ability)f(to)g(run)26800 24872 y(a)330 b(complete)i(desktop)f (en)-44 b(vironment)332 b(using)e(XCB.)g(This)g(soft-)26800 26201 y(w)-11 b(are)426 b(is)e(still)f(in)i(the)h(deb)-22 b(ugging)428 b(phase,)463 b(b)-22 b(ut)426 b(that)f(phase)i(is)26800 27529 y(mostly)277 b(done)i(and)f(proceeding)i(well.)26800 29871 y Ff(6.1.1)1329 b(Obser)-13 b(v)g(ed)330 b(Causes)h(of)i(Bugs) 26800 31726 y Fe(T)-89 b(o)361 b(transform)e(Xlib)g(into)h(a)g(library) g(b)-22 b(uilt)359 b(around)i(XCB,)f(the)26800 33054 y(semantics)319 b(of)g(Xlib)g(must)f(\002rst)g(be)h(well)g(understood,) 331 b(so)319 b(that)26800 34383 y(those)390 b(semantics)h(may)f(be)h (maintained.)683 b(F)-17 b(or)391 b(reasons)f(typi-)26800 35711 y(\002ed)264 b(by)g(the)g(e)-17 b(xamples)265 b(in)e(Section)i (3,)h(that)d(task)g(alone)i(is)d(non-)26800 37039 y(tri)-28 b(vial.)341 b(Most)272 b(b)-22 b(ugs)272 b(in)g(the)h(ne)-28 b(w)273 b(v)-17 b(ersion)273 b(of)f(Xlib)g(result)f(from)26800 38368 y(f)-11 b(ailures)426 b(to)g(understand)j(the)e(intended)i (semantics)e(of)f(func-)26800 39696 y(tions)h(that)g(we)g(ha)-22 b(v)-17 b(e)429 b(replaced.)796 b(Naturally)-72 b(,)465 b(the)427 b(remaining)26800 41024 y(b)-22 b(ugs)383 b(are)g(due)g(to)f (a)h(f)-11 b(ailure)382 b(to)g(correctly)h(re-implement)g(the)26800 42353 y(original)277 b(semantics.)26800 44695 y Ff(6.1.2)1329 b(X)332 b(T)-122 b(est)332 b(Suite)26800 46550 y Fe(The)i(X)e(T)-77 b(est)332 b(Suite)h(reported)h(that)f(there)g(were)g(some)g(defects) 26800 47878 y(in)351 b(error)f(handling.)567 b(Unfortunately)-72 b(,)371 b(when)352 b(tests)e(that)h(f)-11 b(ailed)26800 49206 y(were)282 b(re-run)g(indi)-28 b(vidually)-72 b(,)284 b(the)-17 b(y)283 b(succeeded.)360 b(It)281 b(remains)g(un-)26800 50535 y(clear)323 b(where)g(the)f(b)-22 b(ug)323 b(lies,)333 b(b)-22 b(ut)322 b(f)-11 b(ailure)322 b(to)g(use)g(the)h(test)e(suite) 26800 51863 y(in)330 b(the)h(manner)h(for)e(which)i(it)d(w)-11 b(as)331 b(designed)h(seems)f(lik)-11 b(e)330 b(the)26800 53191 y(most)277 b(probable)i(suspect.)26800 55533 y Ff(6.2)1329 b(Code)331 b(Size)26800 57388 y Fe(F)-17 b(or)296 b(each)i(source)f(\002le,)j(the)c(number)i(of)d(lines)h(of)f (code)j(\(LOC\))26800 58716 y(were)256 b(measured)h(by)f(running)h(the) f(\002le)g(through)h(the)f(C)f(prepro-)26800 60045 y(cessor)-44 b(,)458 b(eliminating)424 b(blank)f(lines)g(and)g(lines)f(from)h(.h)f (\002les,)26800 61373 y(and)431 b(counting)i(the)d(remaining)i(lines.) 803 b(This)430 b(approach)j(w)-11 b(as)26800 62702 y(tak)g(en)403 b(because)h(preprocessor)f(conditionals)h(ha)-22 b(v)-17 b(e)404 b(a)e(signif-)26800 64030 y(icant)358 b(ef)-28 b(fect)358 b(on)g(the)g(number)h(of)e(lines)g(compiled)j(into)d(Xlib,) 26800 65358 y(and)212 b(because)i(it)c(accounts)j(nicely)f(for)e(the)i (inclusion)g(of)f(xtrans.)26800 66687 y(The)537 b(number)g(of)e(bytes)h (of)g(compiled)h(code)h(due)e(to)g(each)26800 68015 y(source)361 b(\002le)f(w)-11 b(as)359 b(computed)k(by)d(e)-17 b(xamining)363 b(object)d(\002les)g(in-)26800 69343 y(tended)321 b(for)d(a)h (statically)g(link)-11 b(ed)320 b(library)-72 b(,)330 b(which)320 b(do)f(not)h(ha)-22 b(v)-17 b(e)26800 70672 y(the)356 b(e)-17 b(xtra)356 b(code)h(generated)h(for)d (position-independent)k(code)26800 72000 y(\(PIC\).)488 b(\(The)h(o)-17 b(v)g(erhead)492 b(of)d(PIC)f(w)-11 b(as)489 b(deemed)i(uninterest-)p eop end %%Page: 9 9 TeXDict begin 9 8 bop 12011 1328 45 1329 v 24597 930 a Fe(Xlib)p 39107 1328 V 15245 w(XCB)5497 2258 y(Component)p 12011 2657 V 2591 w(LOC)3451 b(\045)1328 b Fa(\001)278 b Fe(LOC)2313 b(bytes)3451 b(\045)1329 b Fa(\001)277 b Fe(bytes)p 39107 2657 V 1329 w(LOC)1760 b(bytes)p 4833 2701 41934 45 v 5497 3631 a(locking)p 12011 4029 45 1329 v 4988 w(125)2437 b(0.20)2713 b(-166)2437 b(1109)g(0.14)2283 b(-1348)p 39107 4029 V 3808 w(n/a)5497 4959 y(transport)p 12011 5358 V 3819 w(2100)2437 b(3.35)2160 b(-2261)1883 b(17886)2438 b(2.24)1729 b(-21264)p 39107 5358 V 1331 w(1005)1330 b(11250)5497 6288 y(core)278 b(protocol)p 12011 6686 V 1884 w(6003)2437 b(9.57)2713 b(-560)1883 b(58839)2438 b(7.36)2283 b(-3683)p 39107 6686 V 1330 w(2619)1330 b(19665)5497 7616 y(e)-17 b(xtensions)p 12011 8014 V 13169 w(no)278 b(change)p 39107 8014 V 11956 w(1442)1330 b(15080)p 4833 8059 41934 45 v 5497 8989 a(T)-89 b(otal)p 12011 9387 45 1329 v 4953 w(62702)1331 b(100.00)2161 b(-2987)1330 b(799678)h(100.00)1730 b(-26295)p 39107 9387 V 1331 w(5066)1330 b(45995)17371 11138 y(T)-89 b(able)279 b(2:)343 b(Code)279 b(size)e(for)f(Xlib)h(with)g(XCB)719 13633 y(Component)p 7233 14032 V 2590 w(LOC)3452 b(\045)2312 b(bytes)3452 b(\045)p 55 14076 24690 45 v 719 15006 a(locking)p 7233 15404 45 1329 v 4988 w(291)2437 b(0.44)f(2457)h(0.30)719 16334 y(transport)p 7233 16733 V 3818 w(4361)h(6.64)1883 b(39150)2437 b(4.74)719 17663 y(core)278 b(protocol)p 7233 18061 V 1883 w(6563)2438 b(9.99)1883 b(62522)2437 b(7.57)p 55 18105 24690 45 v 719 19035 a(cut)278 b(b)-22 b(uf)-28 b(fers)p 7233 19434 45 1329 v 4145 w(99)2437 b(0.15)2990 b(599)2436 b(0.07)719 20364 y(gc)p 7233 20762 V 7263 w(370)h(0.56)f(2494)h(0.30)719 21692 y(image)p 7233 22090 V 5049 w(1027)h(1.56)e(9550)h(1.16)719 23020 y(e)-28 b(v)-17 b(ents)p 7233 23419 V 4971 w(1112)2438 b(1.69)e(6762)h(0.82)719 24349 y(icccm)p 7233 24747 V 5111 w(1160)h(1.77)e(8847)h(1.07)719 25677 y(re)-17 b(gion)p 7233 26076 V 4943 w(1290)2438 b(1.96)e(9504)h(1.15)719 27005 y(resource)278 b(db)p 7233 27404 V 2621 w(2554)2438 b(3.89)1883 b(65719)2437 b(7.96)719 28334 y(xom)p 7233 28732 V 5786 w(2891)h(4.40)1883 b(24938)2437 b(3.02)719 29662 y(cms)p 7233 30061 V 5970 w(6478)h(9.86)1883 b(62188)2437 b(7.53)719 30990 y(xkb)p 7233 31389 V 5541 w(10824)1884 b(16.48)1330 b(104430)1885 b(12.64)719 32319 y(xlc)p 7233 32717 V 5848 w(12323)f(18.76)1330 b(312602)1885 b(37.85)719 33647 y(xim)p 7233 34046 V 5478 w(13615)f(20.73)1330 b(106578)1885 b(12.90)p 55 34090 24690 45 v 719 35020 a(Other)p 7233 35418 45 1329 v 5787 w(731)2437 b(1.11)f(7633)h(0.92)719 36348 y(T)-89 b(otal)p 7233 36747 V 4953 w(65689)1331 b(100.00)f(825973)h(100.00)3956 38498 y(T)-89 b(able)279 b(1:)343 b(Code)279 b(size)e(for)f(traditional)i(Xlib)0 41309 y(ing)376 b(for)f(this)f(analysis.\))639 b(These)376 b(object)h(\002les)e(were)h(b)-22 b(uilt)375 b(for)0 42637 y(Linux/x86)322 b(without)d(optimization.)472 b(The)320 b(Unix)g Fb(size)f Fe(com-)0 43966 y(mand)501 b(w)-11 b(as)499 b(run)g(on)h(each)h(of)e(these)g(object)i(\002les,)554 b(and)500 b(the)0 45294 y(v)-28 b(alue)291 b(from)e(the)h(\223dec\224)i (column)f(w)-11 b(as)289 b(tak)-11 b(en,)294 b(which)d(includes)0 46622 y(code,)441 b(string)406 b(literals,)438 b(and)408 b(an)-17 b(y)408 b(other)g(data.)733 b(Finally)-72 b(,)440 b(each)0 47951 y(source/object)390 b(\002le)f(pair)g(w)-11 b(as)388 b(assigned)i(to)e(a)h(component)j(to)0 49279 y(produce)279 b(summary)f(results)e(per)h(component.)1107 50677 y(In)302 b(T)-89 b(able)305 b(1,)k(the)303 b(number)h(of)f(lines) f(of)h(code)h(and)g(compiled)0 52005 y(bytes)386 b(are)f(gi)-28 b(v)-17 b(en)387 b(for)e(traditional)g(Xlib)g(in)h(tw)-11 b(o)385 b(forms:)558 b(ra)-17 b(w)-72 b(,)0 53334 y(and)323 b(as)f(a)g(percentage)j(of)c(the)i(total)e(for)h(that)g(library)-72 b(.)477 b(The)323 b(re-)0 54662 y(vised)315 b(v)-17 b(ersion)315 b(of)f(Xlib,)324 b(together)315 b(with)f(XCB,)h(is)e(co)-17 b(v)g(ered)318 b(in)0 55990 y(T)-89 b(able)359 b(2.)583 b(In)356 b(that)h(table,)377 b(the)358 b(number)g(of)f(lines)f(of)h (code)i(and)0 57319 y(compiled)292 b(bytes)e(are)g(gi)-28 b(v)-17 b(en)292 b(in)e(ra)-17 b(w)290 b(and)h(percentage)h(form)e(as)0 58647 y(before,)369 b(plus)350 b(the)g(change)j(\()p Fa(\001)p Fe(\))c(relati)-28 b(v)-17 b(e)351 b(to)f(traditional)g(Xlib) -44 b(.)0 59975 y(Additionally)-72 b(,)264 b(lines)259 b(of)f(code)j(and)f(compiled)h(bytes)e(are)h(gi)-28 b(v)-17 b(en)0 61304 y(for)372 b(XCB)g(in)h(ra)-17 b(w)372 b(form.)629 b(Xlib)372 b(components)i(unaf)-28 b(fected)375 b(by)0 62632 y(this)276 b(w)-11 b(ork)278 b(were)f(omitted)h(from)e(T)-89 b(able)279 b(2.)1107 64030 y(XCB)265 b(pro)-17 b(vides)267 b(a)e(substantial)g(impro)-17 b(v)g(ement)267 b(in)e(code)i(size)0 65358 y(to)422 b(the)h(transport)g(layer)g(of)f(Xlib,)458 b(and)424 b(in)e(the)h(future)g(is)e(e)-17 b(x-)0 66687 y(pected)344 b(to)f(do)g(the)g(same)f(for)g(the)h(protocol)h(layer)f (and)g(e)-17 b(xten-)0 68015 y(sion)236 b(implementations)i(that)e(ha) -22 b(v)-17 b(e)237 b(been)h(b)-22 b(uilt)236 b(on)g(top)h(of)e(Xlib) -44 b(.)0 69343 y(Y)-111 b(et)452 b(these)g(impro)-17 b(v)g(ements)454 b(comes)f(at)e(relati)-28 b(v)-17 b(ely)453 b(little)e(cost)0 70672 y(in)441 b(human)j(programmer)f(time:)672 b(much)442 b(of)g(the)g(code)h(is)d(au-)0 72000 y(tomatically)c (generated)h(from)e(straightforw)-11 b(ard)435 b(declarati)-28 b(v)-17 b(e)26800 13810 y(descriptions.)472 b(Our)320 b(current)g(w)-11 b(ork)320 b(has)g(added)i(less)d(than)i(700)26800 15139 y(lines)413 b(of)g(ne)-28 b(w)414 b(hand-written)h(code)g(to)e (Xlib,)447 b(while)413 b(making)26800 16467 y(thousands)279 b(of)d(e)-17 b(xisting)278 b(lines)f(irrele)-28 b(v)g(ant.)27907 18305 y(The)463 b(core)f(protocol)h(layer)f(of)g(XCB)g(w)-11 b(as)462 b(automatically)26800 19633 y(generated)305 b(from)d(1,700)j(lines)d(of)h(protocol)g(description.)422 b(The)26800 20962 y(current)303 b(55)f(automatically)i(generated)h (Xlib)c(stubs)h(that)g(dele-)26800 22290 y(g)-6 b(ate)232 b(to)e(XCB)h(a)-22 b(v)-17 b(erage)233 b(7)e(lines)f(each,)241 b(for)230 b(a)h(total)f(of)h(442)g(lines.)26800 23619 y(Generation)279 b(of)e(more)g(stubs)g(is)f(planned.)27907 25457 y(Similar)578 b(bene\002ts)i(a)-17 b(w)-11 b(ait)579 b(client-side)g(e)-17 b(xtension)581 b(imple-)26800 26785 y(mentations.)332 b(Current)242 b(e)-17 b(xtension)243 b(implementations)g(span)f(the)26800 28113 y(protocol)304 b(and)h(utilities)d(layer)h(for)g(the)h(same)f(reasons)h(that)f(the) 26800 29442 y(core)402 b(protocol)h(implementation)h(does.)717 b(As)402 b(a)f(result,)432 b(some)26800 30770 y(portions)524 b(of)f(these)i(e)-17 b(xtensions)525 b(will)e(be)h(good)i(candidates) 26800 32098 y(for)416 b(automatic)i(code)g(generation)g(by)f(the)g (same)g(techniques)26800 33427 y(that)352 b(we)h(ha)-22 b(v)-17 b(e)354 b(used)f(in)f(Xlib,)371 b(and)353 b(other)g(portions)f (will)f(g)-6 b(ain)26800 34755 y(smaller)277 b(bene\002ts)h(through)g (hand-porting.)27907 36593 y(XCB)294 b(itself)d(probably)k(also)e(has)g (opportunities)h(for)f(reduc-)26800 37921 y(tion)308 b(in)f(code)i(size.)434 b(W)-89 b(e)308 b(can)h(e)-17 b(xperiment)309 b(with)f(dif)-28 b(ferent)307 b(im-)26800 39250 y(plementations)444 b(easily)-72 b(,)485 b(because)444 b(nearly)g(80\045)f(of)g(the)g(code)26800 40578 y(in)325 b(XCB)h(is)f(generated)j(automatically)-72 b(.)490 b(By)326 b(happ)-11 b(y)328 b(accident,)26800 41906 y(the)228 b(introduction)g(of)f(XCBSendRequest)232 b(\226)227 b(made)i(to)e (impro)-17 b(v)g(e)26800 43235 y(modularity)298 b(and)f(code)i(clarity) d(\226)h(also)f(reduced)j(code)f(size)f(by)26800 44563 y(a)316 b(small)f(yet)i(noticeable)h(mar)-20 b(gin.)460 b(Ho)-28 b(we)g(v)-17 b(er)-44 b(,)328 b(the)317 b(XCB)f(code)26800 45891 y(base)264 b(is)d(so)i(small)f(already)j(that)e(we)g(ha)-22 b(v)-17 b(e)265 b(put)e(in)g(only)g(cursory)26800 47220 y(ef)-28 b(fort)277 b(to)g(\002nd)h(further)e(sa)-22 b(vings)278 b(there.)26800 50555 y Ff(6.3)1329 b(P)-27 b(erf)-33 b(ormance)26800 53403 y Fe(User)-22 b(-visible)474 b(performance)i(with)f(Xlib)f(is)g(e)-17 b(xpected)478 b(to)c(be)26800 54731 y(lar)-20 b(gely)357 b(unchanged)k(by)d(the)f (transition)f(to)h(XCB.)g(Re)-28 b(writing)26800 56060 y(Xlib)423 b(to)g(use)g(XCB)h(has)f(little)f(ef)-28 b(fect)423 b(on)h(those)g(portions)f(of)26800 57388 y(Xlib)323 b(intended)i(to)f (impro)-17 b(v)g(e)325 b(performance,)337 b(such)324 b(as)f(the)h(v)-28 b(ar)-22 b(-)26800 58716 y(ious)477 b(caches.)945 b(P)-17 b(atterns)478 b(of)f(communication)j(between)f (the)26800 60045 y(client)394 b(and)h(the)f(serv)-17 b(er)395 b(should)g(be)f(identical)h(in)f(most)f(cases)26800 61373 y(to)f(traditional)g(Xlib)-44 b(.)688 b(Xlib)392 b(cannot)i(use)e(the)h(latenc)-17 b(y)394 b(hiding)26800 62702 y(features)464 b(of)g(XCB)h(to)f(re-order)h(requests)f(and)i (still)c(remain)26800 64030 y(within)290 b(the)h(constraints)f(of)h (the)f(documented)k(Xlib)c(interf)-11 b(ace.)26800 65358 y(Some)297 b(slight)f(performance)i(impro)-17 b(v)g(ements)298 b(might)f(be)f(antic-)26800 66687 y(ipated)389 b(due)f(to)f(better)h (cache)i(utilization)e(and)g(reduced)i(lock)26800 68015 y(contention,)295 b(b)-22 b(ut)290 b(this)f(is)g(not)h(e)-17 b(xpected)293 b(to)d(be)g(signi\002cant.)383 b(In-)26800 69343 y(formal)227 b(testing)h(supports)f(the)h(h)-6 b(ypothesis)230 b(that)d(the)h(dif)-28 b(ference)26800 70672 y(between)289 b(traditional)f(Xlib)f(and)h(XCB-based)h(Xlib)e(is) f(not)h(ap-)26800 72000 y(parent)278 b(to)f(end-users.)p eop end %%Page: 10 10 TeXDict begin 10 9 bop 0 1107 a Ff(7)1329 b(Related)332 b(W)-100 b(ork)0 2904 y Fe(At)463 b(freedesktop.or)-20 b(g,)512 b(others)464 b(are)g(currently)h(doing)g(e)-17 b(xperi-)0 4232 y(mental)250 b(w)-11 b(ork)249 b(to)-28 b(w)-11 b(ard)250 b(redesigning)h(the)e(utility)f(layer)i(of)e(Xlib)-44 b(.)0 5561 y(This)292 b(layer)h(is)e(a)h(prime)h(tar)-20 b(get)292 b(for)g(code)h(size)f(impro)-17 b(v)g(ements,)0 6889 y(because)279 b(it)1107 8648 y Fc(\017)554 b Fe(Is)276 b(more)h(than)h(80\045)g(of)f(Xlib)-44 b(.)1107 9976 y Fc(\017)554 b Fe(Is)276 b(more)h(clearly)h(separable)h(into)e (components.)1107 11304 y Fc(\017)554 b Fe(Ov)-17 b(erlaps)278 b(most)f(with)g(common)i(toolkit)e(functionality)-72 b(.)1107 12633 y Fc(\017)554 b Fe(Contains)278 b(the)f(least)g (frequently)h(used)g(code)h(in)e(Xlib)-44 b(.)1107 14392 y(Current)334 b(ef)-28 b(forts)334 b(focus)g(on)h(the)f(xim,)348 b(xom,)h(xlc,)g(cms,)f(and)0 15720 y(xkb)282 b(components.)359 b(T)-89 b(ogether)-44 b(,)283 b(xim/xom/xlc)g(mak)-11 b(e)282 b(up)g(about)0 17048 y(44\045)261 b(of)g(the)f(lines)h(of)f (source)h(in)g(Xlib,)i(and)f(about)g(54\045)f(of)f(the)0 18377 y(compiled)303 b(size.)414 b(The)302 b(cms)f(component)j(contrib) -22 b(utes)301 b(roughly)0 19705 y(10\045,)319 b(and)312 b(xkb)g(contrib)-22 b(utes)311 b(15\045,)320 b(to)310 b(the)h(size)g(of)f(Xlib)-44 b(.)444 b(The)0 21033 y(present)236 b(b)-22 b(uild)236 b(system)g(allo)-28 b(ws)236 b(Xlib)f(to)h(be)g(b) -22 b(uilt)236 b(without)g(each)0 22362 y(of)381 b(these)h(components,) 409 b(producing)384 b(a)d(b)-22 b(uild)381 b(of)g(Xlib)g(that)h(is)0 23690 y(about)278 b(75\045)g(smaller)-61 b(.)1107 25050 y(According)337 b(to)d(Jim)f(Gettys)i([Get03)q(],)348 b(color)334 b(management)0 26379 y(w)-11 b(as)259 b(brok)-11 b(en)261 b(in)e(the)h(XFree86)h([xfr])d(implementation)k(of)d(Xlib)0 27707 y(for)372 b(about)j(half)e(a)g(year)-44 b(,)397 b(and)374 b(nobody)i(noticed.)633 b(Apparently)0 29035 y(that)277 b(code)i(goes)f(unused.)1107 30396 y(Unfortunately)-72 b(,)236 b(some)225 b(applications)h(and)f(libraries)e(that)h(are)0 31724 y(in)273 b(common)j(use)d(do)h(depend)i(on)e(some)g(of)f(this)g (functionality)-72 b(.)0 33052 y(F)-17 b(or)244 b(instance,)250 b(Gdk)244 b(2.0)g(uses)f(the)g(xlc)g(component)j(to)d(set)g(win-)0 34381 y(do)-28 b(w)334 b(titles.)507 b(F)-17 b(or)333 b(this)f(reason,)347 b(entirely)332 b(remo)-17 b(ving)335 b(that)d(code)0 35709 y(from)225 b(Xlib)h(is)f(not)h(currently)h (feasible.)326 b(F)-17 b(ortunately)-72 b(,)238 b(the)226 b(char)-22 b(-)0 37037 y(acter)300 b(set)e(translation)i(tables)f(that) g(occup)-11 b(y)302 b(a)d(signi\002cant)i(por)-22 b(-)0 38366 y(tion)355 b(of)h(xlc)f(are)h(no)g(longer)g(necessary)-72 b(,)376 b(as)355 b(more)h(general)h(li-)0 39694 y(braries)253 b(such)g(as)g(GNU)g(libicon)-44 b(v)254 b(pro)-17 b(vide)254 b(the)g(same)f(services.)0 41022 y(One)344 b(project)g(presently)h(a) -17 b(w)-11 b(aiting)344 b(de)-28 b(v)-17 b(elopers)347 b(is)342 b(to)h(remo)-17 b(v)g(e)0 42351 y(these)355 b(tables)g(from)f(Xlib)g(and)i(replace)g(them)f(with)f(whate)-28 b(v)-17 b(er)0 43679 y(implementation)279 b(of)e(icon)-44 b(v)278 b(is)e(a)-22 b(v)-28 b(ailable.)0 46229 y Ff(8)1329 b(Softwar)-24 b(e)332 b(Engineering)f(Obser)-13 b(v)g(ations)0 48026 y Fe(A)315 b(number)i(of)e(observ)-28 b(ations)317 b(may)f(be)g(made)h(about)g(softw)-11 b(are)0 49354 y(engineering)454 b(in)e(general,)497 b(illustrated)451 b(by)i(the)f(e)-17 b(xamples)454 b(of)0 50683 y(Xlib)330 b(and)i(XCB.)e(These)i(observ)-28 b(ations)332 b(ha)-22 b(v)-17 b(e)332 b(been)g(made)f(of-)0 52011 y(ten)358 b(in)g(code)i(style)e(guides)g(and)i(softw)-11 b(are)357 b(engineering)k(pub-)0 53339 y(lications,)380 b(yet)360 b(code)h(continues)g(to)f(be)g(written)f(that)h(e)-17 b(xhibits)0 54668 y(these)278 b(problems.)1107 56028 y(Remember)e(that)f(softw)-11 b(are)274 b(is)g(written)g(for)g(tw)-11 b(o)275 b(audiences.)0 57356 y(While)305 b(a)g(computer)i(must)d(be)i (able)g(to)f(e)-17 b(x)g(ecute)308 b(the)d(softw)-11 b(are,)0 58685 y(it)343 b(is)h(also)g(necessary)i(that)e(humans)i(be)f (able)g(to)f(read,)362 b(under)-22 b(-)0 60013 y(stand,)254 b(and)249 b(modify)g(that)f(softw)-11 b(are.)333 b(Much)250 b(of)d(softw)-11 b(are)248 b(engi-)0 61341 y(neering)339 b(comes)g(do)-28 b(wn)339 b(to)f(di)-28 b(viding)339 b(softw)-11 b(are)338 b(into)g(manage-)0 62670 y(able)247 b(chunks,)253 b(pieces)247 b(that)f(a)g(human)i(can)f(k)-11 b(eep)247 b(entirely)f(in)g(his)0 63998 y(or)277 b(her)g(head)i(long)f (enough)h(to)e(w)-11 b(ork)278 b(with)f(them.)1107 65358 y(Functions)250 b(should)g(be)f(k)-11 b(ept)250 b(simple,)k(possibly) 249 b(by)g(di)-28 b(viding)0 66687 y(complicated)367 b(tasks)e(into)g(se)-28 b(v)-17 b(eral)367 b(simple)e(functions.)607 b(Func-)0 68015 y(tions)580 b(that)h(interact)g(strongly)f(should)i(be) f(k)-11 b(ept)581 b(close)g(to-)0 69343 y(gether)-44 b(,)236 b(preferably)227 b(in)e(a)h(single)g(source)g(\002le.)326 b(Interactions)227 b(can)0 70672 y(and)402 b(should)f(be)g(weak)-11 b(ened)404 b(where)e(possible)e(through)i(care-)0 72000 y(ful)380 b(modular)i(design,)407 b(gi)-28 b(ving)382 b(callers)e(fe)-28 b(w)381 b(opportunities)h(to)26800 1107 y(mak)-11 b(e)330 b(mistak)-11 b(es.)498 b(All)328 b(of)h(these)g(principles)h(are)f(violated,)342 b(for)26800 2435 y(e)-17 b(xample,)370 b(by)350 b(the)f(design)i(of)e(GetReq,)369 b(Data,)e(and)p 47619 2435 333 45 v 749 w(XReply)-72 b(,)26800 3764 y(as)277 b(e)-17 b(xplained)280 b(in)d(Section)h(3.3.2.) 27907 5200 y(When)254 b(multiple)f(functions)g(ha)-22 b(v)-17 b(e)255 b(similar)d(code,)258 b(a)253 b(ne)-28 b(w)254 b(pa-)26800 6528 y(rameterized)304 b(function)g(should)g(be)f (created)i(that)d(is)g(the)h(union)26800 7856 y(of)329 b(the)h(similar)e(blocks.)502 b(F)-17 b(or)330 b(e)-17 b(xample,)345 b(Xlib)329 b(protocol)i(stubs)26800 9185 y(al)-11 b(w)g(ays)356 b(call)p 32228 9185 V 755 w(XSend/Data,)p 38689 9185 V 776 w(XReply)-72 b(,)376 b(both,)g(or)356 b(neither)g(af-)26800 10513 y(ter)315 b(GetReq.)459 b(A)316 b(single)f(parameterized)j(function,)326 b(similar)314 b(to)26800 11841 y(XCBSendRequest,)470 b(w)-11 b(ould)430 b(ha)-22 b(v)-17 b(e)431 b(been)f(better;)505 b(some)429 b(rea-)26800 13170 y(sons)277 b(were)g(gi)-28 b(v)-17 b(en)280 b(in)c(Section)j(4.2.)27907 14605 y(Functionality)428 b(lik)-11 b(e)427 b(the)g(macros)f(in)h(the)f(C)h(preprocessor)26800 15934 y(should)410 b(be)g(a)-22 b(v)g(oided)411 b(in)e(modern)h(code.) 741 b(Some)411 b(reasons)e(for)26800 17262 y(this)384 b(were)i(gi)-28 b(v)-17 b(en)388 b(in)d(Section)i(3.1.)668 b(Ev)-17 b(en)387 b(automatic)g(gener)-22 b(-)26800 18591 y(ation)403 b(of)f(code,)435 b(a)403 b(technique)i(with)d (signi\002cant)h(bene\002ts)h(in-)26800 19919 y(cluding)415 b(those)f(described)h(in)e(Sections)i(4.1)f(and)g(5.2.2,)448 b(has)26800 21247 y(hazards)305 b(of)e(this)g(sort)g(and)i(should)f(be) g(used)h(with)e(the)h(caution)26800 22576 y(that)285 b(the)f(generated)j(code)g(should)e(not)g(ha)-22 b(v)-17 b(e)286 b(redundant)h(simi-)26800 23904 y(lar)297 b(blocks)h(if)e(the)i (underlying)h(language)h(pro)-17 b(vides)299 b(a)e(reason-)26800 25232 y(able)278 b(mechanism)h(for)d(abstracting)i(them.)27907 26668 y(An)-17 b(y)474 b(time)f(a)g(signi\002cant)h(chunk)h(of)d(softw) -11 b(are)473 b(performs)26800 27996 y(an)373 b(independent)k(task,)396 b(that)373 b(chunk)h(should)g(be)f(an)h(indepen-)26800 29325 y(dent)451 b(module,)495 b(perhaps)452 b(encapsulated)i(in)c(its) f(o)-28 b(wn)452 b(library)-72 b(.)26800 30653 y(As)448 b(libraries)f(lik)-11 b(e)449 b(XCB)g(and)g(libicon)-44 b(v)449 b(demonstrate,)493 b(Xlib)26800 31982 y(contains)510 b(man)-17 b(y)510 b(components)h(that)e(w)-11 b(ould)509 b(ha)-22 b(v)-17 b(e)511 b(v)-28 b(alue)510 b(as)26800 33310 y(stand-alone)540 b(libraries.)1127 b(Each)540 b(module)g(and)g(library)e(in)g(a)26800 34638 y(system)372 b(should)h(be)g(focused)h(on)e(a)h(single)f(reasonably-sized)26800 35967 y(task;)243 b(ha)-22 b(v)-17 b(e)228 b(a)e(minimal,)237 b(orthogonal,)h(and)227 b(well-de\002ned)h(inter)-22 b(-)26800 37295 y(f)-11 b(ace;)243 b(and)226 b(be)g(implemented)i(in)d (a)h(readable)h(and)g(maintainable)26800 38623 y(manner)-61 b(.)26800 41339 y Ff(9)1329 b(The)331 b(Futur)-24 b(e)331 b(of)h(Xlib)26800 43303 y Fe(Gi)-28 b(v)-17 b(en)309 b(the)g(bene\002ts)g(of)e(XCB,)h(ne)-28 b(w)309 b(X)e(toolkits)h(and)h (applica-)26800 44631 y(tions)317 b(are)g(anticipated)i(that)e(will)f (use)h(pure)g(XCB)h(rather)f(than)26800 45959 y(Xlib)-44 b(.)708 b(Le)-17 b(g)-6 b(ac)-17 b(y)403 b(Xlib)c(code)h(is)e(e)-17 b(xpected)402 b(to)d(slo)-28 b(wly)399 b(migrate)26800 47288 y(to)426 b(mix)-17 b(ed)428 b(Xlib/XCB)f(and)h(e)-28 b(v)-17 b(entually)429 b(pure)e(XCB.)g(De)-28 b(v)-17 b(el-)26800 48616 y(opment)420 b(of)f(Xlib)g(is)f(e)-17 b(xpected)422 b(to)d(slo)-28 b(w)-72 b(.)769 b(Ev)-17 b(en)421 b(though)f(the)26800 49944 y(w)-11 b(ork)271 b(described)h(in)e(this)g(paper)i(is)d(not)i(ready)h(for)e(widespread) 26800 51273 y(release)264 b(as)g(of)f(this)g(writing,)j(there)e(are)g (already)h(signs)f(that)f(de-)26800 52601 y(v)-17 b(elopers)278 b(are,)g(indeed,)g(mo)-17 b(ving)279 b(their)e(focus)g(to)g(XCB.)27907 54037 y(Xlib)431 b(de)-28 b(v)-17 b(elopment)435 b(will)430 b(certainly)j(not)e(cease)i(for)d(some)26800 55365 y(time)259 b(yet,)j(and)e(is)e(e)-17 b(xpected)262 b(to)d(focus)g(on)h(reducing)g (the)g(instal-)26800 56694 y(lation)266 b(footprint)f(of)g(Xlib)-44 b(.)339 b(A)265 b(small)g(number)i(of)e(ne)-28 b(w)266 b(features)26800 58022 y(continue)223 b(to)d(be)i(planned,)234 b(ho)-28 b(we)g(v)-17 b(er)-61 b(.)327 b(Since)222 b(the)f(reference)h (im-)26800 59350 y(plementation)362 b(of)e(Xlib)f(is)g(open)j(source,) 381 b(Xlib)360 b(is)e(sure)i(to)g(be)26800 60679 y(supported)279 b(and)f(maintained)h(until)e(it)f(has)h(no)h(more)f(users.)26800 63395 y Ff(10)1329 b(Conclusion)26800 65358 y Fe(W)-89 b(e)360 b(ha)-22 b(v)-17 b(e)361 b(identi\002ed)g(some)f(signi\002cant) g(areas)g(of)f(inef)-28 b(\002cient)26800 66687 y(and)382 b(confusing)h(design)g(and)f(implementation)h(in)f(Xlib,)407 b(and)26800 68015 y(presented)390 b(our)f(ef)-28 b(forts)388 b(to)g(repair)h(this)f(core)h(element)h(of)e(the)26800 69343 y(X)371 b(W)-44 b(indo)-28 b(w)373 b(System.)626 b(Combined)374 b(with)d(the)h(ef)-28 b(forts)371 b(of)g(oth-)26800 70672 y(ers,)248 b(we)243 b(belie)-28 b(v)-17 b(e)245 b(that)d(the)h(installation)f(footprint)h(of)f(Xlib)g(may)26800 72000 y(be)303 b(reduced)h(signi\002cantly)-72 b(,)310 b(while)303 b(the)f(clarity)-72 b(,)309 b(maintainabil-)p eop end %%Page: 11 11 TeXDict begin 11 10 bop 0 1107 a Fe(ity)-72 b(,)273 b(and)g(e)-17 b(xtensibility)274 b(of)e(the)h(X)f(client)h(library)f(stack)h(are)f (im-)0 2435 y(pro)-17 b(v)g(ed)280 b(tremendously)-72 b(.)1107 3776 y(Guiding)254 b(our)f(ef)-28 b(forts)252 b(are)h(current)g(best)g(practices)g(from)f(the)0 5104 y(softw)-11 b(are)295 b(engineering)k(and)d(formal)g(methods)h (communities,)0 6432 y(and)277 b(our)f(w)-11 b(ork)276 b(may)g(be)h(tak)-11 b(en)277 b(as)e(a)h(case)g(study)g(in)g(the)g (practi-)0 7761 y(cal)301 b(v)-28 b(alue)303 b(of)e(these)g (techniques.)417 b(F)-17 b(or)302 b(that)f(matter)-44 b(,)306 b(this)300 b(w)-11 b(ork)0 9089 y(w)g(ould)326 b(be)g(completely)i(infeasible)d(if)g(the)h(reference)g(X)f(W)-44 b(in-)0 10418 y(do)-28 b(w)319 b(System)f(implementation)h(were)f(not)g (open)h(source,)329 b(and)0 11746 y(illustrates)309 b(one)i(of)e(the)i (man)-17 b(y)312 b(bene\002ts)f(of)f(an)g(open)i(de)-28 b(v)-17 b(elop-)0 13074 y(ment)278 b(model.)1107 14415 y(This)368 b(is)g(an)h(ongoing)i(process.)618 b(The)370 b(X)e(W)-44 b(indo)-28 b(w)370 b(System)0 15743 y(has)255 b(sho)-28 b(wn)255 b(an)g(unlimited)g(capacity)i(for)c(e)-17 b(xtension)257 b(and)e(inno-)0 17071 y(v)-28 b(ation.)667 b(The)386 b(general)g(techniques)h(of)d(careful)i(modular)f(de-)0 18400 y(sign,)326 b(domain)319 b(speci\002c)f(languages,)329 b(and)317 b(others)g(are)g(broadly)0 19728 y(applicable.)487 b(W)-89 b(e)325 b(hope)g(we)g(ha)-22 b(v)-17 b(e)326 b(pro)-17 b(v)-22 b(ok)-11 b(ed)327 b(interest)d(in)g(soft-)0 21056 y(w)-11 b(are)335 b(engineering)j(in)d(general,)351 b(and)336 b(de)-28 b(v)-17 b(elopment)339 b(of)334 b(the)i(X)0 22385 y(W)-44 b(indo)-28 b(w)278 b(System)g(in)f(particular)-61 b(.)0 24891 y Ff(A)-133 b(v)-13 b(ailability)0 26645 y Fe(XCB)442 b(and)h(the)g(v)-17 b(ersion)442 b(of)g(Xlib)g(described)h (here)g(are)f(both)0 27973 y(hosted)627 b(by)f(freedesktop.or)-20 b(g.)1392 b(XCB)626 b(is)f(a)-22 b(v)-28 b(ailable)628 b(from)0 29301 y Fb(http://xcb.freedesktop.org)p Fe(.)805 b(Xlib)429 b(source)i(is)0 30630 y(at)478 b Fb (http://freedesktop.org/Software/X11)p Fe(,)0 31958 y(and)537 b(can)f(be)g(compiled)i(to)d(use)h(XCB)f(by)i(specifying)f(the)0 33286 y Fb(--with-xcb)279 b Fe(con\002gure)g(option.)0 35793 y Ff(Ackno)-13 b(wledgements)0 37546 y Fe(This)363 b(paper)i(w)-11 b(as)363 b(shepherded)j(by)e(Carl)f(W)-89 b(orth,)385 b(and)365 b(his)d(pa-)0 38874 y(tience)278 b(and)g(insight)f(ha)-22 b(v)-17 b(e)279 b(been)g(greatly)f (appreciated.)1107 40215 y(Man)-17 b(y)266 b(thanks)f(to)f(K)-28 b(eith)265 b(P)-17 b(ackard)266 b(for)e(helping)i(us)e(compre-)0 41543 y(hend)413 b(Xlib)e(and)h(the)g(X)f(W)-44 b(indo)-28 b(w)413 b(System.)746 b(W)-89 b(e)412 b(w)-11 b(ould)412 b(not)0 42872 y(ha)-22 b(v)-17 b(e)279 b(gotten)f(this)e(f)-11 b(ar)277 b(without)g(him.)1107 44212 y(Contrib)-22 b(utions)243 b(by)h(Professor)e(Bart)g(Masse)-17 b(y)244 b(ha)-22 b(v)-17 b(e)244 b(been)g(in-)0 45540 y(v)-28 b(aluable)354 b(as)d(well,)370 b(pro)-17 b(viding)354 b(much-needed)h(guidance)g(and) 0 46869 y(insight)414 b(for)f(the)h(design)h(and)f(implementation)i(of) e(XCB,)g(as)0 48197 y(well)260 b(as)g(mentoring)i(while)e(writing)g (reports)g(on)h(our)g(progress.)1107 49538 y(Thanks)216 b(also)e(go)g(to)g(Jim)g(Gettys)g(for)f(his)h(continued)i(support)0 50866 y(of)277 b(our)g(ef)-28 b(forts.)1107 52206 y(Finally)-72 b(,)428 b(Sheridan)400 b(Mahone)-17 b(y)401 b(and)d(Mick)g(Thomure)i (pro-)0 53535 y(vided)278 b(v)-28 b(aluable)280 b(feedback)g(on)d (drafts)f(of)h(this)g(paper)-61 b(.)0 56041 y Ff(Refer)-24 b(ences)0 57782 y Fe([AS90])1908 b(P)-17 b(aul)590 b(J.)d(Asente)i(and) g(Ralph)h(R.)e(Swick.)1396 b Fd(X)5166 59111 y(W)-61 b(indow)321 b(System)g(T)-102 b(oolkit:)429 b(The)320 b(Complete)i(Pr)-50 b(o-)5166 60439 y(gr)-17 b(ammer')-44 b(s)305 b(Guide)h(and)g(Speci\002cation)p Fe(.)491 b(Digital)5166 61767 y(Press,)276 b(Bedford,)i(MA,)f(1990.)0 63563 y([Ber95])1724 b(Da)-22 b(vid)297 b(T)-82 b(.)296 b(Berry)-72 b(.)458 b(Inte)-17 b(grating)298 b(a)d(color)i(manage-)5166 64891 y(ment)353 b(system)e(with)h(a)g(Unix)g(and)h(X11)g(en)-44 b(viron-)5166 66220 y(ment.)501 b Fd(The)310 b(X)f(Resour)-41 b(ce)p Fe(,)319 b(13\(1\):179\226180,)h(Jan-)5166 67548 y(uary)278 b(1995.)0 69343 y([Get03])1724 b(Jim)945 b(Gettys.)2539 b(Size)946 b(of)g(Xlib)-44 b(...,)1111 b(Octo-)5166 70672 y(ber)1148 b(2003.)3186 b(W)-89 b(eb)1149 b(Document.)g(URL)5166 72000 y Fb(http://pdx.freedesktop.org/)31966 1107 y (pipermail/xlibs/2003-)55 b(October/)31966 2435 y(000001.html)1765 b Fe(accessed)g(April)e(8,)31966 3764 y(2004)556 b(04:30)278 b(UTC.)26800 5535 y([MS01])1723 b(Bart)309 b(Masse)-17 b(y)311 b(and)f(Jame)-17 b(y)311 b(Sharp.)504 b(XCB:)310 b(An)g(X)31966 6863 y(protocol)418 b(C)e(binding.)847 b(In)417 b Fd(Pr)-50 b(oceedings)419 b(of)d(the)31966 8192 y(2001)454 b(XF)-61 b(r)-41 b(ee86)453 b(T)-102 b(ec)-17 b(hnical)455 b(Confer)-41 b(ence)p Fe(,)498 b(Oak-)31966 9520 y(land,)278 b(CA,)f(No)-17 b(v)g(ember)280 b(2001.)e(USENIX.)26800 11291 y([PG03])1908 b(K)-28 b(eith)580 b(P)-17 b(ackard)581 b(and)g(Jim)d(Gettys.)1365 b(X)578 b(W)-44 b(in-)31966 12619 y(do)-28 b(w)739 b(System)g(netw)-11 b(ork)739 b(performance.)1876 b(In)31966 13948 y Fd(FREENIX)300 b(T)-61 b(r)-17 b(ac)-22 b(k,)306 b(2003)300 b(Usenix)f(Annual)i(T)-102 b(ec)-17 b(h-)31966 15276 y(nical)523 b(Confer)-41 b(ence)p Fe(,)587 b(San)523 b(Antonio,)585 b(TX,)523 b(June)31966 16604 y(2003.)279 b(USENIX.)26800 18376 y([Ros])2706 b(Da)-22 b(vid)349 b(Rosenthal.)629 b(Inter)-22 b(-Client)347 b(Communica-)31966 19704 y(tion)277 b(Con)-44 b(v)-17 b(entions)280 b(Manual.)400 b(In)277 b([SGFR92)r(].)26800 21475 y([SG86])1908 b(Robert)473 b(W)-102 b(.)471 b(Schei\003er)j(and)f (Jim)e(Gettys.)1022 b(The)31966 22803 y(X)407 b(W)-44 b(indo)-28 b(w)409 b(System.)816 b Fd(A)-33 b(CM)407 b(T)-61 b(r)-17 b(ansactions)409 b(on)31966 24132 y(Gr)-17 b(aphics)p Fe(,)278 b(5\(2\):79\226109,)h(April)e(1986.)26800 25903 y([SGFR92])555 b(Robert)710 b(W)-102 b(.)709 b(Schei\003er)-44 b(,)819 b(James)709 b(Gettys,)817 b(Jim)31966 27231 y(Flo)-28 b(wers,)459 b(and)424 b(Da)-22 b(vid)423 b(Rosenthal.)865 b Fd(X)422 b(W)-61 b(indow)31966 28560 y(System:)486 b(The)350 b(Complete)g(Refer)-41 b(ence)351 b(to)d(Xlib,)366 b(X)31966 29888 y(Pr)-50 b(otocol,)258 b(ICCCM,)253 b(and)g(XLFD)p Fe(.)346 b(Digital)251 b(Press,)31966 31216 y(third)277 b(edition,)g(1992.)26800 32987 y([SGN88])1109 b(Robert)317 b(W)-102 b(.)317 b(Schei\003er)-44 b(,)327 b(James)317 b(Gettys,)326 b(and)318 b(Ron)31966 34316 y(Ne)-28 b(wman.)432 b Fd(X)286 b(W)-61 b(indow)288 b(System:)363 b(C)287 b(Libr)-17 b(ary)288 b(and)31966 35644 y(Pr)-50 b(otocol)278 b(Refer)-41 b(ence)p Fe(.)401 b(Digital)277 b(Press,)f(1988.)26800 37415 y([SM02])1723 b(Jame)-17 b(y)714 b(Sharp)g(and)g(Bart)f(Masse)-17 b(y)-72 b(.)1794 b(XCL:)31966 38744 y(An)479 b(Xlib)e(compatibility)j (layer)e(for)g(XCB.)1042 b(In)31966 40072 y Fd(FREENIX)300 b(T)-61 b(r)-17 b(ac)-22 b(k,)306 b(2002)300 b(Usenix)f(Annual)i(T)-102 b(ec)-17 b(h-)31966 41400 y(nical)250 b(Confer)-41 b(ence)p Fe(,)257 b(Montere)-17 b(y)-72 b(,)256 b(CA,)249 b(June)h(2002.)31966 42729 y(USENIX.)26800 44500 y([xfr])3137 b(The)732 b(XFree86)i (project.)1852 b(W)-89 b(eb)732 b(document.)31966 45828 y(URL)d Fb(http://www.xfree86.org)j Fe(ac-)31966 47156 y(cessed)278 b(April)e(8,)h(2004)556 b(04:30)278 b(UTC.)p eop end %%Trailer userdict /end-hook known{end-hook}if %%EOF