This is a short description of the current (Unity 7) Ubuntu Desktop structure.
To begin with, the Ubuntu desktop consists of three main programs (nux, compiz and unity) that interact with a fourth one: the well known X server.
Let’s see what’s their role in the desktop:
1. Xserver, window management and event handling:
Almost every unix-based system uses the X window system to present the windows to the user and perform the event handling (which is the handling of mouse events like the mouse “clicks”, the keyboard events like the typing of a letter and other devices or window events).
The X window system consists by the X server and its client programs. These programs are called X clients because they communicate and exchange requests with the X server using the X protocol (by linking either the X library known as Xlib or more recently the xcb).
The special X client that can “manage” the windows of the other X clients is called the window manager of the desktop. The window manager can control the placement or the appearance (decorations) of the windows by using a technique called reparenting, in which the window manager registers with the Xserver to be notified when a top-level window is mapped (attempts to become visible). When such an event is generated, the window manager creates a frame window and in most cases also a title bar window. The frame window then becomes the parent of both the main window and the title bar window. Other forms of decorations, such as buttons, window title, etc., may also be created; these would normally be parented by the title bar window. The purpose of re-parenting is to allow the window manager to have the control of the parent frames in order to maximize, close, minimize etc the windows without having to handle each child window independently. In re-parenting, all children-windows (that have the content of the X client programs) follow their parent windows (frames) actions.
You can find more technical texts, extended documentation and references in the X.Org Foundation page: http://www.x.org/wiki/ as well as in wikipedia: https://en.wikipedia.org/wiki/Re-parenting_window_manager
2. Compiz, compositing, window management, accessibility, event handling:
Compiz is the compositor or the compositing window manager of the desktop. A compositing window manager is a special type of window manager that provides an off-screen buffer (image, drawing surface) to each window and composites these window buffers into an image representing the screen before it writes the result into the display memory. Compositing window managers may perform additional processing on buffered windows, applying 2D and 3D animated effects such as blending, fading, scaling, rotation, duplication, bending and contortion, shuffling, blurring, redirecting applications, and translating windows into one of a number of displays and virtual desktops. Computer graphics technology allows for visual effects to be rendered in real time such as drop shadows, live previews, and complex animation. Since the screen is double buffered, it does not flicker during updates.(https://en.wikipedia.org/wiki/Compositing_window_manager).
Compiz uses a plugin system with hookable overridable functions. It consists of some main (or base) plugins (eg. compositing, opengl) that are necessary for rendering, compositing, event handling and other basic functions and some extras, which are plugins that override the main plugin functions in order to implement visual effects, accessibility features etc.
That plugin system design has many advantages for the developers and the users.
Advantages for the developers:
- Base plugin classes provide a variety of overridable functions for different purposes and the developer can choose to enable and fill only the necessary ones for his plugin to function.
- Each feature is implemented as a separate plugin without having to modify the existing codebase. This makes debugging easier.
As for the users:
- They can personalize their desktop from absolutely minimal to very spectacular using the ccsm (compiz-config-settings-manager): http://wiki.compiz.org/CCSM
- They have a variety of features, customizations and effects
Compiz was originally written in C by David Reveman but it had many other contributors as well. The version of Compiz that is currently used in the official Ubuntu DE is a C++ port of the original. The top contributor of the C++ compiz during the port was Sam Spilsbury. You can find information about the other developers in the header files, bzr blame list and wikipedia: https://en.wikipedia.org/wiki/Compiz
Unity is the compiz plugin that is responsible for the user experience of the Ubuntu DE. It consists of six main components and many other smaller ones:
- Top menu bar (contains the active application menubar, the capture bar of the current application main window, buttons, the session menu, the global system settings, the logout, shutdown and other controls and some notification indicators for time, weather, system state etc)
- Launcher (a dock that serves as a window switcher)
- Quicklist (accessible menu of launcher items)
- Dash (overlay layer that allows the user to search quickly for information eg: files, installed apps, bookmarks etc)
- Head-up Display (allows hotkey searching for top menu bar items)
- Indicators (a notifications area that contains displays for the clock, network, status, sound volume etc)
More information: https://en.wikipedia.org/wiki/Unity_%28user_interface%29
Nux is the Unity (unityshell) plugin graphics toolkit. It is a powerful OpenGL 3D graphics engine that is responsible for the real-time graphics of the desktop (reflections, transparency, animations, glow etc). It was originally written by Jay Taoko and today it is maintained by a small team of Canonical employees.
Here you can find a short introduction to Nux: https://wiki.ubuntu.com/MeetingLogs/devweek1107/GraphicsWithNUX