3.3 Creating Windows
Xlib provides basic ways for creating windows,
and toolkits often supply higher-level functions specifically for
creating and placing top-level windows,
which are discussed in the appropriate toolkit documentation.
If you do not use a toolkit, however,
you must provide some standard information or hints for the window
manager by using the
Xlib inter-client communication functions.
If you use Xlib to create your own top-level windows
(direct children of the root window),
you must observe the following rules so that all applications interact
reasonably across the different styles of window management:
-
You must never fight with the window manager for the size or
placement of your top-level window.
-
You must be able to deal with whatever size window you get,
even if this means that your application just prints a message
like ``Please make me bigger'' in its window.
-
You should only attempt to resize or move top-level windows in
direct response to a user request.
If a request to change the size of a top-level window fails,
you must be prepared to live with what you get.
You are free to resize or move the children of top-level
windows as necessary.
(Toolkits often have facilities for automatic relayout.)
-
If you do not use a toolkit that automatically sets standard window properties,
you should set these properties for top-level windows before mapping them.
For further information,
see "Inter-Client Communication Functions" and the Inter-Client Communication Conventions Manual.
XCreateWindow()
is the more general function that allows you to set specific window attributes
when you create a window.
XCreateSimpleWindow()
creates a window that inherits its attributes from its parent window.
The X server acts as if
InputOnly
windows do not exist for
the purposes of graphics requests, exposure processing, and
VisibilityNotify
events.
An
InputOnly
window cannot be used as a
drawable (that is, as a source or destination for graphics requests).
InputOnly
and
InputOutput
windows act identically in other respects (properties,
grabs, input control, and so on).
Extension packages can define other classes of windows.
To create an unmapped window and set its window attributes, use
XCreateWindow().
To create an unmapped
InputOutput
subwindow of a given parent window, use
XCreateSimpleWindow().
Christophe Tronche, [email protected]