# HG changeset patch # User Jim Blandy # Date 723680250 0 # Node ID fd573317f46818d4eb5f7c616a3bc8559638d4ff # Parent 93497cd89204a4a1418378ad00a6fa7d5cb7bc82 * frame.h (struct frame): New fields called async_visible and async_iconified. (FRAME_SAMPLE_VISIBILITY): New macro, with MULTI_FRAME and non-MULTI_FRAME definitions. diff -r 93497cd89204 -r fd573317f468 src/frame.h --- a/src/frame.h Sun Dec 06 22:16:57 1992 +0000 +++ b/src/frame.h Sun Dec 06 22:17:30 1992 +0000 @@ -116,14 +116,35 @@ /* Nonzero if last attempt at redisplay on this frame was preempted. */ char display_preempted; - /* Nonzero if frame is currently displayed. */ - char visible; + /* visible is nonzero if the frame is currently displayed; we check + it to see if we should bother updating the frame's contents. + + iconified is nonzero if the frame is currently iconified. + + Asynchronous input handlers should NOT change these directly; + instead, they should change async_visible or async_iconified, and + let the FRAME_SAMPLE_VISIBILITY macro set visible and iconified + at the next redisplay. - /* Nonzero if window is currently iconified. - This and visible are mutually exclusive. */ - char iconified; + These should probably be considered read-only by everyone except + FRAME_SAMPLE_VISIBILITY. + + This two are mutually exclusive. They might both be zero, if the + frame has been made invisible without an icon. */ + char visible, iconified; + + /* Asynchronous input handlers change these, and + FRAME_SAMPLE_VISIBILITY copies them into visible and iconified. + See FRAME_SAMPLE_VISIBILITY, below. */ +#ifdef __STDC__ + volatile +#endif + char async_visible, async_iconified; /* Nonzero if this frame should be redrawn. */ +#ifdef __STDC__ + volatile +#endif char garbaged; /* True if frame actually has a minibuffer window on it. @@ -200,6 +221,27 @@ #define FRAME_SCROLL_BOTTOM_VPOS(f) (f)->scroll_bottom_vpos #define FRAME_FOCUS_FRAME(f) (f)->focus_frame +/* Emacs's redisplay code could become confused if a frame's + visibility changes at arbitrary times. For example, if a frame is + visible while the desired glyphs are being built, but becomes + invisible before they are updated, then some rows of the + desired_glyphs will be left marked as enabled after redisplay is + complete, which should never happen. The next time the frame + becomes visible, redisplay will probably barf. + + Currently, there are no similar situations involving iconified, but + the principle is the same. + + So instead of having asynchronous input handlers directly set and + clear the frame's visibility and iconification flags, they just set + the async_visible and async_iconified flags; the redisplay code + calls the FRAME_SAMPLE_VISIBILITY macro before doing any redisplay, + which sets visible and iconified from their asynchronous + counterparts. */ +#define FRAME_SAMPLE_VISIBILITY(f) \ + ((f)->visible = (f)->async_visible, \ + (f)->iconified = (f)->async_iconified) + #define CHECK_FRAME(x, i) \ { \ if (! FRAMEP (x)) \ @@ -303,6 +345,9 @@ #define FRAME_SCROLL_BOTTOM_VPOS(f) (the_only_frame.scroll_bottom_vpos) #define FRAME_FOCUS_FRAME(f) (0) +/* See comments in definition above. */ +#define FRAME_SAMPLE_VISIBILITY(f) (0) + #define CHECK_FRAME(x, i) do; while (0) #define CHECK_LIVE_FRAME(x, y) do; while (0)