Xlib
1
2X Window
3GUI
4Xlib
1 X Display
2 GC
3
4 Xlib
5
5Xlib
6X
7Display
8“hello world”
9
1 (GC)
2 ...
10X
1
2
3
4
1
2
3
4
5
5 X
11
1
2
3
4
12
1
2
13
1
2
3
4
5
14
1
2
3
魔灵军团 - 纯c语言技术论坛-
4
5
6
15
1
2
3
4
16X BitmapPixmap
1 X Bitmap X Pixmap
2 Bitmap
3 Bitmap
4 Pixmap
5 Pixmap
6 Pixmap
17
1
2
Preface
1
This tutorial is the first in a series of "would-be" tutorials about graphical programming in the X window
environment. By itself, it is useless. A real X programmer usually uses a much higher level of abstraction,
such as using Motif (or its free version, lesstiff), GTK, QT and similar libraries. However, we need to start
somewhere. More than this, knowing how things work down below is never a bad idea.
“” X Window
XMotif(lesstiff) GTK QT
After reading this tutorial, one would be able to write very simple graphical programs, but not programs
with a descent user interface. For such programs, one of the previously mentioned libraries would be used.
The Client And Server Model Of The X Window System
2X Window
The X window system was developed with one major goal - flexibility. The idea was that the way things
look is one thing, but the way things work is another matter. Thus, the lower levels provide the tools
required to draw windows, handle user input, allow drawing graphics using colors (or black and white
screens), etc. To this point, a decision was made to separate the system into two parts. A clie