Shape extension
Encyclopedia
In the X Window System
X Window System
The X window system is a computer software system and network protocol that provides a basis for graphical user interfaces and rich input device capability for networked computers...

, the X Nonrectangular Window Shape Extension allows window
Window (computing)
In computing, a window is a visual area containing some kind of user interface. It usually has a rectangular shape that can overlap with the area of other windows...

s to be given arbitrary, non-rectangular shapes.

Two well-known applets that use the shape extension are oclock, which is a simple round analog clock, and xeyes
Xeyes
xeyes is a graphical computer program showing two googly eyes which follow the cursor movements on the screen as if they were watching it. According to the X Window System manual page, it was initially written by Jeremy Huxtable for the NeWS system and presented at the SIGGRAPH conference in 1988....

, which shows two googly eyes
Googly eyes
Googly eyes or wiggly eyes are small plastic craft supplies used to imitate eyeballs. Googly eyes traditionally are composed of a clear, hard-plastic shell, with a smaller, black plastic disk trapped within. The plastic shells come in a variety of sizes ranging from 3/16" to over 3" diameter...

 that follow the cursor
Cursor (computers)
In computing, a cursor is an indicator used to show the position on a computer monitor or other display device that will respond to input from a text input or pointing device. The flashing text cursor may be referred to as a caret in some cases...

 on the screen as if they were watching it. Most X Window systems have one or the other (or both) in their standard installations. In addition, some window manager
X window manager
An X window manager is a window manager which runs on top of the X Window System, a windowing system mainly used on Unix-like systems.Unlike the Mac OS and Microsoft Windows platforms which have historically provided a vendor-controlled, fixed set of ways to control how windows and panes display...

s use the shape extension to draw non-rectangular icons.

Implementation

Applications can only create rectangular windows, but can then change their
shape to be an arbitrary part of the original rectangle. The remaining area of
the rectangle is not only transparent (shows what is below the window); rather,
it is not part of the window at all. For example, if a window is shaped with a hole in the middle, not only the hole shows what is below the window, but a click in the hole is considered to be a click in what is below the window.
Applications create windows as usual (specifying width and height), but can then change the shape of a window to be a subset of the original area.
by sending the X server either a list of rectangles or a pixmap of color depth
Color depth
In computer graphics, color depth or bit depth is the number of bits used to represent the color of a single pixel in a bitmapped image or video frame buffer. This concept is also known as bits per pixel , particularly when specified along with the number of bits used...

one (a black-and-white pixmap). More precisely, a client can request the rectangles or the pixmap to be set as the new shape, but also to be combined in various ways (e.g., intersected or added) with the old shape. A third way for changing the shape of a window is by using the current shape of a window or a part of it.

The extension allows defining the shape of two separate regions: the clipping and the bounding regions. These two areas are defined even for windows not using the shape extension: the clipping region is the area that can be used for drawing, the bounding region is the total area covered by the window (that is, the clipping region plus the border). The shape extension allows defining two independent shapes for these two regions.

Both the clipping and bounding are associated, in the shape extension, two areas: a default rectangular region and a possibly non-rectangular client region, defined and changed by the client as specified above. The effective region, which is the actual shape of the window, is the intersection of these two areas. This intersection is performed every time either region is changed: for example, if the client regions contains parts that are outside the default region but the default region is then enlarged, the effective region will include these parts.

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK