Hi,
 
I've just committed the initial code for an -onPaint event handler for windows. This allows you full control when painting a window. In many cases the current Graphic control is adequate, but for more complicated problems (for example child windows with scroll bars) more control is needed. The event handler calls the windows API BeginPaint and EndPaint, so other than the logic to paint the window no other action is required.
 
The main work is done in GUI_MessageLoops.cpp - but should it be done in Window.xs?
 
We (Glenn and I) have been doing some playing/testing and it seems to work well. We also have had some discussions to what should be passed as parameters to the hander. Currently the parameters that are passed are the window and the DC. The DC parameter could potentially removed, since in almost all cases the window DC and the DC to be painted are always the same (the only exception seems to be when the -noflicker option is used). The bounding rectangle of the area to be redrawn could also be passed. In most cases this bounding rectangle is not required since in typical usage you repaint the entire window (by a BitBlt), the clipping region is created automatically before the event is called.  
 
Usage:
 
  -onPaint => \&Paint,
  
  sub Paint {
    my ($win,$dc)=@_;
    #paint into the passed DC
    }
 
Comments?
 
Cheers,
 
jez.