12.07.2015 Views

Xlib − C Language X Interface

Xlib − C Language X Interface

Xlib − C Language X Interface

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Xlib</strong> − C LibraryX11, Release 6.7 DRAFTChapter 3Window FunctionsIn the X Window System, a window isarectangular area on the screen that lets you view graphicoutput. Client applications can display overlapping and nested windows on one or more screensthat are driven byXservers on one or more machines. Clients who want to create windows mustfirst connect their program to the X server by calling XOpenDisplay. This chapter begins with adiscussion of visual types and window attributes. The chapter continues with a discussion of the<strong>Xlib</strong> functions you can use to:• Create windows• Destroy windows• Map windows• Unmap windows• Configure windows• Change window stacking order• Change window attributesThis chapter also identifies the window actions that may generate events.Note that it is vital that your application conform to the established conventions for communicatingwith window managers for it to work well with the various window managers in use (see section14.1). Toolkits generally adhere to these conventions for you, relieving you of the burden.Toolkits also often supersede many functions in this chapter with versions of their own. For moreinformation, refer to the documentation for the toolkit that you are using.3.1. Visual TypesOn some display hardware, it may be possible to deal with color resources in more than one way.For example, you may be able to deal with a screen of either 12-bit depth with arbitrary mappingof pixel to color (pseudo-color) or 24-bit depth with 8 bits of the pixel dedicated to each of red,green, and blue. These different ways of dealing with the visual aspects of the screen are calledvisuals. For each screen of the display, there may be a list of valid visual types supported at differentdepths of the screen. Because default windows and visual types are defined for eachscreen, most simple applications need not deal with this complexity. <strong>Xlib</strong> provides macros andfunctions that return the default root window, the default depth of the default root window, andthe default visual type (see sections 2.2.1 and 16.7).<strong>Xlib</strong> uses an opaque Visual structure that contains information about the possible color mapping.The visual utility functions (see section 16.7) use an XVisualInfo structure to return this informationto an application. The members of this structure pertinent to this discussion are class,red_mask, green_mask, blue_mask, bits_per_rgb, and colormap_size. The class member specifiesone of the possible visual classes of the screen and can be StaticGray, StaticColor, True-Color, GrayScale, PseudoColor, or DirectColor.The following concepts may serve tomake the explanation of visual types clearer. The screencan be color or grayscale, can have a colormap that is writable or read-only, and can also have acolormap whose indices are decomposed into separate RGB pieces, provided one is not on a31

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!