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

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

  Icon icon;
  char *name;
  int Ncolors;

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

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

  FlushDisplay ();
  XSetWindowBackground (graphic.display, graphic.window, graphic.back);

  SetNormalHints ();
  SetWMHints (&icon);

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

  graphic.color = KapaX11colors (graphic.display, graphic.colormap, graphic.fore, &Ncolors);
  if (MAP_WINDOW) MapWindow (graphic);
  return;
}
