+ /* Check which frames are still visisble, if we have enqueued any user
+ events or been notified of events that may affect visibility. We
+ do this here because there doesn't seem to be any direct
+ notification from Windows that the visibility of a window has
+ changed (at least, not in all cases). */
+ if (count > 0 || check_visibility)
+ {
+ Lisp_Object tail, frame;
+
+ FOR_EACH_FRAME (tail, frame)
+ {
+ FRAME_PTR f = XFRAME (frame);
+ /* Check "visible" frames and mark each as obscured or not.
+ Note that async_visible is nonzero for unobscured and
+ obscured frames, but zero for hidden and iconified frames. */
+ if (FRAME_W32_P (f) && f->async_visible)
+ {
+ RECT clipbox;
+ HDC hdc = get_frame_dc (f);
+ GetClipBox (hdc, &clipbox);
+ release_frame_dc (f, hdc);
+
+ if (clipbox.right == clipbox.left
+ || clipbox.bottom == clipbox.top)
+ {
+ /* Frame has become completely obscured so mark as
+ such (we do this by setting async_visible to 2 so
+ that FRAME_VISIBLE_P is still true, but redisplay
+ will skip it). */
+ f->async_visible = 2;
+
+ if (!FRAME_OBSCURED_P (f))
+ {
+ DebPrint (("frame %04x (%s) obscured\n", f,
+ XSTRING (f->name)->data));
+ }
+ }
+ else
+ {
+ /* Frame is not obscured, so mark it as such. */
+ f->async_visible = 1;
+
+ if (FRAME_OBSCURED_P (f))
+ {
+ SET_FRAME_GARBAGED (f);
+ DebPrint (("frame %04x (%s) reexposed\n", f,
+ XSTRING (f->name)->data));
+
+ /* Force a redisplay sooner or later. */
+ record_asynch_buffer_change ();
+ }
+ }
+ }
+ }
+ }
+