Clipping regions on windows and Expose Xevents issue

Ann & Jason Edmeades us at edmeades.me.uk
Wed Mar 12 18:10:15 CDT 2008


Hello, I've been investigating defect 11562, and would appreciate some
thoughts on how to move forward...

Basically the application creates a new visible window (eg at 0,0 - 200,50)
and then draws in it by:
1. BeginPaint - This sets up the cliprgn to the whole window
2. Works out some sizes...
3. MoveWindow - This moves the window to an appropriate place on the screen
4. FillRect (DrawText, EndPaint) to empty the window... From this call (and
all follow on ones) nothing is written to the window because although the
visible region is correctly calculated, the clip region was not updated by
the MoveWindow call.

This highlights 2 problems..

1. MoveWindow doesn't update the DCEx clip_region region, and hence when the
visible region changes, it is merged with the clip region and since there is
no overlap the visible region is empty so all subsequent processing ends.

Q: Whats the best way to handle that - I was tempted to reset the
clip_region to the visible_region (as MSDN sort of implies - you cant really
query them so tests don't help much here) in a movewindow call

2. I then hacked MoveWindow to do nothing, so I could progress...

What I see then is the popup is drawn, emptied and framed etc, and THEN
overwritten with grey. Debugging this shows the application does not respond
to WM_PAINT calls for the popup window - ie its drawn once and once only.
You can see this on windows if you alt+tab to a covering window, and then
back again. HOWEVER, on windows the popup does display correctly the once

Investigating the cause, all is ok until the 
trace:event:process_events Expose for hwnd/window 0xd50026/220002c
This drives the 
trace:win:RedrawWindow 0xd50026 rect (0,0)-(250,50) flags: RDW_INVALIDATE
RDW_ERASE RDW_ALLCHILDREN
and *bang*, all the drawing which has been done is lost

Q: This is getting way outside my understanding of X events, but shouldn't
the Expose event for the child (popup) window be processed before returning
from CreateWindow with style WS_VISIBLE?

All suggestions welcome - I don't mind writing tests etc but would like to
try to come up with a solution for the problem as well!

Jason





More information about the wine-devel mailing list