3.1.1.8 Surface Management

The server maintains a hierarchical model of all graphics produced by all applications running on the machine. The root object is the desktop, which can simply be a structural object, or it can contain graphics of its own, such as a background image. Attached to the root object are zero or more top-level windows, each of which, in turn, can contain zero or more child windows, and so on. This tree is organized to draw to one or more surfaces. At least one surface MUST be created to represent the entire desktop.

In a noncomposed desktop, all windows and the desktop itself draw directly to the same one surface, according to information about the structure of the window tree and the properties of the windows. In a composed desktop, as specified in this protocol, each top-level window has its own dedicated surface. All windows in the subtree rooted at a particular top-level window draw to that top-level window's surface. A composition engine then combines all top-level window surfaces and any graphical contents belonging to the desktop itself to rasterize the surface representing the entire desktop. In that case, the desktop is represented by a scene graph containing all window surfaces and any extra graphical elements needed to draw the desktop. The topology of this scene graph is not necessarily the same as that of the window tree. For example, the server MAY<8> decorate each top-level window with an additional set of graphical elements that provide window-management functionality.

Each window surface is represented by a sprite resource, which MAY be targeted by a set of immediate-mode drawing primitives as specified in Remote Desktop Protocol: Graphics Devices Interfaces (GDI) Acceleration Extension [MS-RDPEGDI] and Remote Desktop Protocol: Desktop Composition Virtual Channel Extension [MS-RDPEDC], or it MAY be targeted by its own scene graph as specified by this protocol. The sprite resource is referenced by a window node resource, which is a special type of visual resource, and therefore can be inserted in larger tree of visuals representing the desktop. The window node resource references a numerical identifier representing the window. Any 64-bit value is valid for this purpose<9> as long as each value is used only by a single window node at any given time. In addition, window nodes can use zero as the window identifier. This is useful for representing sprites that are not associated with windows.<10>