If a window is obscured and then subsequently uncovered it is the clients responsibility to do any repainting which may be needed. X merely sends the correct event type and then leaves it to the application to decide what to do about it. The usual solution is to have a subroutine for redrawing the window which is called whenever the expose events are delivered.
No drawing happens until the first expose event arrives. Ensure that all windows receiving events appear on screen after events have been selected but before events happen. Otherwise the first expose event might be missed.