Figuring out the terms used in the documentation

Adam Jackson ajax at nwnk.net
Fri Jun 5 19:18:57 UTC 2020


On Thu, 2020-06-04 at 08:23 -0300, Sleep wrote:
>  From the Xlib - C Language X Interface: "For each screen of the 
> display, there may be a list of valid visual types supported at 
> different depths of the screen."
> 
> Alright this is confusing me, this implies that one screen can handle 
> windows with 8, 16, 24, 32 bits color depth at the same time and show 
> the colors correctly.

Yes, that is exactly what it means. In fact this is routine, with
Composite active you will have a depth-32 visual in addition to depth-
24. Some workstation graphics will support both depth-8 pseudocolor
visuals and depth-32 truecolor.

> Is the color depth defined by the Visual or Screen? If Visual, does
> that mean that the same Screen can handle windows of different color
> depth or is that not possible because the root window being the
> parent of all windows on a Screen, enforces a certain color depth to
> be used?

A screen is just a root window, and any window (root or not) has
exactly one Visual associated with it. A window may have a different
visual from its parent, and if it does then some of the things the
protocol would otherwise guarantee are undefined (setting the window
background to None, for instance). There is no requirement that the
child's visual have less-than-or-equal depth of its parent. The depth
of the root window itself is in some sense the "default" depth for the
screen, since most toolkits will default to that visual.

So to answer your question: the depth is defined by the visual, a
screen may support multiple visuals of different depths, the depth of
the root window's visual does not limit the depth of any other visual.

- ajax



More information about the xorg mailing list