next up previous contents
Next: Property Lists Up: Working with other clients Previous: Working with other clients

Naming windows and defining icons

XStoreName(display,w, name) /* assign a name to a window */
    char *name;          /* name: a null-terminated string      */

Status XFetchName(display,w, name) /* find a window's name */
    char **name;         /* RETURN a pointer to the name array  */

XSetIconName(display,w,icon_name) /* set name used on icon */
    icon_name *char;

Status XGetIconName(display,w,icon_name) /* get name used on icon */
    icon_name **char;   /*RETURN*/
To set groups of properties there are 2 structures:-

typedef struct{
long flags; /*InputHint,StateHint,IconPixmapHint,IconWindowHint,
            IconPositionHint,IconMaskHint, WindowGroupHint, AllHints */
Bool input;           /* does this application rely on the window manager
                         to get keyboard input ? */
int initial_state; /*NormalState,ZoomState,IconicState,InactiveState,DontCareState*/
Pixmap icon_pixmap;
Window icon_window;   /* window to be used as icon */
int icon_x, icon_y;   /*initial icon position*/
Pixmap icon_mask;
XID window_group;     /* windows can be grouped so that, for example,
                         they could all be de-iconified at once */
} XWMHints;

typedef struct {
  long flags;    /* which fields are defined. Possibilities are
                 USPosition, USSize, PPosition, Psize, PMinSize
                 PMaxSize, PResizeInc, PAspect, PAllHints */
  int x,y;
  int width, height;
  int min_width, max_width;
  int min_height, max_height;
  int width_inc, height_inc;
  struct {
         int x; /* numerator   */
         int y; /* demoninator */
  } min_aspect, max_aspect;
} XSizeHints;
Control over the step size of the increment is useful if, say, you want to allow change of a text window by units of a character cell.

These structures are used in these routines:-

void XSetNormalHints(display, w, hints)
     Display *display;
     Window  w;
     XSizeHints *hints;

void XGetNormalHints(display, w, hints)
     Display *display;
     Window  w;
     XSizeHints *hints;  /* RETURNED*/

char *window_name, *icon_name;
Pixmap icon_pixmap;
char **argv;             /* the command line to start the application*/   
int  argc;               
XSizeHints *hints;

XWMHints *wmhints;

XWMHints *XGetWMHints(display,w,wmhints)
XWMHints *wmhints;
If you set maximum size, minimum size and original size to be all the same, and the window manager takes your hints, then your window will be of fixed size.

Tim Love
Mon Mar 11 17:03:18 GMT 1996