Path: utzoo!utgpu!watmath!clyde!att!rutgers!mit-eddie!bloom-beacon!earth.cray.COM!jlf
From: jlf@earth.cray.COM (John Freeman)
Newsgroups: comp.windows.x
Subject: Changing a window's color
Message-ID: <8812021917.AA10359@thelake.cray.com>
Date: 2 Dec 88 19:17:52 GMT
Sender: daemon@bloom-beacon.MIT.EDU
Organization: The Internet
Lines: 39

I want to change the color of an existing window.
Why doesn't this program do that?
I know it's not good form to hard code a background color,
it's just there for simplicity.

--------------------------------------------------------------------------------
#include 
#include 
#include 
main(argc, argv)
int argc;
char **argv;
{
	char *getenv(), *windowid;
	Window w;
	Display *d;

	/* find what window we're in */
	windowid = getenv("WINDOWID");
	if(!windowid)	{
		fprintf(stderr, "No window ID\n");
		exit(1);
	}
	w = atoi(windowid);

/*
 *	Open Display, get defaults
 */
	d = XOpenDisplay(NULL);
	if (d == NULL)  {
		fprintf(stderr, "Could not open Display\n");
		exit(1);
	}

printf(" d = %#x, w = %#x\n", d,w);
	XSetWindowBackground(d, w, 4);
	XClearWindow(d,w);
	XSync(d,0);
}