Design of eXcursion Version 2 for Windows, Windows NT, and Windows 95. Digital Common Directory Interface, OM, Version 2, Atom, TruCiuster, Integrated Directory Services
Reklama
Reklama
Design of eXcursion
Version
2
for Windows,
Windows
NT,
and
Windows 95
I
Jolm T. Freitas
James G. Peterson
Scot A. Aurenz
Charles P. Gu..ldenschuh
Paul J. Ranauro
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.
Digital 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.
32 Digit� I Tec hnic:1l j ournal
Vol . S No. I 1996
lore 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 a
j>ixnwj>
is
<1 two di 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 n its 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 memory l 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 . The
X
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 tor
XIE
version 3 and one tor X I E version
5 .
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 .
Digiral
T.::chnical )ou rn.1l
Vol. 8
No. 1 1996
33
X REQUESTS
X EVENTS
NETWORK
TRANSPORT
INTERNAL WINDOW MANAG ER
� i
DEVICE-INDEPENDENT DEVICE-DEPE NDENT
CODE
CODE r---
WI N32 FU NCTION CALLS
WI N32 MESSAGES
Figure 1
The e Xcursion X Scrl'cr
The scrl'cr can operate in o n e o�- tii'O modes: s i nglc windoll' mode or multiwindoll' mod e . I n si n glc ll'i ndow mode, the sen-er creates
11·hich n:prcsenrs rbe one \rVi n 3 2 ll'ind oll',
X root 11·indm1·. All desce mbnr ll'indows :md their contents arc d L111·n i mo the ro o t l l 'i ndow us i ng Win32 fi. tnction calls. In multi ll'indoll' mod e
, the root windo11· is a l'irru�1 l ll'i ndoll'; that is, it is ne1·er drawn on the screen. E:1ch to p
- l evel child of the root wind m v has a corre s p o nd i ng \rVi n 3 2 window, which is created when the X wi ndow is dcsn:mbnts of a top
leve m apped . All l window ar c d r�1wn i nside the Wi n32 window with Win32 calls. M u l tiwindow mode r h c re bv creates a deskto p eill'ironmcm i n w hi ch
X app l i c a ti ons �1re peers of other
Win32 �1pplic:nions.
Single-11 in dow mode is usehi l h:Jr e
m
ul ati ng a c o m plete II'Orkstation e1wi ro
nm
ent i
n
cl ud i
n
g
the ll'ind oll' nnn:1gcr �md the
sess
i
on or deskto p
manJgcr. I n
mu lti windml· mode, drall'ing to :1nd getti ng in
p
u t t-i·om the root w c
i n
do
w
is r estricted b\' rbc X sen·cr to pl"CI'ellt
o
n
tl
icts
with the M icrosoft \rVi ndo11·s
S \'Stn
n
's use of the desktop 1\'i ndow. Despi te this n:srricrion , the multiwindo
w mode, when used
with the native ll'in
doll'
manager, provides the c leanest i megr:1tion of rh
c
X ;md \rV i ndows environmen
r
s.
Resource Management and Performance
Both the X and \Vi n32 S\'Ste m s h.11·c bui lt-in notion s of grap hics sr.lte and resource alloution. The se ma
n
tics and us:1ge of th e concept, ho11 e1·cr, �1 rc qu
i
re dif ferent in the
t11 0
ll'i ndoll' S\'Stem s .
I n X , g r ap hics St<lte is m
:� i n r ain cd i n �1 dar:� stru c ture knoll'n as a graph ics context ( GC ) . A GC h�1s an inde p e nd ent existence and mav be crcJted , dcs troved , u pd :ned , q u er i ed , and co p ied ar will lw the X J ppl ica
rion . During grap hics operations, �1 c_; c i s �1ssociarcd with th e
X ''d rawable" ( wi n d ow or pi x m � 1p) being drawn i nto, and infornution ddlnc the o in the GC is used to fu l l y p e r a tion . For exa m p l e , rhe GC may specit\r f(Jregrou nd or background in tcmn�1 tion. colors, line Sf)'ICS,
01"
�( mt
T h e Win 3 2 API has a co
n
c e pt
oiled
�1 dnicc con te\t ( DC ) , l
l
'hich a l so coma
i
ns
state i n tcmnarion bur
ll'hosc
p
u rp ose is more c loselv related ro
p
rm·i
d
i ng dc 1·icc i ndependence. Conscq u
cn
r lv, t\I'O d i fferent tvpes of DC:s are req uirt:d under the Wi n 3 2
API,
de pendi ng on ll'bcthcr rhc graph ics
o
perat
i
o
n
is d r�
1
1
1
ing to a 11· do
i
n
d
m
1· or to :1 bi tmap
.
Furthermore, a II i n
l
l ' DC mal' b e allocned either
p
er m a
n
e
n
t
!
�
or ti·om a cache, depe
n
d ing on its opecred l ifeti
m
e . Am· d r all' ing operation therdcll'c requ ires that both the GC used in the X gL
1
p
hi c
s
request Jnd the DC used
in
the ul ti mate Win 32 call be prop
c
rlv
set up and
synchro nize d . The m;ll1ncr in ll'hich this is done has a signi ti
cant etkcr
on the gr:1ph ics pcr rc m na
n
ce of the server.
.Before an
X gr�1phics o
p
ecnion cJn be started , rhe
GC must be va pre par
l
id �1 r c d . Va lidation is a process
o
f
i n
g the o utput devi
c
e to render the gr�1
p
h
ic
s properlv.
I n
the c1sc of the eXcursion server, the out put dc1 icc
is
:� Win32 DC. For e1u�· graphics com m:�nd , the CC must be checked for cha
n
ge s :llld the a ppropri ate Win32 objects .md stare 1·alues must be se lected into the DC This process can be
,
.
c
r
,
· time co
n
sumi
n
g . The kc\' ro max im izing pertormance
is
to recogn ize th:�r most
o
pc Lnions :trc repetitive . A tl-pical stream of X req
ue
sts tends ro contain 111:111\' co
m
m
�mds d i rected ar the same window with the sJme GC.
Therefore, the way to red is ro c:1ch
u
ce GC/DC val
i
da
t
ion rime
c
rhc most recent GC/DC
p
a ir so that subse quent comman
d
s th�1 t use rhe same combination need n ot tr
i
gger a \'�llidarion step. In some cases, graphics operat
i
ons
ll'il l
toggle between t\I'O or
more GCs. ( for
exa m ple, the C:o desti
p
v
Arca
o
perat
i
o
n
takes a s ource and a
n
a
ti
on . )
The pcdcmi1JI1cc in these c
as
e
s can be im pro
l
'e
d
Lw s im
p
h- cach
i
ng more than one rcccnr
GCjDC p:�i r. Tu ning c\pcriments on the sen·cr re1·ealed rhar '' c1che
size
bct\l'ccn
2 and
4
,,·as
suffi cient
to
max i m i ze
pcd(mn:JIJCe.
U
n
der the v
V
i ndOI\ S and \rVind ows 95 opcr;1ti ng S\'stems, are l i mi ted , �' c1ehe si ze
w
he re resources
of 2
is use d . Under the
W
i
n
do
w
s NT oper�ni ng systcl]], the cKhe size is 4 .
In t h e eXcursion server, the notion of
J c ac h e
d
GC/DC pai r i s cnc1psu
l
a ted in a C++ c
l
ass called a
WXDC. The WXDC: remembers the Win 3 2 obj ects th�1t have b een selected imo the
DC
and the last GC that w�1s used ll'ith it. As lo
n
g �1s these clements do nor c
han
ge from
one
gra
p
h
i
cs op
c
LH
i
on to the next, no I
'J
i id:�rion is
n
ecc
s
s
a
r\'. If
the client �1 pplication
ch a
n
ges the co
n
rents of
the (;c, Jll\' �1 ftecred obj ects
in
the DC �11-c tagged an d the not gr
a
ph
i
cs operation on that WX DC w
i
l l require ne11 o hju:rs to be selected into the DC.
Vnl.
K '-.'o. I 1 996
E,·cnts i n the
w i ndo
\\
'
S\'stcm em
also c1use WXDC
clements to become inv:1lid . t:or
example , if
the
win
dow
is m
ov
e
d on
the screen
bv
the
wi ndow man:wn irs clip
J ist may
hJve ch�1nged .
.
This causes
ro invJlidJtc the di
the WX�C
;
p
r
e
g ion in
i ts
DC. ( Clip list and region
arc ddined in the
t
(
J
I I
o w
i n
g
section . ) The
next graphics
operation
on th�lt wi ndow will requ i re the clip r
e
g i
o
n
to
be rec1lcuLued and r c lo :1
ded
.
Clipping in Single-window Mode
I n the X
Windo\\'
System environment, all
desccn dallts of the root
win
dow
have
.1
c
l i
p
l ist, whic h is
a
list of rectangles thJt ddi nes
the visi ble
are�1 of
t
h e win dow.
The
cl i p l ist is equal
to the area o
f the child
win
do w
minus Jny
�11-c�1s tb�1r arc occluded lw other
X
"
· i
n
d o \\
'S
.
Bdore d r
�
1
,
,
·
i n
g
into a descend:1
;
1t win
dow, the
server
m ust co mn
t
the dip
list
i
n
t o �1
Win 3 2
region . In t
h
e
Win32 API ,
a r eg i
o
n i s a polygonal �1rca,
110t
necessari ly
recrangu br,
rlut
can
be s
e
le
ct
e
d i n to a
DC tor clipping.
Bdcm.: initiJting
a
g
r
a
p
h i cs our put operJtion, cur renr reg
the tJrget WXDC
c
h
cck s to sce i f rhe
i
o
n
for t
h
e
window
is vJlid . If
it is
not, t
h
e
X clip l ist bined
is
converted to
:1
Win32
re
g i o n Jnd com
with the
diem-supplied
clip list
in
the
CC, if
�lll \'. The r
es
u lt
is
selected i n ro the output DC.
Clipping in Multiwindow Mode
I n
m u l tiwi ndow
m
od
e
,
the root wi ndow
is invisible.
E:1ch top - b·el
X
w i n d
ow
( tirsr- generation chil d of rhe root ) c orre
sp
on d s to :1 Win32
w
i
n
d o
w
on the desktop.
No cl
i ppin
g is necess�1ry tc>r rhese windows, because
W i
n
3
2 does this au t<Hll�1tic:1l ly. for
windows
below
rhe
rirst g e
n
er ati o n
, cl
i
p
pin
g
is
�
Kcom
p
li
sh
ed in
:1
man ner similar t
o
rh�u
uscd in singlc-window mode, o:ccpt th�lt thc offset of
the clip re
g
io
n
must
be
a
d ju
s
t cd
to
b
e
re l �ni,·e
to
the top-IC\'cl
windo\\' instead
of
reLni'
e to the r
o
o t
\\'indow.
Graphics Rendering
C r
�
1
ph
i c
s
r
e
nd
e
r i
n
g
is ar
the
hc1rr
of t he
X scrvcr. Two
of the core go�1ls for th e c
X
c ur
s
i o n
version
2 pmjcct
werc
to signi ticantlv
improve server
pertorm�1nce m·er rh�lt
of rhe e
X cu
r
s i o n vcrsion l
sen·er
and
to i lllf1l'O\'e scrvcr com pli:1ncc
to
the
X p
r
o
t
o
co
l
specific:1rio n .
hgure 2 comp::trcs t h c pcrt(mnance o f the e
X
c ursi on
\'CI'sion
2 sen·er
\\'ith
th�n of thc
\"Crsion
I
sen·er.
The
st�111Lbrd bench mark rests
X L 1 pu·f
and X
bench
were run o
v e
r
<1 local arc::t network to
eXcursion r
u nn i
n
g on
:1 66-meg<1herrz
vidco cJrd .
Pe ntium
processor with
;1 n S3
The
s:Imple X sen'Cr Uf10n \\'hich
the
eXcursion
X
sc
r\ '
L'
I
' is bJ
s
e d
pro,·idcs
�1
m�1c hinc-independcnr
byer th�lt
is
c:1pablc of
re ndering
:1l l X
graphics th
r oug h �1
sm:1ll set
of devicc-dcpendcnt fu nctions. I n tbc e X cur
s
io
n X
sen·er, rhc Win 3 2 limcrions provide rhe v i rru
�
1 l hardware i n tcrt:lce . For nuximum
pcd(>r m:Jncc, X
g r ::t p
hi
cs requ ests
�1re p
�
1
ss
e d to the Win32
1 00
90 z w
:2 w
>
0 a:
0..
� fz w u a:
0..
80
70
60
50
40
30
20
1 0
0
.--
I
(f) w z
0 f-
(f) w z
:::J r-
I r-
.-r-
� r-
(f) w z
0
_j
_j u:
(f) w z
0 f-
:::J en
(f) w z
0 u a:
<{ z
0 f-
X w fz
0
X w
_j
0..
:2
0 u
P E R FORMANCE BENCHMARK
(f) w z
0 f-
(f)
X
� a:
<{
:2
X
Performance
Benchmark eXcursion
Version 1 eXcursion
Version 2 Improvement
X Bench l i neStones fillS tones bl itStones arcS tones textS tones complexStones
XStones
1 3 5, 735
38,083
239, 740
74, 3 3 1
76.6%
9 5 . 2 %
59, 743
88,320 47.8 %
2, 1 72,720 3, 662,770
68. 6 %
1 56, 1 90
7 1 , 633
80, 057
2 1 4, 7 62
7 1 , 699
1 26,408
3 7 . 5 %
0. 1 %
5 7 . 9 %
X 1 1 perf
Xmark 1 . 6495 2. 5805 56.4%
Notes:
The test machine was a DECpc XL
566.
Si nce eXcursion version 1 did not support
16-bit fonts, the version 2 numbers were substituted to obta i n the X mark number.
Figure 2
Comparison of c
Xcursion
Version l
�u1d
Vc rsion 2
Pntorm�1nce
API
JS C;lrly as
p
o
s
s
i
ble
without c
o
mp
ro
m
i
s
i
n
g
the
requested rendering. Many
X
g r ap
h
ic s requcsts map nearly into Win32
c1
l l
s with
little
or no
datJ
m
a
n
i
p
u
lation.
Some
can not be complex gr:1phics requests, ho\\'e,·er,
pr<Ktica l l v m:1pped
into h
i
g
h
- l
e
vel vVi n 3 2 calls and ac hic,·c proper
pixelization. I n
such u
s
e
s
, the machine-i ndcpcmk n r f un
ct
i ons Jrc c;1 l led
;1S h e l p e
r
fu nctions to bre:1k the request do\\'n i
nto simpler
g
r
::t phic
s
requests.
GDI Context Switch ing
To reduce context
s
wir
c
h
i
n
g
,
W
i
n d o w
s
b a
t
c
h
es g r
aph
i c s device i n rerEKe
( G D I ) c:1Jis. The
debult G D J batch size i s 2 0 , b u t this l i m i t c:1n be
adj usted
per
thread. T
e s
tin
g
with �1
mix ofa l l
X requests siJo,,-cd rh
�
1t Jn m·erall
pe
do r
m
:1
n
c e
in crease
o
fa
b o u
G D I
r
9
percent
cou l d be
achieved
by bJtch limit to 30. At this
b·d,
t
h
increasi ng cr c is
110
m the
e
a
surable l at
e
nc y
, and, ti11·thennore, incre:1si ng r
h
c
batch size beyond this
po i
nt
had no measurable bcndit.
Vol . H No. I l \196
35
Some competing X scn·er products set the b:nc h size very high
( 10 0 )
at the beginning ofcvcry req uest and rlush the queue :lt the end . This approac h has no rnca surable benefit ove r our si mpler method, probably because the Windows operating system alrc:1dy pcr rorms timer-based f l ushi ng to prevent dr:1wing latency.
Similarly, whenever possi ble, Win32 graph ics cal ls are combi ned to red uce the overhead of context switch i ng. For example,
:111
X Polv
L
i ne request cou l d b e rendered with a series o f Win32 Li ncTo c:1lls, but i t is much more efficient to render the PolyLi ne request with a si ngl e Win32 PolyLine calL Similarly, a
Poly Rectangle X request is best rendered with a single
Poly PolyLine calL
Solid Fills
Many difkrent Wi n 3 2 resources such as pens, brushes, ronrs, and dip regions 111:1\' be req uired for anv given graph ics rtquest. The resources needed
::tre determintd by the gr::tphics operation itself:md the start of the X GC As norcd earl ier, these rtsou rces arc c reated as needed and managtd by the WX DC objects, removing si gnificant complexity and nearly redundam code from rhe actual graphics drawi ng rou t i nes.
Windows Pen stru ctures provide color and Lbsh pattern when drawi ng li ne objects. for dra\\'ing lines, segments, and arcs, the X ser \'er creates :md u�es
Pens that correspond to the
GC state. In some cases, holl' ever, exact pixcl izarion can nor be achie1·ed when usi ng
Windows Pens . Ex:�mples of this are dr:�1ving wide lines with r:�ste r oper:uions other than CXcopy or with l ong, dash patterns. In these cases, 111<1chi ne independ enr ti.ttKtions Jrc used to red uce the request to a set of spans (si ngle-width hori zonta l li ne s) to be ri l l ed . The use of Pens is :�lso ab:�ndontd i n speci al cases when the high ly optim i z ed GDI pattern block transfer ( PatBit) function cJn be used . P:uRlr ri l ls ITC tangular regions with speciricd colors or partnns. I r is r:1ster, for ex:�mpl c, to usc the ParRit function to d rJW verrjcal or horizont:tl lines than to use the \tVi ndows tradi tional line-drawing fu nctions.
Windows Brush structu res provide color :md pat tern \\'hen drawing r i l lcd recta ngles, ril led poil'gons,
:md fil led arcs. Aga i n , ror pertormance rtasons, the
PatB lt fu nction is often used even \\'hen there is a hi gher-level function th:�t seems to be a closer m•nch .
For examp le , PatRit can perform the X Po ly Poi nt req uest about 10 percent raster than S etPixe l V, the
Windows st:�ndard cal l f(>r setting single pixel vJ i ues.
Simi larly, PatB it can perrorm the X Polyfi l l
R
ect request about 14 percent faster than the Windows
Fi i i Rectangle d l .
Tile and Sti pple Fills
An X pix map c:�n be spcci tied as a pattern to be used when performi ng ti l l oper:nions .
·when the pixnup is created , it is rea l i zed :�s a Win 32 bitmap . When the pixm:1p has a depth greater than it is used as a co
1 ,
l
or rile that wi l l be used r(x the ril L If
36 l)igit.11 T.:chnic.11 )<>L11 11JI
Voi . S No. I 1 996 the pix map h:1s a depth of 1 , it c111 be used JS either a transp:�rcnt or an opaq ue stipple. An opaque stipple d raws both the GC's roregrou nd and b a c k g rou nd col ors, where the stipple is 1 and 0 respectively. A trans parent stipple is similar except that i t leaves the destination u ntouched wh ere the stipple is
0 .
When rht ri l e or opaque stipple i s 8 b�' 8 o r smaller, a Win32 color b rush is created and cached t()r the d r:n vi ng. On the Windows �T syste m, brushes brger than 8 b\'
8
c:m be created , but our experience has shown ir to be slower ro d raw wir!J them than i t is to perti:mn a series of bit block rranskr ( B itB l t ) opera tions h·om the tik/stipple bitmap ro the destination.
Transparent Sti pple Fills
There is a Win 3 2 functjon,
MaskB lt, rh:H seems ideal ly su ited r(Jr pedo rmin g trJnsp:�rcnt stipple ril ls. This fu nction , howe,·er, was not fu lly implement e d on all plarri:m11s :H the time 11·e d esigned tht eXcursion version 2 sortware product.
Without this fu ncrjon, there is no osy way in the vVin32 environ ment to perform the transpJren t stip ple operations. When rhe foreground color is either
0 or
Oxft:FF, the raster operation can be remapped to get the proper effect.
General rectan g ular fil ls th:�t d o nor meet the requ i rements ofrhc special case previ ous]\' ment ioned m ust be accomplished by fi rst con
,·erting the stipple bitmap to the depth of the d estination :1 nd then remappi n g the r:�srer operation.
In ge ner:1 l Clses that are nor rcctangubr ri l ls, mach i ne independent fu nctions :1re called to brtak down the request into spans
.
Image Requests
The Getlmage :md Putlmage requests are other examples of X gr a p hics requ ests that do not map ll'el l i nto the Win32 API . The only wav in the \tVin32 environment to pur image data o n rbe screen i s
to
rirst create a W i n 3 2 bitmap a n d initial ize i t wi th the innge d ata, and then ull the B i rBlr fu nc t ion to copy the bi tmap to the screen . X image data a lways Jisrs the top scan Jines first, whe reas the bottom scan li nes are listed fi rst in Wind ows b itmap data . Thcrd()tT , bdore t he bitmap is i nitialized, the
X i mage data must be scan- line Hipped. Si mil arly, the X Get I mage request req uires the usc of an inter mediate bitmap and also requi res the scm -line tl ip.
Plane Mask Support
Any graphics operation in X can be moditied by setting a plane mask in the GC The plane mask specifics which bits ofthe destination pixel arc a ll owed ro be changed . Without a pl:me mask, an
X gra phics operat ion may be ddi ned JS dst <- src 0 dst, where 0 is one of the 1 6 binary raster operat
i
ons
( e . g . , OR, AND, and XOR). When a plane mask is given, the r(JIIowing assignment ddines the destina tion pixel:
dst
<---
(( src @ dst)
& pm ) I
( dsr
& -pm )
Most video hardw�u-e de,·iccs support plane masking,
:md those rl1at do not su pport it
generally
provide E1st access to video
random -access
memory
(
l\AM
) . The
Win32
A P I ,
however, provides neither pl
a
n
e
lll<lsking nor direct video
1\AM
�
1 e c
css
.
To u nderstand w
h
y
,
vou must realize that Wi ndows h:-ts virtu:-tlized the color handling in
:m
a
t
te
m
pt
ro
mediate contlicts
bcrwcen
:-tpplications th:.lt would otherwise \\·ant to moddY th
e colormap
( the pix
c
l
-
to
-u> l or m
:1
p
p
i ng table). In tillS
,·irrual color
environmem,
the concept of pbn
c
111�1sks has no
me
a
n
i
n
g because Win32 applications need nor know the pLxel value th:-tt corresponds to :1
particular
color. See the section Color Resource Managemellt tor an explanation of how the
e Xcursion
software m:-tnages
ro :�ssign speciflc pixel val ues to colors.
_
I n the general plane mask c:1se, it is necess�lr\' tor the
X server � first sa,·e the contents of the destination i n
;1 bitmap . The gr:.�phics can then b e temporarily dr:J\\'11 ll'ithout r eg a rd to the pLme mask. Those bitS 111 the destination th a t �1re spcciticd by the plane mask
;ls being u naffected em rhcn be restored ti·om the s�wc�l bitm:-tp. This process wi l l work in ever�' case but IS Ind ficicnt since it involves SCI'er:-tl graphics opcr:ltlons bd(>rc achie,·ing th e tin:� I resu lt.
M:�n\' special cases un be reduced to one or t\\'O simple steps b,· modit':ing the sou rce color and raster opcc1tion. Ta ble l ShOll'S how rhc source color Jnd raster operation c1 n be set to
:�chin·e th e plane mask dkcr. The eXcursion X server uses these optim izations t()r many gr:�phics opcLltions when the source till is :1 solid color.
Internal Window Manager
I n the absence of
�1
windoll' m : 111 ager, the eXcursion servt:r creates :1 1 1 \\·indows
as
pop-up ll'i ndows. A l l \\'in doll'S, including
rop-Jc, c J
windoll's in m u lti\l'indow mode,
<11-e undecorated .
Thev
h�1,·e
no \"'i n32 borders, ririe
bars
or svsrem menus. To move, size,
rninimi7.c, maximiz
�
,
or
�
lose windows, the user must run a win dow m:�nager.
An eXcursion user �l lw;ws b:�s the option of u sing one of rhe
manv
X-b:1sed wi ndow managers al'aibblc, such JS the Mo-tif Windo"·
Man;1ger.
Holl'ever, lllJll\' users \\·ill W<lll t
a
ll'indo\1' manager pa
r:�
d
i
g
m
that is consistent with vVi ndows so that a l l ll'indO\I'S Oil the d
e
sktop have
t h
e
same
user intertace. To accom plish_ this,
a b u
i l
t
-
in window manager is provided as parr ot the eXcursion server. This internal window manager
is operative o n l v in mulriwi ndow
The internal window
m:-tnager, mode .
. .
the scnu, is function:� l l y
isol:�ted
tl-om
the rest
o f rhe code so that it can easilv
be
dis:-tbled . This al lo\\·s e xter nal \l'indow
ma nagers . to b
e used and a lso
hci lirarcs debugging by allowi ng problems
to be isolated. The ll'indow manager cre:1tes a " hook" into the
server's
window procedure, so
that
all vVin32 messages arc tirst
CX<lminecl bv
window m:1
;
t
he
"·indow managcL This gi,·es the
1agcr the
opportunity
to act on ll'indo\1'
managemem-�ebted messages
such as those that i nd i cate a� change i n the window's contigur:1tion o r state.
I f
the window manager decides to
handle a
message, it is removed ti·om the q ueue, and the server never sees ir. If rbe window manager is not
interested,
the mes sage is passed on to the normal ll'indo\1' procedu re . .
The purpose of the internal ll'indo\1' manager
Is t o ai\·e X wind oll's the same appear:-t ncc and beha\'JOr as
Y
Vin32 ll'indows th::Jt arc cr ea ted bv t\• pical desk top applic1tions, such as word processors a1
� d spreadsheets. When an X window is m:�pped . tor tbe first time, the internal wi ndow manager receives a W i n 3 2
WM_C: REATE message . Bct()re the window becomes visi ble on the screen, the window man ager alters the st\·lc of the Win32 windo"' to vVS OV E RLA P I ' E DW I N DOW. Win32 windows \\'Ith this- st\·lc ;liT auromaric1llv managed lw
Windows, ll'hicb ,h:-tnd lcs m ol
' i ng
, resizing, iconi f),ing, maximiz i n g
, and c l os i n g the wi ndows. Eac h of these :tcrions c auses a corresponding message to be sent to the server's window proced ure .
The i n tcrn:tl window ma nager interce pts the messages and dispatches them to the appropriate internal ti.1ncrion.
The r o l e of the internal \\'i ndo\\' m:1nagcr comple ments the ro le of the sen·er. The sen·er processes cl ient req uests on
X
\\'inclows �md translates them into opera tions on Win32 windows.
The inte rnal window man ager hand les Windows messages th at indicate changes to a vVin32 window :�nd translates them mro corre example
� the most important message rh:1t the window manager h<lnd lcs is
WM_Wl N DOWPOSC H A N G I N G .
Th.is message is scm just bdore anv change in the win do"''s position, size, stacking order, or l'isibiliry. If this message i ndicates that the window size c h a n g ed
, the window manager changes the size of the correspond ing X window :�nd sends a
Con6gureNorif)' event to the client.
Simi brly, the window man:tger translates other user-d irected. events such :-ts tocus change, win dow stacking, and iconification into changes to the u nderlying X data structures. I n most c:1ses, the win dow manager docs this bv calling into the de\'ICe independent l aver, thus simulating an X request that would occur trom an extern:�! window m an a g e r.
Mouse, Keyboard, and Input Focus
Mouse actions ;md keystrokes :�re received by the e Xcursion server as Win32 messages.
Each message comains i n f(mll;ltion about the window th:1r received the input and the rime of rhe in put.
For mouse moves
�md clicks, the scn·er u ses the \\'indo\\' intorm�uion to locate the corresponding X wi ndow and forwards an
X el'e nt ro th:lt winclo\1'. Keyboard input is t(xwarded to the window th:-tt currently has X foc us.
Digir.1l Technic.ll )oun1:11
Vol.
� �<>.
I
1 996 37
Table 1
Plane Mask Optim izations
Requested X Raster
Operation
GXclear
GXand
GXand Reverse
GXcopy
GXcopy
(src
& pm)
= pm
GXcopy
(src
& pm)
=
0
GXandl nverted
GXnoop
GXxor
GXor
GXnor
GXeq u i v
GXinvert
GXorReverse
GXcopyl nverted
GXorlnverted
GXnand
GXset src
0 dst 0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
1
1
0
0
0
0
0
1
0
1
0
0
1
0
1
0
0
1
0
Notes
2
1 0
2
2
7
4
1
6
8
8
8
5
7
9
6
3
Modified Source Color and
Raster Operations src
<---
-p m, rop <--- a nd src
<--src
I -pm src
<--src
I
-pm src
<---
-p m, rop
<--xor src
<---
- p m, rop <--- a nd src
<--src & pm, rop <--- or src
<--pm, rop
<--or src
<src
I
-pm, rop <--- a n d src
<--src & pm s rc
<--src
& pm s rc
<--s rc & pm src src
<--src
& pm
-p m, rop
<--xor src
<src
I
- p m src
<pm, rop
<--xor src
<--src & pm src
<---
-pm, rop <--- xor src
<---
- pm, rop <--- a nd s rc
<---
-src
& pm, rop <--- or src
<--src
I
- p m src
<--src
<--src
I
-pm
-pm, rop
<--xor src
<--pm, rop <--- or
Notes:
1 . dst is uncha nged when src equals 1 for these raster operations. Therefore, to preserve the value of dst when pm eq u a l s 0, set src equal to 1 .
2. dst is uncha nged when src equals
0 for th ese raster operat ions. The refore, to p reserve the va lue of dst when pm equals
0, set src equal to
0.
3. This operation sets all dst bits to pm i nto dst.
1 except where the plane mask equals 0. This can be done s i m ply by ORing
4. T h i s operation clears a l l dst bits except where the plane mask equa l s 0 . This ca n be done s i mply by ANDing pm into dst.
5. XORing with
1 has the effect of invert i n g . To invert only where pm eq uals 1, XOR pm with dst.
6. These operations a re performed in two steps. Note that dst is i nverted when src equals operation with src set to
1 where pm equals
0 . dst is now correct except that it is i n verted where pm equals 0.
The second operation of XORing with the i nvert of pm cor rects this.
1 . F i rst perform the
7. Th ese operations a re performed in two steps. Note that dst is i nverted when src equals
0.
Fi rst perform the operation with src set to
0 where pm equals
0 . dst is now correct except that it is inverted where pm equals
0.
The second operation of XORing with the i nvert of pm corrects t h i s .
8 .
T h i s operation is performed in two steps. Fi rst d s t is set to
0 whenever pm e q u a l s
1 .
Then dst is set t o
1 when ever both pm and src eq u a l
1 .
The two spec i a l cases can be redu ced to operations that use GXset and GXcl ear.
9.
1 0.
T h i s operation is performed in two steps. F i rst dst is set to 0 whenever pm eq u a ls 1 . Then dst is set to 1 when ever pm equals
1 and src equals
0. dst is unchanged; therefore, no operation is req u i red .
3:-l i)i�ir;11 Tn:hnical Journal
Vol . 8 No. I 1 996
The X server is a single Jppl icatio n in the vVin32 cn\·iron ment rh�H "owns" a l l rile X windO\\'S it crcltcs. from rhe user's perspective, thou gh
,
there 111�1y appear to be more than one
X
Jppl icar i on running, each with its own col
l
ection of windows. The user expects to be a b le to shift the kevbo:1rd t(>eus tl·om one window to another i n rhe s:1me tls hion that focus is shitrcd bct\\'ccn other :1ppl ications. \t\fben an e x te rn al \\'indo\\' m:1nager is i n usc, focus comrol is straightt(xward.
The \\'i ndow manJge r , usi ng \\'harever sem:mric it
\\·as designed tor, mon i tors mouse events Jnd shifts t(>eus accordingly. H owever, the semantic model for this may or may not be consistent with the Win32 mod e l . ln either case
,
the window decorations, e.g., borders, title bars, and menus, arc al most guaranteed to be different. A user who wants a consistcnr user in tcrhce model across Jl ! a pplications must emplov the interna l \\'indo\\' m:.n:1ger.
Ar Jll\' given rime, one wind o\\' on the screen Ius
Win32 focus and one X window has X focus. The two windows are not necessari l y the same. Since the X server cre:Jtcs and owns J l l the X windows in use, the server receives key bo
J rd input when any one of irs windmvs has \t\fi n 32 t(xus. The keystrok e s are nor necessari lv sent to r he undcrlving X window, however.
Thcv arc sent to rhe window that has X tocus. The internal \\'ind o\\' 111<1ll:tgcr Jssigns X tocus to the
X
\\'i n dow rhat receives Win32 toCLis. The cl ient receives noti tication of thi s event :tnd may decide to :tssign X t(xus to so m e other window, perhaps a child wi ndow.
The server m ust therctore
k
eep track of both the
X
window rhat cu rrcmly has focus and the stare of
Win32 foc us. When the server loses Win32 focus, the
X
ri xus is assi gned ro the root wi ndow. ·when the
Ser\·cr r c ee i\
· es Win32 focus
,
X tocus is assigned to the
X wi ndow th a t previous!\· hJd it. \Nhenever ch� m g c d bv :tn ap p l ic a tion
X
t i xus is
or Lw
the w i ndo w ma nager, the cu rrent X focus state is c:tchcd so that i t can be restored later, if necessary.
Font Management fonts and text fu nction�1lity make up a signi tion fi c ant por
of
anv graphics <1rchitccture. Both
the X
and the
Win32 S\'Stcms dctinc :1 rich set of te xt- rendering o p c rJtions and c a n process s c \· e r:tl tont tormats.
X and Win32 Fonts
The
X tont ma n a gement libr
:t ry is
:1 mod u lar arch itectu re th:tt detines an API t(x re a d ing and writing i n d ivid u•1 l rcmt tor m a t s. The m o d u l e that i mplements the API f or :1 given font format is cztl led a ren derer. This approach al lows X to support several tc>llt t o r mats
: tl1e l i brarv's renderer mod ul es com·ert ex t ern al formats to J single, internal b itmap format, which is u s ed tor all d r:twi ng oper
:t tions. The term
X./ollt refers to ton t
data in
this internal tormat.
The font management library supports both bitm a p and scalable outline tonrs. Bitmap t()llt gly p h s arc si m ply reto r matted :md used . Scal able tcm11:1ts, such as
Adobe Type 1 , JI-e rasterized on demand i n to the X font tormat.
For maximum performance, the server drJws text with native Win32 toms using the Win32 A P I . Win32 fonts are bitmap fonts in the FON f(mnat. Win32 functional irv co v ers the great ma j ority of te x t-drawi ng operations, but there a re a tew cases i n which it is either not possib le or not efficient to usc Win32 toms.
The server can also d r:tw d i rectly with the X tonts to provide fu ll
X t()llt support and complete text-d rawing functionality. This method uses Win32 Bit B i t
( ) opera tions to copv the ch�1racter glyp hs to the d isplay as bitmaps. Drawi ng speed with this method is :tccepr able but not maximu m .
Therefore, both X Jnd Wi n 3 2 fonts :tre used . The
Win32 fonts nuy be thought of as option a l acce lera tors: the server uses them whenever possible and falls b ac k to the X t(mts when necessJry. The decision to fall back can be made on a variety of cond i tions. This technique has also proved usefu l in worki ng around problems such as text-drawing bugs in i n d ividual video drivers .
Since scalable tont outli nes arc rJst c ri z ed into bitmaps at run time, the y are generally d rawn d i r ectly with the i n ternJ! X font format. The extrJ work of comp i li ng a comp:1nion vVin 3 2 tont at run rime gener ally outweighs its val ue as an accel e ra tor.
X bitmap tonts are most com monl y distributed in the B itmap Distribution Format ( BDl-"), an ASCII text sou rce fi l e . The eXcu rsio n team wrote a t(m t compil er tool that generates native Win32 ( FON t(xmat) fonts fl·om the
B
Df sources. The fonts created can be used by any Win32 appl ication .
The compi l er can generate either the com mon ly used version 2 t(mnat or t h e extended version 3 tor mat, which is n c ccs s J r y tor large tcm ts that re quire more than 64 k i l obytes ( KB) of glyph storage. figure 3 i l l ustrates the process of generati ng equivalent
X and
Win32 f(>nts ti·om �1 commo n source.
The X font tonn:1t contains extra i n t o rmJt i on (e.g., metrics and properties) thar cannot be derived from
BDF FONT
Figure 3
Font
Conversion
X FONT
WINDOWS (FON)
FONT
Digi r,ll T�(hnical journ.1l
Vol . 8 No.
I
1 996
39
rhe vVi n32 font. Therdon:, the X and Wi n32 to nts arc used rogether; the X i n t(mnation comes tl·om the
X font and the Wi n 32 r(mt is used Lw the Win32 API .
Real izing Win32 and X Fonts
When the X server fi rst opens a font, it invokes the function RealizeFont( ) .
This ti.mction gives the server a n opportun i ty to initial ize d:.1ta structu res
�1nd ped(mn
any format-specific operations necessarv
to m
ake the ti.lnt <l\'ailab l c .
To make a W
i
n 32 t(mt <1\":lii:Jble tor dr,m
· i ng, the server retrie,·es the
t
i lcn
: un
e
of the font from the scnu's l ook- up table �md registers it "·ith the Wi n 3 2
API using the function Add Font Resource( ). A h:mdlc ro th
e
font is obtained from CrcatcFontl ndircct( ), �111d the reafter the handle is selected i nto the desired
DC f(x d rawing operations.
H " the
Win32 real i zation hils
t
(
Jr any reason,
t
he code simply re1lizcs the X fon t instead . Failing to re:1lize a VVin32 font docs not neces sarily imply an error conditi on. Such t
a
i l ure happens in any case i n which the sen'Cr decides that it is best to use the X font d i rectJv.
The int ernal X tonr ti.m1ut is <1 set ofLhta structures.
The glyphs are stored in coll\'Cntioml arra\'S in user memory. To imp rove perti.mn<1ncc, the server reali zes
:.1n X font by writing a l l gln1hs ro a Win32 bitm a p in off-screen memory. CrcatcBitmap( ) returns a lund lc f(ll· later reference, and the glyphs in the bitmap arc indexed tor use in drawing operations.
Drawing with Win32 and X Fonts
The glyphs in X text strings are often kerned,
that
is, mnlapped tor best r v pogr
<
1p hic appearance. To draw with Wi n32 fon ts
, the SCITer emulates the way X draws text by using
Ex rTextOut( ) , w h ich uses an interch<1racter spaci n g vector to place the individual glyphs. The
f
o nt
' s
X met
rics are used directly to calculate th i s vector.
Glyphs tl·om X tonts arc dr:.1wn by performi ng
BitBits tl-om the Win32 bitmap to the t:trget window or bitmap . The server places the glyphs using the r(m t
' s
X metrics as d escribed in the previous paragrap h .
Color Resource Management
Alt hough some X Window Svstem concepts and struc tures 111:1p fairlv c lose ly to th
o
se in the \�Tin 3 2 S\'Ste m, color resou rce management is handled ,·crv differ en
t
ly
.
The difference is most
evidem
when dealing with pseudocolor video systems.
C
onseq uently
, this paper describes only this case .
The X Wi ndow Sys t e m environment shares 256 col
ornnp cells among :t i l appl i cations that use the default col ormap ( i . e . , those th<H do not have a pri,·are col onll<1 p ) . A ppl icati ons can allocate cel ls i n the defau lt c ol ormap to protect them tt·om modi fication Lw other applications. In contrast, the Win32 S\'Stem allows each appl ication comp lete access to the S\'Stem palette while the application h a s t(Kus and maps the palettes of the windows without t(Kus as best it can .
40
Digir,11
T<:(hni(a]
)oum.d
Vol .
8 No. I 1 9')6
In the X vVindow Svstem CIWironment, when an appliution n:serves a colormap cel l , it references the cel l wi th a pixel \·a lu e . Th i s value is an index into the colonnap and is used to look up the val ue that will
<
1ctu<1i ly be stored in scree n memory when that pixel value is used i n a d rawing opnation .
In the vVin32 system, color rnan<1gemcnt is handled by the palette manager through a p ale
t
te structure.
E
�
1cl 1 appl ication has a lo g ical palette
, and a singl e S\'S tcm palette contai ns the colors c ur renrlv mapped to the hardware colormap . App lications re
fe
re nce col ors rel a ti
,
·c
to
their l ogical p<1lette, :md the p
:.1
l ette man
.1gcr hand l es the mapping between the logical palette and the svstem palette . When J.n application is given t(>eus, the p <llette man
;
1 ger maps J l l the colors from
the
l ogical palette into the system pal ette. If the system palette d oes not have enough
empty
cel ls, the palette m�1 11<1gcr frees ce lls al locned to other app lications.
If
this occurs, the palette m:magcr wi ll attempt to remap the other applications' col ors into anv remain i n g tree ce l ls in the svstem colormap. If not enough cells are t i
ce
, a n\' re
m
ain i n g unmapped colors are mapped to the svstcm palette colors that m ost closclv matc h .
Beuusc of t h is \\"a\' o f hand l i ng color resource man agement, an appli cation docs nor know what value i s being stored i n screen memory r()f a n y particular color and the value stored f(Jr any color can change over the li ktimc of the app lication. This siruation presents sig nificant diffi c u l ties tor X operati o ns that req ui re exact kn o w ledge of the pixel val u es i n screen memory, such as the (;ctl mage operation and operations i n,
· o lYing pLmc 111<1sks. The sen-cr works arou nd the d i fficu lties b\ creatin g nm Win32 logical pal ettes.
The ti rst palette, i . e . , the working pal ette
, corre sponds exactl y to the X debult colonnap and does not al low sharing of the palette by Win32 applications.
\Nhcnever an X window has focus, the working palette is in usc. This causes the Win32 palette manager to set up the system pal e tte such that it d i rectly corresponds
to
the X co lorrnap, and operations thar arc pixel based
"urk properh-
.
The other palette, i . e . , the
idenrin·
palette, is set up ro cmrespond exacrlv to rhe system p�1lette . The iden tin· p:: tlctte is used w h enever no X window has too1s
.
Bcu use of the correspondence, no translation i s i nvolved benveen the ide
nti
ty
palette
and the system palette
,
which
allows the X server to know what pixel va lue is stored i n screen memory.
The X Window System envir o nment allows t(Jr p r i
V<ltc colormaps, which �11-c created and used by a single
<1ppli ution . The server creates :.1 working palette tor
C\U\' colormap created . When the col ormap is installed
( norma lly
Lw the windo\\· mamger \\'hen the X appl ica tion is gi, en tocus), the e Xcursion software installs the
" orking palette associated \\'ith the pr i
,· ate colornup .
The eXcursion X se rver c urre
m
ly supports the
PscudoColor visual class and the StaticGray depth 1
visuJI class, which i s main l y used tor bitmaps. eXcursion version I also supported
�l
StaticColor v isua l cbss for 1 6 -color video graphics :may (VG A ) displays. eXcursion version 2 treats VGA devices identic1lly to
PseudoC:olor de,·iccs and al lows the Windows palette m�
Huger to gencrJte d ithering pam.:rns tor the una,·ailable col ors.
Network Interface
With the rele:tse of X I I R6, the X Consortium com bined all transport-specific code into a single p!Jce in the sou rce tree, the X transport i n terface. The eXcursion te:nn extended the X transport intertace to include Network Computing D ev ice ' s ( N CD's)
Xremote s er i :� l line transport. Com bined with the transmission control protocol/internet protocol
(TCP/IP) and D ECnet transports, the eXcursion product
CliJ now execu te X sessions over Jnv of these tr:�nsports si m u l raneouslv. The c Xcu rsion pro d uc t supports anv TC:P /IP stack th�H com plies with the
Winsock \'ersion 1 . 1 implementation, PATHWO RKS
D ECnet protocol, and NCD's Xremote p rotocol tor serial line.
The X
transport interface prm·idcs fu nctions that
a
r
e common ro
all transports,
su
c
h as parsing an add ress into a docs
host and
port
number. T
h
e
i nt e r [Jce
not provide an abstraction
t(>r
the
se
le
ct
( )
caiJ, because ir assu mes that
this call
is
rr:msport in
de
p
e
n
dent.
Unt()rtu nately, the
X remote protocol
requ ires
�1n independent
select( ) mech:mism, and, thus, it
was necessarv
to
i
m
ple
ment
a select( )
� t b
s
trac
t
ion to
co
mbi
n
e the tra
nsport indepen
d
ent select( ) \\ith the
Xrcmote
select( ) .
Although somewhat comprom ised
Lw this add i tion, pe
r
to
r
m
a
n
c
e was a
problem only
w
h
e
n
the
Xrcmote protocol was used in
combi nation with
either the
TCP /IP or the
D ECnet p
ro
t
o
col.
X Image Extension e Xcursion \
' c rs
i
o
n 2 provides
,·ersions
3
and 5
of the
X I mage Extension
to support
a
w
i c k
range
of i maging
a
p
pl
ica
tio
ns
.
Because
it
is
a large
body of
code,
X I E i s
im ple mented
as a
pair
of Win32
D LLs
to consen·e
memorv on systems
t
h
a t wil l
nor be running applica
tions
that
usc X I E .
N
or
m
a
lly
,
�lCccss ro a
DLL
i s one-\\·:ty. App lic:trions
can load and
make function
calls i nto
a
D LL,
but because ir is
linked dynamical l y
�lt run time,
the D LL
code
cannot mJkc fu nction calls back
in
to
the calling appl ication . X I E , however, must ctll into the
device
dependent
laver
of the sen'Cr to
perrcmn
any
r
eq
u
i
re
d
d r
a\\
' in
g after processing
i ts i ma
g
i
n
g requests. To per mit this, Jn addition to
tbe
i n terbce
w<Js
designed .
W
h en the X I E
D LL
is i ni
t
ia
l
iz
ed , the caller supplies
a
Jist of
pointers ro
the
functions
needed by
the
X I E.
The DLL ri l ls an
<llT�lV with these poi nters and then calls back i n d i r e c t ly th rough the Jrray. On the
\1\Tindows operating system, this design cou ld c re at e a problem because u n d er Win32 AP!s, global data in a
D LL is not instanced; that is, the code is not reenrr�1nt.
The approach \\Orks i n this case b e c
<J us e there is onlv one copy of rhe D LL loaded . If another a p pJ i cn i on was shar i n g the DLL, the pointers wou l d be overwrit ten by the second initialization .
Control Panel
The
eXc u rsion
control
p
a ne
l
is
the prim ary interbcc through
which the user
con tigurcs �111d controls the product. Some other
compone nts
create
simple
w
i n
dows
or icons, but these fu nctions <Jre limited .
The control panel
constitutes 90 percent of the
user inter
bee t
o
r
the
eXcursion a
p
p
l
ic
at
i
o
n.
This ract makes rhe control p
an
el an ideal c<Jndidate tor the r
a pi
d
applica tion de\'elopmcnt features of
the
M icrosoft VisuJI
C++ e
m·iron
ment.
The control
p
Jn
cl is
a
vVin32
appli cation coded J lmost entirely i
n C++
and
linked
with
the Microsoft Foundation
Class library.
The main sent a
purpose of mJ nagc�Jble
the control
pa
n
e
l is to interf:tcc through which
the pre
user can view and mo
d
i f v
the eXcu rsion
con figuration pro ti le.
To do
this in a manner consistent \\'ith
the ne\\
Windows 95 she l l ,
the
Property Sheet
M�C
object
w<Js chosen. Property Sheets arc tabbed dialog
boxes
that
have the <Jdvant:�ge
of
organizing lar
g
e amoums
of
data
setti ngs
in a
compact
space . The�· arc
used
cxtensi,·el \' b\'
the
WindO\\'S 95 operating svstem and bv the most
recent
\'Crsions of
Microsoft
applicnions.
The Propcrt\' Sheet
object
is �l
su bclass of th
e
Windows object
and is essentially
a container tor the ta
bbe
d
p:tgcs. E:tc h
tab,
when
cl ic ked by the
user, di
s plays
a dia
l
o
g
box that
is subcbssed ti·om the
M�C
Propem·
Page
object. The individual
pages can
be
,·isually
configured
and revised
usi ng
rhe class
wizard teature of Microsoft VisuJI
C++ .
The designer simplv
selects
dialog box
controls such as buttons, d rop
l ists, or edi t tields :md
positions
them
on the
d ia
l
o
g
box.
The
code to
hand le user actions is rhen fi l led i n .
The eXcursion control pan el i s shown in hgure 4.
We constructed
an initial
prororvpe of the comrol
panel
J p
pli
cuion \\'ith about 60 pe rcent of the
tin�1l
function:tlitv in l ess than
one month.
lnterprocess Commun ication Library eXcursion ,·crsion 2
consists
of s
c
,·
er
al
cooperating processes
thJt
must com munic:�te :md
S\'IKhronizc with one started by
Jnother. When
a
remote
X
application
is
the server or the
control
pa
ne
l
, the applica tion l a
u
nch
er signals when the operation is complete.
Digit,11 Tc..:l1 11ic:d journal
Vul . R ;-\o. I I \J9(l
4 1
.,
><DM CP
..... .
.
.....
.
.......
.
,
!
Info
!
Accounts
· ... . ....... . . . . . ... ,; eXcursion Control Pa nel
E xtensions
Applications
D isplay Fonts
Communications
Keyboard Mouse
I
I
Logging
M odem
Access l
I eXcursion Control Panel
Copyright
€> 1 995
Digital Equipment Corporation
Computer N ame:
R egistered to:
Serial Number:
Installed Path:
Version:
S N O O T S
S N O O T S
21 309
C:\XCU R S I O N \x86\
V2. 1 . 309
X Server ------------------------------------------,
Server N umber:
Number of Links in U se:
N umber of Errors Logged:
0
8
0
O K
J I
�_= ce l
=='� I ..... J
Figure
4
The eXcursion Control l\111CI
I
R estart S erver
�
42
Error and status information is sent to the error logger by the other com ponents. When the user changes a contigurarion setting thro u gh the conrrol panel, the change must be com mu nicated tO the X sen·cr, if it is runn ing. In some uses, the change c1n t:� ke effect im mediately; i n other cases, the server unnot imple ment the change witl1out restarting. The control panel and the server must engage in a di:dog so th<lt the user can be int(>rmed as to wh:J.t action m ust be taken, ifanv.
The ! PC librar�' is Jn opcrJ.ti ng system-i ndependent
APJ th�H permits eXcursion compone nts to determine which other com ponents :tre present and to exchange comm: 111ds and configuration information .
The Windows NT operating system provides several bui lt-in !PC mecha nisms, but most arc nor on the Wi ndows
�wailablc or
\Nindo\\'S 95 syste ms. The onh' mcch:111ism that is u n i\'crsal to the three operating systems is the message -passing inrerhce in the Win32
API. This mechanism, while nor the most dlicicnt, is relatively straighttorward to implement. Since the per torm:lllec demands on the
I PC li brarl' were deter mined ro be verv light, this mech�111ism \\'JS chose n .
The d isadv:�mage of the Win32 message-passing i nterface is that it is \Vindow based , not process b�1sed.
Mess:�ges
�1 1-c received by a c:dlback procedu re that musr be :1ssociated \\'ith a \\'indo\\' before am· commu nication can t:�ke place. If <ln application has not vet cre:�red a \\'indow, or never creates a window, as is the c1sc with the :tpplication launcher, no com mu nication is possible. To remedy this, the J. PC li brary creates its own window when the calling process initializes. The
T PC \\'indm\· is ne\·er mapped to the screen, so it is nor
\·isible to the user. All i nterproccss com m u nicuion passes through the ! PC window.
The lPC li brary consists of a collection of un ique messages and an
A P I .
The messages arc registered with the Win32 fu nction RegisterWindowMcss:�gc.
This e nsures that the messages u sed l)\' the eXcursion
:�pplication do nor conflict with system messages or messages used by other applications. The eXcu rsion
! PC messages arc
• ipcComponcnrSrartedMsg, which th e
I PC posts to all compone nts \\'hen a component i nitial izes .
Vol . K No. I I ')<)(,
•
•
•
•
•
•
•
• ipcRestartServerMsg, which the J PC sends to the server to tell it to restart.
ipeRestartServerStatusMsg, which the
J PC
posts with the status of the restart request. ipclnq uireMsg, which the !PC sends to retrieve a data i tem from a component.
ipeProfi l eChanged Msg, which the control panel sends when the registry profile changes. ipc La unchOneCompleteMsg, which the applica tion launcher sends to noti�' the server of lau nch com pletion.
ipc LaunchAJ I CompleteMsg, which the application lau ncher sends to noti�' the server of launch com pletion . ipcH ideAI IWindowsMsg, which the server sends to a l l components to tell them to hide all their win dows. The e Xcu rsion application uses this message
to
execute the pause/resume Feature .
ipcShowAIJWindowsMsg, which the server sends to all components to tell them to show all their win do•vs. The eXcursion appl ication uses this message to execute the pause/resume featu re .
I n addition to sending and receiving messages, eXcursion processes can use the I PC l i brary to deter mine which other components arc running. The
I PC initialization proced ure creates a window with a unique name that identities the call ing component. To determ i ne whether a speci fic component is present in the system, the ! PC searches all windows on the system until it finds one with the correct name.
Error logger
The error logger is a Win32 application that receives nror and i n formational messages from other compo neJJts and either displays them in a window or logs them to a tile. On the vVindows
NT
operating system, information that may help system managers or users d iagnose problems may additionally be recorded in rhe Windows
NT
evellt log.
Application launcher
The application lau ncher is a Win32 app lication that hand les requests from the control panel or server to start
X
client applications. The client may reside on a remote host or on the same machine.
When the user req uests the server or control panel to start an X client application, it starts the eXcursion appl ication launcher in a separate process. The applica tion command, host name, account information, net
work transport, and command shel l are passed to the lau ncher in its command line arguments. The lau ncher makes the connection to the remote system, initiates
the command using the selected protocol ( rexec, rsh ,
DECnct object, or local com mand ), and sends an
IPC
message to the server indicating that a new appl ication is starting.
Registry Interface
The Windows NT operating system introd uced a new concept called the registry. This is a protected database mai ntai ned by the operating syste m, wherein Win32 appl ications may store configuration and state infor mation. The registry has a wel l -ddined
A P I
and a mainten:mce uti litv progr�u11 that is shipped with the Windows NT operating system . Under the
Windows operating system, configuration information is kept in simple text files, which are vul nerable to accidental or malicious tampering. At the time the design of eXcursion version 2 was under way, it was u n known which, if either, ofthese two metl1ods wou ld be ava i lable u nder the Windows
9 5
operating system.
Nevertheless, all th ree of these operating systems had to be su pported.
We designed an
API
for accessing the configuration intcm11ation in a manner i ndependent of the operating system . Knowledge of the oper:tting system and its reg istry access method is encapsulated in the li brary. Since several independent processes must access the informa tion, the l ibrary is built as a
DLL
to conserve memorv.
The in terface basically resem bles that of the Windm
;,
s
NT registry
A P I
but elimi n::ttes some of the complexity.
I f the eXcursion software has
nor
bee n configured when the registry interface ti rst accesses the profile, default values for al l settings arc selected to allow the software to function normal lv.
Summary
With computer systems based on the Microsoft
Windows operating system i ncreJsing i n power and decrc:tsing in price, Windows- based systems are appear ing on desktops that once held workstations running the U N I X or OpenVMS operati ng systems. Windows systems must be able ro access applications on remote tile and compute servers running in the X vVindow
System environment. Version 2 of rhe eXcursion prod uct provides desktop integration of X client applications with n�uive Win32 appl ications. Mod ul::tr cod ing tech niq ues, object-oriented progr:tmming, and selective use of the Microsoft Foundation Class li brary helped reduce development ti me, and improve performance, mai ntainability, and reliability.
General References
D .
Ci obs and A.
Leskowi rz ,
"eXcursion t()r
Windows: l nr cgr;Hing Two W i ndowi ng
Systems," Oip,ilal Technical
.Jou rnal. vol. 4, no.
I
( Winrcr 1 99 2 ) : 56-67.
Dig;ital Tcdmi�al Journal
Vol .
8
No. 1 1 <)96
43
44
X Window System
S. A n g c: br
;l l l n d t cr a l . , Dejlnition o/the l'urfillJ.!.
!.are1jin· the
X t · f I
Sa111ple Sener (
C:
11 nb r i d g e , M<lSs . :
X
Consor tium, I nc . , 1 994 ) . j . hdron ,
The X
Font Serricl! l'mtoco/.
I
·en-ion
2.0.
X
\ ('ISion
I ! .
Release
6
( C:unbridge, M �s s .
:
X
Consor tium, I nc . , 1 994 ) .
E .
I s r a e l Jnd
E . F ortu n e
, '/he
X
\l?indou•
,)·J,S/e/11
Serl 'el;
X
\ i.•J:..;iou
I I.
Release
5
(VVoburn, !Ybss.: Digit�! Press ,
1 99 3 ) .
0.
J o nes, lntmduction t o the
X
I.Fiudotl'
.):)•stem
( Engle wood Cli rlS, N . J . :
Prentice-H<lli, I n c . ,
1 91\ 9 ) .
K .
!';Jcbrd ;Jnd
D .
Lemke,
'lbe X
Font !.ihrwy ( Ca m bri d ge, ;V!Jss . : X Consortium, I n c , I 995 ) .
D.
Roscmh.1 l , lnfr?r-Ciient Conlllllllticotion Omt ·eutions
.1/muw/. \
C'l:,foll
2.0
( C a m bri dge, Mass . : X C:onsorri u m ,
I n c . , 1 994 ) .
R
..
Scilcitkr,
X
Windou· Svste111 Pmtocol.
X I
(•J:..;ion
I I .
Ne/e(fS(' 6
(
C
:
� m brid ge
, Mass . : X Co mm t ium
,
I n c . , 1 994 ) .
R.
Scileitler and J . Gerrys,
X
Windou•
S)'s/ellt ( Bedt(mi ,
M ass . : D igital Press,
1992 ) .
'fbe G{ 'I
Gu ide. lutemutionol Temliuolof{J'./(Jr
the
1\:iu dou s fnlel/ace (
R ed m o nd , Wash . : Microsoft Press, 1 993 ).
S. McConn..: II, Code O.>llijJ/ete:
Sojill'a re Co ns/
A
Practical flandh<HJIJ o( met io11
( R.:ci mond , Was h . : M ic r o so tr
Press,
1 993 ) .
C.
Petzol d, l'rr��nl llllllillg Window�.
2 d ed . ( RcJrnond,
Wash . : Microsoft Press, 1 990).
13 .
S t r ous t nr p
, 'the C++ l'mgr(fiJim ing Languap,e ( Kcad ing, Mass . : Add ison -Wesl ey P u b l ishing Company, 1 9 8 6 ) .
Biographies
Networks
M . H a l l e t al . , "Wind o11·s Sod�crs: An Open J n tertJce [()['
�l'tll' o rk l'rogr;unming u n der Microsolr Windows, V ersion l . J " ( I 99 3 ) .
K .
Pacbrd,
X
f)j_,jJia)' .\lanager
Contml l'w wl.
I
('1:-;io n
1 . 0. X I
(>n;fon
.1 1 .
Release
5
X
Consortium,
1 98 9 ) .
( Cm1lxidge, M�ss . :
,\·! I T
W. S t e
1·ens,
UNIX
Netn·ork Progrmnmin,t;
Cli Hs , N
)
.
:
Prentice-Hall, Inc.,
1 990 ) .
(
Engic ll'ood
X
'/i'anspou
Jntcrj(?C!! ( Dayton,
O h i o : N C R C:o rpor<ltiOll ,
1 99 3 ) .
John
T.
Freitas
Prcse nrk
<1 sofrw.1re enginee l:'rcit�s 11 orked ;lt Digi t;11 r at Atri<1 Software, john f or I 5 l'e<lr·s. !:'or the last fe11
\'e;Jrs, he ll'as <lss
<1S
Jn in di
1
· i d u
;
1 l o c i
.n
ed
11 irh D contributor, <1n i gi tal 's n i
, c
·ersi n
Xcursion pmd uct architect, <Hld
:1 d cs i g n
L:r.
Pre1·iouslv, he
1\·:1s i n the Worksution gro u p . John recein:d
J B.S.E.I:'.. ti'om N orrh c;Jstcrn l
'
· i n 1 96 7 . Wh ile in college, he ll lll'ked ;Js <1 co-op student on the Apoll o
Project at ,'v\ JT's Draper L1 boratorv. During the he worked l(>r
HJ n-;1rd
1 9 70s,
Unil'crsitv de1·clopi ng and rna i rl
t<lining rned iul com p ut i ng facilities <lt lvl assachuserts
Ccncral H o spi t<1 l .
Windows Operating Systems
R. Hhke, Of!limizii i,Q Windou�,·
.\T
Will!lrJit 'S Y!Nesoune
/\it. 1·ol . 3 ( Redmond, W,1sh . : Mic ro s o rr
Press, 1 99 :1 ) .
H .
Cu srn, Tusicle \'V-iudotn
,\T
( Red rn onJ, W;1sh . :
M i crosoft Press, 1 99 3 ) .
A . King, Tnside IFiudou �-;
95 ( Rcdrnond,
Wash : M i cr osoft
Press, 1 994 ) .
\Viu.-).2 l'm�ram mer \ Reference, l'ols.
W:1sh . : Microsoft- Press, 1 99 5 ) .
1 - S ( Redmond ,
Windows Programming
K.
Ch ristiJn, J Z1e ,\1ic msoji Gu ide to
C+ + l'mgrwnm ing
( Redmond , \V;Jsh . : Mi c roso f t
Press, 1 992 ) .
I'.
] ) i L1sci;1, Windotr s++: \.\// '/!il l,!.; Neusohle Wi urfoll
'S
Code in
C++
( Read in g, M <lSS . : Add ison- \Vesb· Publ ish i
n
g
C
:ornf1,1111·,
I 992 ) .
] ames G. Peterson
) ames Pert:rson is cmrc ntly a sotrware engineer at
DeLorme Ma
NT g ro u pp i n g. As
;1 member of Digit f
1
, James led t h e release� ofthc e ll'arc ti·om v e r si o n
1 . 1 th rough l'crsion
X a l c u
2 . 1 .
' s Wind oil's rsion sotr
1n
<ldd ition, he worked as
;J rc hitect <
1 n d in divid ual contributor on the e
Xcmsion project, concc ntrclting on graph ics <ll1d p e rf o r mance l-:;1rlicr, he 11orkcd in the
PATHWOR KS
<Hld R:1 i nb011 groups. hmes 11'<1S e mpl o v c d b1' C om p i o n
Corporation bd(>re jo m i ng Digital i n 1 9 84. He rccci 1'ed a B . A .
(
1 9 79 ) in J1l<lthcnnties ti-orn fnd i<lna Uni1·crsin· and an M . S .
(
1 98 1 ) in m�thernatics .1nd an
,\\.5. ( 1 984 ) in colllputer scie n c e
, both li'om the Uni1'crsm· of!llin ois.
V"l i-i No. I 1 996
Scot A . Aurenz
Scot Aurcnz is a �rincif'�l softwJr<.: engineer in the
Win do ws NT group where l1c ll'ork� on the develop111c11t of the e X cursion
PC
X ser v er . Scor h<1S contributed ro nunv projects
;H
Digital, including the L� ngu;�ge Sensitive Edito r
( D EC :ser LS E ) <1nd rile S U VA X 11·orkstJtion. Scot c;1111e to
Dig;i t;11 in
1 979 JS J Purd u e
U n i
,u si t\' co-op srudenr ;1nd b..:c·.1111e a fu l l - rinJC cmplmu·
.liter recci,·ing his
B.S. E . E. in
1 9X 2 .
H e recei\'(:d ;1n M . S . F . t-:. f rom rhe Uni, crsitl' of
I l linois in 1 98 6 .
Paul
J.
�1 nauro
Paul Ra nau ro joi ned Digi tJI in 1 987 and is a pri nc ip sofrware engi neer in the \Vindows NT group. He is a l respon sible tilr ;1pplication t;tilover t()r the Digir;
1 l Clusters t()l' vVi ndows
NT product. In t:<
1rl ier
II'Ork, he partici pa in the dc,·clopmenr ofrhc eXcursion softll
'
;
1r
<.:
Jnd the
A C M Sx� tr;ms;tcrion l
' rocc s s ing mo ni tor
, spcci t ic
1 l h
·
, ted in rhe implcmcnr;1tion of rhe RTI p rotocol
.
He ;tlso p;1r ri,ipared in the i m pkmcnt<ltion o f r he Manuhcruring
Messa ging Sen·icc
0 -, a ppl ic a tio n la\'l: r pro ro, o l t(Jr rlK
D l:::Comni prod uct ami ;\ ne n,·ork pertormJncc anail·zer.
Prior ro comi ng ro
Digi ta l
, he "·as a (OnsultJ nr ;1t In dex
Systems and
<l senior software engineer a t
Micom - [ nreriJn.
Paul h old s a
B.A. i n h istory ti·om the U n iversitv of
1Ybssachuserrs ;lt Boston .
Charles P. Guldensc h u h
C :h;1rlcs Gu ldenschuh is J principal softwJre engi neer i n
Dig;i t
;1 l
' s Windoll's NT group . H e i s responsible till· color su pport and sofr11·Jre in staiiJtion of rl1e eXc ursion prod uct.
Prc,·ioush', he II'Ot'kcd in the Real-Time Sofr11·;m:, l'roh:ssion;l l 300 Sofn, Jrc t-:ngincering, �nd RT- 1 1
Engit1l'l'ring gro ups. Ch;Hics joined Digital afrcr rccc i, ing his
B.S. in i nfonm1tion ;1nd c<>111flU t<.:r science ti·om rhe
Ccorg;i;1
1 nsriru re ofTcch nolog\' in
1 9 76.
Digital
Technical Journ;�l
Vol . � No. I l<J96
45
Atsisiųsti
Reklama
Susiję