Window Systems Software
Window systems allow several applications to display information
simultaneously, and receive the "appropriate" keyboard and mouse input.
A window system is a server, which offers the following services:
- It lets applications create windows, and assigns an area in its memory to
each window.
Applications can request a certain window position and size (but that
request may be denied or silently altered).
Applications can ask the system about their window position and size.
For the most part they only need to know the window size.
- When a window gets obscured (lowered) and exposed (raised) again,
the window system can redraw the window from memory.
This is called backing store.
Not all window systems offer backing store.
Therefore an application should be prepared to redraw a window with
identical content as before.
- Applications call a method to paint pixels within that window.
Applications do not write in the "window's" memory directly, but pass the
data to a function of the window system.
- Applications call a method to draw strings (in a requested font)
at certain positions (and in a requested direction).
- To speed up some common operations, the window system offers some
drawing operations so the application does not have to calculate the
pixels to paint. Examples are drawing lines, rectangles and circles.
To the application programmer it may not be clear which operations are
carried out by the window system and which by the application:
every window system offers a library of functions, each of which may
either calculate the pixels to draw or ask the server to do this.
- The window system determines which application should receive keyboard
and mouse input. That application is said to have the focus.
(This is not always the window to which the "mouse
cursor" is pointing at.)
- Applications call a method to request the "mouse cursor" to change
shape.
This shape is only shown when the application has the focus.
- A window system offers a lot of application-level functionality through
a library of data structures and methods. The library is used to prepare
the contents of windows before asking the system to show the new contents.
Such a library is sometimes also called a window toolkit.
When images are first prepared in an off-screen "bitmap" and copied to the
screen later, this is called double buffering.
It is useful to avoid flicker which may occur through interference between
the rate at which the application generates new images and the rate at
which the graphics board refreshes the screen.