# include "Ximage.h"
# include "icons/icon.h"

/************** SetUpWindow *************/
void SetUpWindow (Graphic *graphic, int *argc, char **argv) {

  Icon icon;
  char *name;

  icon.width = icon_width;
  icon.height = icon_height;
  icon.bits = icon_bits;

  CheckGeometry (argc, argv, graphic);
  TopWindow (graphic, &icon);
  LoadFont (graphic, argc, argv, "fixed"); 

  XFlush (graphic[0].display);
  XSetWindowBackground (graphic[0].display, graphic[0].window, graphic[0].white);

  SetNormalHints (graphic);
  SetWMHints (graphic, &icon);

  if (NAME_WINDOW == NULL) {
    NameWindow (graphic, "Ki'i");
  } else {
    ALLOCATE (name, char, strlen(NAME_WINDOW) + 10);
    sprintf (name, "Ki'i %s", NAME_WINDOW);
    NameWindow (graphic, name);
    free (name);
  }

  if (MAP_WINDOW) MapWindow (graphic);
}
