New X

by havoc

The freedesktop.org X hacking is
low-profile unstableware at the moment, but one particular proposal
interests me the most. Here is how I understand it, I’ll probably get
it wrong:

The idea is to make the X server model-view. The server stores a tree
of windows as it does now. However, unlike today, it keeps the full
contents of each mapped window in memory at all times. For each
window, the default view copies the window’s contents over the
contents of the parent window. This results in the same user-visible
display you have today – but you could implement alpha blended windows
by alpha compositing rather than copying each window into its parent,
since we now have the parent window’s contents.

To this we add the ability for a “compositing manager” to
replace the default view for a given window, using the aXe and XDamage
extensions. The window manager might be the compositing manager for
toplevel windows, for example.

If a window has a compositing manager, it will not be
composited into its parent automatically; the window is invisible
until the compositing manager does something. An external compositing
manager could emulate the default built-in compositing manager by
using XCopyArea() (or alpha-aware equivalent) to copy windows into
their parents.

However, a more exciting compositing manager might apply
embellishments/transformations to the window contents prior to drawing
them, possibly drawing them using an API such as OpenGL. For example,
you could add drop shadows. Or you could
do effects similar to fast
user switching
or Expose. Or
you could double-buffer the entire screen as a whole making
workspace-switching, opaque resize, and other tasks flicker free. The
compositing manager is rendering a scene in which the window contents
are one element, so the possibilities are endless.

Note that the window contents stay entirely on the server side, the
compositing manager uses regular X protocol requests to manipulate
them.

Apps other than the single compositing manager can also use the damage
extension; possible applications include VNC (desktop sharing),
magnifiers, pagers with thumbnailing, and so forth. The compositing
manager is a special kind of view in that it disables the default
paint of the window to its parent, and is thus responsible for
replacing that default paint. But there can be any number of
extra views of a window.

There are a lot of little complexities and open questions here, but
the idea is pretty interesting. I’m waiting for something I can try
out to appear in jhbuild so I
can make metacity super-leet.

(This post was originally found at http://log.ometer.com/2003-11.html#3)

My Twitter account is @havocp.
Interested in becoming a better software developer? Sign up for my email list and I'll let you know when I write something new.