After the previous section we now know how to create a window, but alas, we still do not have anything on our screen. However, before we can display the window we need to provide some hints about it to the window manager. These are defined in the following structure
typedef struct {
long flags;
int x, y; /* Obsolete in rel 4 */
int width, height; /* Obsolete in rel 4 */
int min_width, min_height;
int max_width, max_height;
int width_inc, height_inc;
struct {
int x; /* Numerator */
int y; /* Denominator */
} min_aspect, max_aspect;
int base_width, base_height; /* New in rel 4 */
int win_gravity; /* New in rel 4 */
} XSizeHints;
As with XSetAttributes there is a mask, this time stored
inside the structure in the field flags. Some of the more
interesting flags and there meaning are listed below.
USPosition - user specified x, y
USSize - user specified width, height
PPosition - program specified position
PSize - program specified size
PMinSize - min size
PMaxSize - max size
PAspect - min and max aspect ratios
Display * display;
Window window;
XSizeHints hints;
XSetWMNormalHints(display, window, &hints);
The only other thing we may wish to initialise before we actually display the window is the window's name. This name may be displayed by the window manager in the windows title bar. To set the window name we use the XStoreName function
Display * display;
Window window;
char window_name [ ];
XStoreName (display, window, window_name);
Display * display;
Window window;
XMapWindow(display, window);
XMapRaised(display,window);
As X caches everything for us, to be sure that the window is displayed we must flush the cache. We do this with a call to XFlush(display);