I am working on building an X11 server for Windows from scratch based on a copy of the "X: Volume Zero Protocol Reference Guide." I have made great strides in decoding messages and in having a full conversation with clients, but I have problems understanding what calls for drawing should actually do.
The messages in this example are taken from running xbiff on a Linux machine and are talking about my xserver on Windows. It is possible that I have some errors in the interpretation of the protocol, but the data seems to be true so far.
Graphic calls begin with this, and the client creates a graphic context with the identifier of the root window (90) as drawable:
X_CreateGC: ID: 2097152, Drawable: 90, ValueMask: 8, Value0: 16777215
What is the significance of creating a root window based GC?
Then it creates two 48x48 pixmaps and places images on them:
X_CreatePixmap: Depth: 1, ID: 2097153, Drawable: 90, Width: 48, Height: 48
X_CreateGC: ID: 2097154, Drawable: 2097153, ValueMask: 12, Value0: 1, Value1: 0
X_PutImage: Format: 0, Size: 408, Drawable: 2097153, GraphicsContext: 2097154, Width: 48, Height: 48, X: 0, Y: 0, LeftPad: 0, Depth: 1
X_FreeGC: Graphics Context: 2097154
X_CreatePixmap: Depth: 1, id: 2097155, Drawable: 90, Width: 48, Height: 48
X_CreateGC: ID: 2097156, Drawable: 2097155, ValueMask: 12, Value0: , Value1: 0
X_PutImage: Format: 0, Size: 408, Drawable: 2097155, Graphics Context: 2097156, WIdth: 48, Height: 48, X: 0, Y: 0, LeftPad: 0, Depth: 1
X_FreeGC: Graphics Context: 2097156
Am I right in assuming that the GC in this is equivalent to DCDC memory, and the end result should be two 48x48 bitmaps in memory containing the data that was in the PutImage call?
Here it creates a different graphical context based on the root window, but I do not understand why:
X_CreateGC: ID: 2097157, Drawable: 90, ValueMask: 65544, Value0: 16777215, Value1: 0
He then creates two 48x48 windows, one with the root as the parent, and the next with the first window as the parent:
X_CreateWindow: Depth: 24, ID: 2097158, Parent: 90, X: 0, Y: 0, Width: 48, Height: 48, BorderWidth: 1, Class: 1, Visual: 0, Bitmask: 10266, Value0: 16777215, Value1: 0, Value2: 1, Value3: 6422576, Value4: 32
X_CreateWindow: Depth: 24, ID: 2097161, Parent: 2097158, X: 0, Y: 0, Width: 48, Height: 48, BorderWidth: 0, Class: 1, Visual: 0, Bitmask: 26650, Value0: 16777215, Value1: 0, Value2: 0, Value3: 163852, Value4: 32, Value5: 0
This seems to create a 48x48 base window with a window inside it having the same size and origin. What is the meaning of this? Won't this close the window with the root window, which makes it redundant?
Next, we get a CreatePixmap call based on the child window created above with a width and height of 0:
X_CreatePixmap: ID: 2097162, Drawable: 2097161, Width: 0, Height: 0
What is the purpose of this?
, xbiff () , , CopyPlane 48x48.
X_CreateGC: ID: 2097163, Drawable: 2097161, ValueMask: 65544, Value0: 16777215, Value1: 0
X_CopyPlane: SrcDrawable: 2097155, DestDrawable: 2097162, GraphicsContext: 2097163, SrcX: 0, SrcY: 0, DstX: 0, DstY: 0, Width: 0, Height: 0, Bitplane: 1
X_FreeGC: 2097163
0 . NOOP, 0x0 " "? , , ?
0x0 pixmap :
X_CreatePixmap: Depth: 24, ID: 2097164, Drawable: 2097161, Width: 0, Height: 0
0x0 pixmap? - " "?
GC CopyArea 48- :
X_CreateGC: ID: 2097165 Drawable: 2097161, ValueMask: 65548, Value0: 16777215, Value1: 0, Value2: 0
X_CopyArea: SrcDrawable: 2097153, DestDrawable: 2097164, GraphicsContext: 2097165, SrcX: 0, SrcY: 0, DstX: 0, DstY: 0, Width: 0, Height: 0, Bitplane: 1
CopyArea 0. , " ?"
2097158 ( , ), .
X_MapSubwindows: Window: 2097158
[We send a MapNotify and Expose event for window 2097161]
X_MapWindow: Window: 2097158
[We send a MapNotify and Expose event for window 2097158]
, ClearArea :
X_ClearArea: Window: 2097161, X: 0, Width: 0, Width: 0, Height: 0
?
CopyArea 0x0 pixmap 24x24:
X_CopyArea: SrcDrawable: 2097162, DestDrawable: 2097161, GraphicsContext: 2097157, SrcX: 0, SrcY: 0, DstX: 24, DstY: 24, Width: 0, Height: 0
. , , .
, X11, ( ) , .