summaryrefslogtreecommitdiff
path: root/src/frame.h
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2013-01-24 09:41:28 +0400
committerDmitry Antipov <dmantipov@yandex.ru>2013-01-24 09:41:28 +0400
commitedfa7fa092c303265edeb2a0b530463cdfe63ab7 (patch)
tree509264878099f61ea1290ca65f93401a1bdf9926 /src/frame.h
parent5ad86e34d86173f6495b38336d377de5b69da853 (diff)
Drop async_visible and async_iconified fields of struct frame.
This is possible because async input is gone; for details, see http://lists.gnu.org/archive/html/emacs-devel/2012-12/msg00734.html. * frame.h (struct frame): Remove async_visible and async_iconified members, convert garbaged to unsigned bitfield. Adjust comments. (FRAME_SAMPLE_VISIBILITY): Remove. Adjust all users. (SET_FRAME_VISIBLE, SET_FRAME_ICONIFIED): New macros. * frame.c, gtkutil.c, term.c, w32fns.c, window.c, xdisp.c: Consistently use SET_FRAME_VISIBLE, SET_FRAME_ICONIFIED, FRAME_VISIBLE_P and FRAME_ICONIFIED_P macros where appropriate. * w32term.c: Ditto. (w32_read_socket): Save iconified state to generate DEICONIFY_EVENT properly. Likewise for obscured. * xterm.c: Ditto. (handle_one_xevent): Save visible state go generate ICONIFY_EVENT properly. * nsterm.m: Ditto. (windowDidDeminiaturize): Generate DEICONIFY_EVENT.
Diffstat (limited to 'src/frame.h')
-rw-r--r--src/frame.h94
1 files changed, 29 insertions, 65 deletions
diff --git a/src/frame.h b/src/frame.h
index c2821066c8..c18b766207 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -353,46 +353,30 @@ struct frame
unsigned int external_menu_bar : 1;
#endif
- /* visible is nonzero if the frame is currently displayed; we check
+ /* Next two bitfields are mutually exclusive. They might both be
+ zero if the frame has been made invisible without an icon. */
+
+ /* Nonzero if the frame is currently displayed; we check
it to see if we should bother updating the frame's contents.
- DON'T SET IT DIRECTLY; instead, use FRAME_SET_VISIBLE.
Note that, since invisible frames aren't updated, whenever a
- frame becomes visible again, it must be marked as garbaged. The
- FRAME_SAMPLE_VISIBILITY macro takes care of this.
+ frame becomes visible again, it must be marked as garbaged.
On ttys and on Windows NT/9X, to avoid wasting effort updating
visible frames that are actually completely obscured by other
windows on the display, we bend the meaning of visible slightly:
- if greater than 1, then the frame is obscured - we still consider
+ if equal to 2, then the frame is obscured - we still consider
it to be "visible" as seen from lisp, but we don't bother
updating it. We must take care to garbage the frame when it
- ceases to be obscured though.
-
- 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.
-
- These should probably be considered read-only by everyone except
- FRAME_SAMPLE_VISIBILITY.
-
- These two are mutually exclusive. They might both be zero, if the
- frame has been made invisible without an icon. */
+ ceases to be obscured though. See SET_FRAME_VISIBLE below. */
unsigned visible : 2;
- unsigned iconified : 1;
-
- /* Let's not use bitfields for volatile variables. */
- /* Asynchronous input handlers change these, and
- FRAME_SAMPLE_VISIBILITY copies them into visible and iconified.
- See FRAME_SAMPLE_VISIBILITY, below. */
- volatile char async_visible, async_iconified;
+ /* Nonzero if the frame is currently iconified. Do not
+ set this directly, use SET_FRAME_ICONIFIED instead. */
+ unsigned iconified : 1;
/* Nonzero if this frame should be redrawn. */
- volatile char garbaged;
+ unsigned garbaged : 1;
/* True if frame actually has a minibuffer window on it.
0 if using a minibuffer window that isn't on this frame. */
@@ -711,7 +695,7 @@ typedef struct frame *FRAME_PTR;
#else
#define FRAME_EXTERNAL_MENU_BAR(f) 0
#endif
-#define FRAME_VISIBLE_P(f) ((f)->visible != 0)
+#define FRAME_VISIBLE_P(f) (f)->visible
/* Nonzero if frame F is currently visible but hidden. */
#define FRAME_OBSCURED_P(f) ((f)->visible > 1)
@@ -719,9 +703,10 @@ typedef struct frame *FRAME_PTR;
/* Nonzero if frame F is currently iconified. */
#define FRAME_ICONIFIED_P(f) (f)->iconified
-#define FRAME_SET_VISIBLE(f,p) \
- ((f)->async_visible = (p), FRAME_SAMPLE_VISIBILITY (f))
+/* Mark frame F as currently garbaged. */
#define SET_FRAME_GARBAGED(f) (frame_garbaged = 1, f->garbaged = 1)
+
+/* Nonzero if frame F is currently garbaged. */
#define FRAME_GARBAGED_P(f) (f)->garbaged
/* Nonzero means do not allow splitting this frame's window. */
@@ -866,39 +851,6 @@ typedef struct frame *FRAME_PTR;
#define FRAME_MESSAGE_BUF_SIZE(f) (((int) FRAME_COLS (f)) * 4)
-/* 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.
-
- Synchronous code must use the FRAME_SET_VISIBLE macro.
-
- Also, if a frame used to be invisible, but has just become visible,
- it must be marked as garbaged, since redisplay hasn't been keeping
- up its contents.
-
- Note that a tty frame is visible if and only if it is the topmost
- frame. */
-
-#define FRAME_SAMPLE_VISIBILITY(f) \
- (((f)->async_visible && (f)->visible != (f)->async_visible) ? \
- SET_FRAME_GARBAGED (f) : 0, \
- (f)->visible = (f)->async_visible, \
- (f)->iconified = (f)->async_iconified)
-
#define CHECK_FRAME(x) \
CHECK_TYPE (FRAMEP (x), Qframep, x)
@@ -932,12 +884,24 @@ typedef struct frame *FRAME_PTR;
block_input (); \
if (hlinfo->mouse_face_mouse_frame) \
note_mouse_highlight (hlinfo->mouse_face_mouse_frame, \
- hlinfo->mouse_face_mouse_x, \
- hlinfo->mouse_face_mouse_y); \
+ hlinfo->mouse_face_mouse_x, \
+ hlinfo->mouse_face_mouse_y); \
unblock_input (); \
} \
} while (0)
+/* Set visibility of frame F, marking F as garbaged if needed. */
+
+#define SET_FRAME_VISIBLE(f, v) \
+ (((f)->visible == 0 || ((f)->visible == 2)) \
+ && ((v) == 1) ? SET_FRAME_GARBAGED (f) : 0, \
+ (f)->visible = (eassert (0 <= (v) && (v) <= 2), (v)))
+
+/* Set iconify of frame F. */
+
+#define SET_FRAME_ICONIFIED(f, i) \
+ (f)->iconified = (eassert (0 <= (i) && (i) <= 1), (i))
+
extern Lisp_Object Qframep, Qframe_live_p;
extern Lisp_Object Qtty, Qtty_type;
extern Lisp_Object Qtty_color_mode;