+/* Nonzero if frame F supports scroll bars.
+ If this is zero, then it is impossible to enable scroll bars
+ on frame F. */
+#define FRAME_CAN_HAVE_SCROLL_BARS(f) ((f)->can_have_scroll_bars)
+
+/* This frame slot says whether scroll bars are currently enabled for frame F,
+ and which side they are on. */
+#define FRAME_VERTICAL_SCROLL_BAR_TYPE(f) ((f)->vertical_scroll_bar_type)
+#define FRAME_HAS_VERTICAL_SCROLL_BARS(f) \
+ ((f)->vertical_scroll_bar_type != vertical_scroll_bar_none)
+#define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT(f) \
+ ((f)->vertical_scroll_bar_type == vertical_scroll_bar_left)
+#define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT(f) \
+ ((f)->vertical_scroll_bar_type == vertical_scroll_bar_right)
+
+/* Width that a scroll bar in frame F should have, if there is one.
+ Measured in pixels.
+ If scroll bars are turned off, this is still nonzero. */
+#define FRAME_SCROLL_BAR_PIXEL_WIDTH(f) ((f)->scroll_bar_pixel_width)
+
+/* Width that a scroll bar in frame F should have, if there is one.
+ Measured in columns (characters).
+ If scroll bars are turned off, this is still nonzero. */
+#define FRAME_SCROLL_BAR_COLS(f) ((f)->scroll_bar_cols)
+
+/* Width of a scroll bar in frame F, measured in columns (characters),
+ but only if scroll bars are on the left.
+ If scroll bars are on the right in this frame, it is 0. */
+#define FRAME_LEFT_SCROLL_BAR_WIDTH(f) \
+ (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f) \
+ ? FRAME_SCROLL_BAR_COLS (f) \
+ : 0)
+
+/* Width of a scroll bar in frame F, measured in columns (characters). */
+#define FRAME_SCROLL_BAR_WIDTH(f) \
+ (FRAME_HAS_VERTICAL_SCROLL_BARS (f) \
+ ? FRAME_SCROLL_BAR_COLS (f) \
+ : 0)
+
+/* Total width of frame F, in columns (characters),
+ including the width used by scroll bars if any. */
+#define FRAME_WINDOW_WIDTH(f) ((f)->window_width)
+
+/* Set the width of frame F to VAL.
+ VAL is the width of a full-frame window,
+ not including scroll bars. */
+#define SET_FRAME_WIDTH(f, val) \
+ ((f)->width = (val), \
+ (f)->window_width = FRAME_WINDOW_WIDTH_ARG (f, (f)->width))
+
+/* Given a value WIDTH for frame F's nominal width,
+ return the value that FRAME_WINDOW_WIDTH should have. */
+#define FRAME_WINDOW_WIDTH_ARG(f, width) \
+ ((width) \
+ + FRAME_SCROLL_BAR_WIDTH (f) \
+ + FRAME_FLAGS_AREA_COLS (f))
+
+/* Maximum + 1 legitimate value for FRAME_CURSOR_X. */
+#define FRAME_CURSOR_X_LIMIT(f) \
+ (FRAME_WIDTH (f) + FRAME_LEFT_SCROLL_BAR_WIDTH (f))
+
+/* Nonzero if frame F has scroll bars. */
+#define FRAME_SCROLL_BARS(f) ((f)->scroll_bars)
+
+#define FRAME_CONDEMNED_SCROLL_BARS(f) ((f)->condemned_scroll_bars)
+#define FRAME_MENU_BAR_ITEMS(f) ((f)->menu_bar_items)
+#define FRAME_COST_BAUD_RATE(f) ((f)->cost_calculation_baud_rate)
+
+/* Return a pointer to the face cache of frame F. */
+
+#define FRAME_FACE_CACHE(F) (F)->face_cache
+
+/* Return the size of message_buf of the frame F. We multiply the
+ width of the frame by 4 because multi-byte form may require at most
+ 4-byte for a character. */
+
+#define FRAME_MESSAGE_BUF_SIZE(f) (((int) (f)->width) * 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. */
+
+#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)
+