The window attributes control a window’s background and border pattern or color, the events that should be queued for it, and so on. This chapter describes how to set and get window attributes and provides a detailed description of each attribute. Everyone should read this chapter.
Now that you know the basic X concepts and you have seen the code for an X application, we can go back and start to describe various aspects of Xlib in full detail. This chapter describes the window attributes thoroughly. The window attributes were introduced in 2.2.1 Window Characteristics and described in more detail in 2.4.1 Window Attributes. You should read those sections before proceeding.
The setting of window attributes becomes necessary when you use
XCreateWindow()
instead of the simpler
XCreateSimpleWindow()
. However, it is not essential
that you set any window attributes other than the window background and
border. Therefore, this chapter is mainly about optional features that you
may find useful.
You will continue to find this chapter useful as a reference even when you are an experienced X programmer. A useful quick reference to the window attributes is also provided inside the back cover of Volume Two, Xlib Reference Manual.
Window attributes can be set while creating a window with
XCreateWindow()
or afterward with a call to
XChangeWindowAttributes()
. When creating a window
with XCreateSimpleWindow()
, most of the attributes
are inherited from the parent. There are also several routines for
changing individual window attributes, including the
event_mask
, background and border.
The procedure for setting the attributes is the same with
XCreateWindow()
or
XChangeWindowAttributes()
. You set the members of an
XSetWindowAttributes
structure to the desired values,
create a mask indicating which members you have set, and call the
routine to create the window or change the attributes.
Get XLIB Programming Manual, Rel. 5, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.