Version 2 for Windows,
Windows NT, and
Windows 95
Version 2 of the eXcursion product i s a complete rewrite of the successfu l Windows-based X server software package. Based on release 6 of the X Window System version 1 1 protocol, the new product runs on Microsoft's Wi ndows, Windows NT, and Windows 95 operating sys tems. The X server is one of several components that com pose this package. The other com po nents are X Image Extension, the control panel (which constitutes the user interface for product config uration), the error logger, the appl ication lau ncher, and the setup program. An interprocess communication facility enables the eXcursion components to communicate in a un iform fash ion under all three operating systems. A unique server design using object-oriented prog ram ming techn iques integrates the X graphics con text with the Windows device context i nto a combined state management faci l ity. The result ing implementation maxim ized graph ics perfor mance while conserving Windows resources, which are in l i m ited supply under the 1 6-bit version of the Windows operating system. The control panel was coded completely in the C++ programming language, thus making full use of the Microsoft Foundation Class li brary to m i n i m ize development time and to ensure consistency with the Windows user i nterface parad igm.
32 Digit� I Tec hnic:1l j ournal Vol . S No. I 1996
I
Jolm T. Freitas James G. Peterson Scot A. Aurenz Charles P. Gu..ldenschuh Paul J. RanauroDigital developed the eXcursion family of d isplay server products to provide interopcra bi lity between desktop person:� I computers (res) running the Microsoft Wi ndows operating svstcm and remote hosts running the X \iVindow System operating system u nder the UNIX or Open VMS oper:ning svstems. The fi rst version of the eXcursion X server was a 1 6-bit application written specifically tor Microsoft WindO\vs versions 3 . 0 :�nd 3 . 1 . As the pop u l arity of W i ndows increased :tnd desktop systems were connected to cor porate networks, the market tor X intcropcrability grew q u ickly. The 1 6 - bi t eXcursion code, much of which h:�d been ported from 3 2 - bi t U N I X cod e , was :�gain ported-this time ro Microsoft's Win32 appli cation progr:unrning interface (API ) to support the Windows NT operating system . When release 6 of the X Window System version l l protocol ( X l l R6) appeared and J new sample i mplemcnt:-ttion source kit bcome :�v;�ilable ti·om the X Consortium, the eXcursion t�.:am decided that it was ri me for a complete rewrite of the eXcu rsion sothva rc. M icrosoft had established the Win32 A P I as J u niform cod ing inter face tor all its Windows- based oper:�ting systems. Since developrncllt tools such as 32-bit compilers and debuggers of sufficient quality and robustness had become :w;�ibble, it was now possible to i mplement a high-qual ity, 32-bir product. Th is prod uct would sup port the entire range of Windows-based platforms, from note book PCs running the Wind ows operating system to high-end Alph;� systems running the \rVind O\vs NT operating svstem.
Terminology
This paper incorporates certain convemions to clarify the distinction between the two window systems u n der consideration . X window rekrs to rbe collection of data structures, concepts, and oper:�tions that con stiture a \Vind ow, as defined in the X vVindow System envi ron ment. \\lin32 tcindut.t' refers to :1 windO\\. JS detined in tvlicrosoft's Win32 API .
\Vhe n referring to a window system ::�s opposed to a particubr wi ndow instance, X I'Vindou• System is sometimes abbreviated to X. \l(linduws denotes the Microsoft Windows operating syste m.
that the word
bitmap
has more th•m one meaning. In the X environment, a bitmap is a two dime nsional <1rray of bits, and aj>ixnwj>
is <1 twodi mensional array of pixels, where each pixel may consist of one or more bits. Under the Win32
API,
the term bitmap is used exclusively; that is, no distinction is made between an array of depth I and •m array of (kpth n . ln this paper, the term pix map is used i nits general sense to refer to X pixel arrays, and the term bitmap rdcrs to the Win32 concept.
Another common point of conf"l1sion when dis cussing the X Window System environment is the use of the terms seruer and
client.
To one familiar with til e and print servers, t h e meani ngs o f these rwo terms i n t h e X environment mav seem t o b e reversed . I n the X em·ironment, the server is a disp l av server, and the clients arc rhc applications reque ring display services. The X server and the X client applications may reside on the S<1mc PC, but rl1e power of the eXcursion soft ware is in its abi lity to bridge the gap between the Windows desktop and the trad itionJI X 1 1 UNIX and Open VMS workstations.eXcursion Version 2 Product Goals
The design of eXcursion version 2 was driven pri marily by the fol lowing prod uct goals:
• Support X Wi ndow System version l l , release
6.
• Support the Microsoh Wi ndows, Windows NT, Jnd Windows
95
operating systems.• Code the single source pool to Microsoh's Win32
API.
• Exceed graphics performance of eXc ursion version 1 as mcasured with the standard benchmark tests X l l pcrf:md X bench.
• Preserve maintainability by using mod u lar coding :111d limi ting changes of the sample implementation ti·om the X Consortiu m .
• J\tLnimi7.e rel iabilirv by performing extended error checking and resource management.
• Correct known protocol contonnance deticiencies in version
1.
For example, in version I , plane mask support wJs implemented for only a few graphics operations. Version 2 would provide pbne mask support tor all graphics operJtions.Components of eXcursion Version 2
In eXcursion version 1 , most of the hmctions provided by the product were combined in ;1 single executable. To conserve resources and to partition the code for easier maintenance, version 2 is divided i nto several scpJratc components or mod u les. Some of these run JS individual processes, and some arc built as dynamic link libraries ( D LLs) .
A
DLL is a shared memoryl i brary modu l e that is linked to the call i ng program at run timc.
eXcursion \'Crsion 2 is partitioned into the tollowing major components:
• X server. The
X
server is the primary component of eXcursion version 2 . TheX
server process is respon si ble tor displaying wind ows and graphics on the Windows desktop Jnd tor sending keyboard, mouse, and other evcnts to the client application . • X I mage Extension . X extensions are additions to the server that support t"lmcrionaliry not addressed by the core X l l protocol, such as displaving shaped (nonrectangular) windows, handling large requests, testing/recording, and imagi ng. Al l extensions except the X lm:1ge Extension ( XJ E ) are i m p l e mented internal l y in t h e X server. Because o f i ts size,X I E
is implemented as J pair of DLLs, one torXIE
version 3 and one tor X I E version5 .
• Control pan e l . As the primary user i ntertJ.ce, the control panel provides the user with access to the many con tiguration setti ngs. It is an i ndependent Win32 application i mplemented using M icrosoti:
Visual C++ and the Microsoft Foundation Class ( MFC) library.
• lnt erprocess com munication library. The inter process comm unication
( ! PC ) l ibrary is an operat
ing system-independcnt l i brary used by cooperating processes or tasks to communicate configuration and status information .• Error l ogger. The error logger is a simple Win32 application that records error and status intorma tion from other eXcursion components in a wi n dow, a file, or the Windows NT event log.
• Application launcher. The appl ication launcher is a Wi n32 appl ication that starts X client applications at the request of the X server or the control panel . The application launcher is i nvisible to the user.
• Registry interface. The registry i nterface is an operJting system-independent i nterface to the eXcursion configu ration proti k . The registry i nter face is implemented as a Win32 DLL.
X Server
The core of the eXcursion product is the X server, a Win32 application that accepts X requests from client applications and transforms them i nto graphics on the Windows desktop. The device-independent portion of the server code is ported from the sample implementa tion provided by thc X Consorti u m . The device dependent portion treats the Wi n32 API as the de,·ice interface through which client requests are material ized on the screen . The eXcursion X server is il lus trated in Figure I .
INTERNAL WINDOW MANAG ER
X REQUESTS X EVENTS
NETWORK DEVICE-INDEPENDENT DEVICE-DEPE NDENT WI N32 FU NCTION CALLS
WI N32 MESSAGES TRANSPORT CODE
Figure 1
The e Xcursion X Scrl'cr
The scrl'cr can operate in o
n
eo�- tii'O modes:
singlcwindoll' mode or
multiwindoll'
mode. I n sin
glcll'i ndow mode, the sen-er creates
one \rVi n 3 2
ll'ind oll', 11·hich n:prcsenrs rbeX
root 11·indm1·. All descembnrll'indows :md
their contents arc d L111·n i mo the roo
tl
l'indow usi
ngWin32 fi. tnction calls. In multi ll'indoll'
mode,
the root windo11· is a l'i rru�1 l ll'indoll'; that is, it is ne1·er drawn on the screen. E:1ch top
-level child of theroot windmv has a corre
s
pon
di
ng\rVi n 3 2
window, which is created when the X wi ndow ism
apped. A l ldcsn:mbnts of a top-leve
l
window arc
d r�1wni
nside the Wi n32 window with Win32 calls. M u l tiwindow mode rhcrebv creates a desktop eill'ironmcm i n
whi
chX
app
li
cations �1re peers of otherWin32 �1pplic:nions.
Single-11 in dow mode is usehi l h:Jr em
ulating a c o m plete II'Orkstation e1wiro
nm
ent in
cluding the ll'ind oll'
nnn:1gcr �md the s
ession or desktopmanJgcr. I n mu lti
windml· mode, drall'ing to :1nd getting inp
ut t-i·om theroot w
i n
dow is restricted b\' rbc X sen·cr to pl"CI'ellt contli
ctswith the M icrosoft \rVi ndo11·s
S\'Stnn
's use of the desktop 1\'i ndow. Despite this n:srricrion , themultiwindo
w mode, when used
with the native ll'in doll'
manager, provides the cleanest imegr:1tion of rhc
X ;md \rVindows environmenr
s.Resource Management and Performance
Both the X and \Vi n 3 2 S\'Stems h.11·c b u i l t - i n notions
of grap hics sr.lte and resource alloution. The sema
n
tics and us:1ge of the concept, ho11 e1·cr, �1 rc q ui
re different in the
t11 0
ll'i ndoll' S\'Stem s .I n
X , gr
aphics St<lte is m:�i
nraincd
i n �1 dar:� struc
tureknoll'n as
a graph ics context ( G C ) . A GC h�1s an inde pe
ndent existence and mav be crcJted,dcs
troved,u
pd
:ned, qu
eri
ed, and cop
ied ar will lw the X Jpplicarion . During graphics operations, �1 c_; c i