/******************************************************************************
  main.c

  This file contains the mainline for tutorial three.  It draws a simple
  window onto the screen. 

  Uses the following procedures:
	init		located in the file init.c
	open_window	located in the file open_window.c

  SOURCE REFERENCES:
	Nye, A (1990)  The definitive guides to the X window system
		(Vol 2): Xlib Programming Manual for Version 11.  O'Reilly
		and Associates, Inc.: Sebastopol.

******************************************************************************/

#include "mainheader.h"			/* header file for declarations. */

main (argc, argv)
int argc;
char **argv;
{

/*-----------------------------------------------------------------------------
	DECLARATIIONS
-----------------------------------------------------------------------------*/

int                     x 	= 200;	/* x top left corner of window */
int                     y 	= 150;	/* y top left corner of window */
unsigned int            width 	= 850;	/* width of the window */
unsigned int            height 	= 700;	/* height of the window */

Display			*myDisplay;		/* pointer to the display */
int			myScreen;		/* screen we are using */
int 			myDepth;		/* colour plane depth */
Window			myWindow;		/* Window to display */

/*-----------------------------------------------------------------------------
	INITIALIZE VARIABLES	
-----------------------------------------------------------------------------*/

	init(&myDisplay,&myScreen,&myDepth);

/*-----------------------------------------------------------------------------
	OPEN UP A WINDOW
-----------------------------------------------------------------------------*/

	myWindow = open_window(myDisplay,myScreen,myDepth,
				x, y, width, height);

/*-----------------------------------------------------------------------------
	SLEEP FOR 10 SECONDS
-----------------------------------------------------------------------------*/

	sleep(10);

/*-----------------------------------------------------------------------------
	DESTROY ALL WINDOWS

  FOR MORE INFORMATION SEE:
	XDestroyWindow		p. 137 and man XDestroyWindow (3X11)
	XCloseDisplay		p. 89 and man XCloseDisplay (3X11)
-----------------------------------------------------------------------------*/

	XDestroyWindow (myDisplay, myWindow);
	XCloseDisplay (myDisplay);

/* EXIT */

	exit (0);

}

/*****************************************************************************
	END OF FILE MAIN.C
*****************************************************************************/
