Hello all. I'm new in xlib programming and i have a question. I have a line, wich position and length depends on window size. When i didn't use ResizeRedirectMask and calculated it dynamically, it worked fine, but when i added it, everything went wrong. When it is resized it shows good only its basic width and height.

Here is screenshot:http://i44.tinypic.com/i354ia.jpg (93kb)

Here is a code

Code:
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
 Display * display;  
 int ScreenNumber; 
 GC gc;				
 XEvent report;
 Window window;

 if ( ( display = XOpenDisplay ( NULL ) ) == NULL ) {
  puts ("Can not connect to the X server!\n");
  exit ( 1 );
 }
 ScreenNumber = DefaultScreen ( display );
 window = XCreateSimpleWindow ( display,
     RootWindow ( display, ScreenNumber ),
     0, 0, 200, 200, 5,
     BlackPixel ( display, ScreenNumber ),
     WhitePixel ( display, ScreenNumber ) );

 XSelectInput ( display, window, ExposureMask | ResizeRedirectMask);/*resizemask*/

 XMapWindow ( display, window );


gc = XCreateGC ( display, window, 0 , NULL );
XSetForeground ( display, gc, BlackPixel ( display, 0) );
XSetBackground ( display, gc, WhitePixel ( display, 0) );

int ww=0, wh=0;/* for current width and height */

XWindowAttributes* point_win_geometry;
XWindowAttributes win_geometry;
point_win_geometry = &win_geometry;

XGetWindowAttributes(display, window ,point_win_geometry);
ww=win_geometry.width;
wh=win_geometry.height;

XResizeWindow(display, window, 400, 400);
XClearWindow(display, window); 

while(1) {
	
	XClearWindow(display, window); 
	XDrawLine( display, window, gc, 30, 30, (ww-30), (wh-30) );
	XFlush(display);

	if(XPending(display)>=0){
		XNextEvent ( display, &report );
		switch ( report.type ) {
		case Expose :
			if ( report.xexpose.count != 0 ) break;
			break;

		case ResizeRequest:
			ww = report.xresizerequest.width;
			wh = report.xresizerequest.height;
			break;
		}
	}
}
}
Does anyone know, how to make it use full window area?

Thanks