]> code.delx.au - gnu-emacs/blobdiff - src/frame.h
Parallelize documentation builds.
[gnu-emacs] / src / frame.h
index 94498e9efcf180f8f548608b3fcb247b2e46e497..c18b7662079f8e2114c27c2d41cc72c0df702b0c 100644 (file)
@@ -1,5 +1,5 @@
 /* Define frame-object for GNU Emacs.
-   Copyright (C) 1993-1994, 1999-2012 Free Software Foundation, Inc.
+   Copyright (C) 1993-1994, 1999-2013 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -18,7 +18,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* Don't multiply include: dispextern.h includes macterm.h which
    includes frame.h some emacs source includes both dispextern.h and
-   frame.h */
+   frame.h */
 
 #ifndef EMACS_FRAME_H
 #define EMACS_FRAME_H
@@ -33,7 +33,7 @@ INLINE_HEADER_BEGIN
 \f
 /* Miscellanea.  */
 
-/* Nonzero means there is at least one garbaged frame. */
+/* Nonzero means there is at least one garbaged frame.  */
 extern bool frame_garbaged;
 
 \f
@@ -46,7 +46,6 @@ enum output_method
   output_x_window,
   output_msdos_raw,
   output_w32,
-  output_mac,
   output_ns
 };
 
@@ -81,9 +80,6 @@ enum fullscreen_type
 #define FRAME_FOREGROUND_PIXEL(f) ((f)->foreground_pixel)
 #define FRAME_BACKGROUND_PIXEL(f) ((f)->background_pixel)
 
-struct terminal;
-
-struct font_driver_list;
 
 struct frame
 {
@@ -204,7 +200,7 @@ struct frame
      string's pointer (`name', above) because it might get relocated.  */
   char *namebuf;
 
-  /* Glyph pool and matrix. */
+  /* Glyph pool and matrix.  */
   struct glyph_pool *current_pool;
   struct glyph_pool *desired_pool;
   struct glyph_matrix *desired_matrix;
@@ -240,7 +236,7 @@ struct frame
 
 #if defined (USE_GTK) || defined (HAVE_NS)
   /* Nonzero means using a tool bar that comes from the toolkit.  */
-  int external_tool_bar;
+  unsigned external_tool_bar : 1;
 #endif
 
   /* Margin at the top of the frame.  Used to display the tool-bar.  */
@@ -304,9 +300,6 @@ struct frame
   /* Canonical X unit.  Width of default font, in pixels.  */
   int column_width;
 
-  /* Width of space glyph of default font, in pixels.  */
-  int space_width;
-
   /* Canonical Y unit.  Height of a line, in pixels.  */
   int line_height;
 
@@ -360,49 +353,30 @@ struct frame
   unsigned int external_menu_bar : 1;
 #endif
 
-  /* Nonzero if last attempt at redisplay on this frame was preempted.  */
-  unsigned display_preempted : 1;
+  /* Next two bitfields are mutually exclusive.  They might both be
+     zero if the frame has been made invisible without an icon.  */
 
-  /* visible is nonzero if the frame is currently displayed; we check
+  /* 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.  */
@@ -412,10 +386,6 @@ struct frame
      show no modeline for that window.  */
   unsigned wants_modeline : 1;
 
-  /* Non-zero if the hardware device this frame is displaying on can
-     support scroll bars.  */
-  char can_have_scroll_bars;
-
   /* Non-0 means raise this frame to the top of the heap when selected.  */
   unsigned auto_raise : 1;
 
@@ -441,8 +411,7 @@ struct frame
   /* Nonzero means that the pointer is invisible. */
   unsigned pointer_invisible :1;
 
-  /* If can_have_scroll_bars is non-zero, this is non-zero if we should
-     actually display them on this frame.  */
+  /* Nonzero if we should actually display the scroll bars on this frame.  */
   enum vertical_scroll_bar_type vertical_scroll_bar_type;
 
   /* What kind of text cursor should we draw in the future?
@@ -459,9 +428,6 @@ struct frame
   /* Width of bar cursor (if we are using that) for blink-off state.  */
   int blink_off_cursor_width;
 
-  /* Storage for messages to this frame. */
-  char *message_buf;
-
   /* Nonnegative if current redisplay should not do scroll computation
      for lines beyond a certain vpos.  This is the vpos.  */
   int scroll_bottom_vpos;
@@ -621,7 +587,7 @@ typedef struct frame *FRAME_PTR;
 #define FRAME_INITIAL_P(f) ((f)->output_method == output_initial)
 #define FRAME_TERMCAP_P(f) ((f)->output_method == output_termcap)
 #define FRAME_X_P(f) ((f)->output_method == output_x_window)
-#ifndef WINDOWSNT
+#ifndef HAVE_NTGUI
 #define FRAME_W32_P(f) (0)
 #else
 #define FRAME_W32_P(f) ((f)->output_method == output_w32)
@@ -649,7 +615,7 @@ typedef struct frame *FRAME_PTR;
 #define FRAME_WINDOW_P(f) FRAME_NS_P(f)
 #endif
 #ifndef FRAME_WINDOW_P
-#define FRAME_WINDOW_P(f) (0)
+#define FRAME_WINDOW_P(f) ((void) (f), 0)
 #endif
 
 /* Return a pointer to the structure holding information about the
@@ -729,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)
@@ -737,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.  */
@@ -766,15 +733,9 @@ typedef struct frame *FRAME_PTR;
 #define FRAME_DELETE_COST(f) (f)->delete_line_cost
 #define FRAME_INSERTN_COST(f) (f)->insert_n_lines_cost
 #define FRAME_DELETEN_COST(f) (f)->delete_n_lines_cost
-#define FRAME_MESSAGE_BUF(f) (f)->message_buf
 #define FRAME_SCROLL_BOTTOM_VPOS(f) (f)->scroll_bottom_vpos
 #define FRAME_FOCUS_FRAME(f) f->focus_frame
 
-/* 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)
@@ -890,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)
 
@@ -946,6 +874,33 @@ typedef struct frame *FRAME_PTR;
        && (frame_var = XCAR (list_var), 1));   \
        list_var = XCDR (list_var))
 
+/* Reflect mouse movement when a complete frame update is performed.  */
+
+#define FRAME_MOUSE_UPDATE(frame)                              \
+  do {                                                         \
+    Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (frame);              \
+    if (frame == hlinfo->mouse_face_mouse_frame)               \
+      {                                                                \
+       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);    \
+       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;
@@ -956,6 +911,8 @@ extern Lisp_Object Qnoelisp;
 extern struct frame *last_nonminibuf_frame;
 
 extern void set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
+extern struct frame *decode_live_frame (Lisp_Object);
+extern struct frame *decode_any_frame (Lisp_Object);
 extern struct frame *make_initial_frame (void);
 extern struct frame *make_frame (int);
 #ifdef HAVE_WINDOW_SYSTEM
@@ -999,11 +956,6 @@ extern Lisp_Object selected_frame;
 
 #define FRAME_COLUMN_WIDTH(F) ((F)->column_width)
 
-/* Space glyph width of the default font of frame F.  */
-
-#define FRAME_SPACE_WIDTH(F) ((F)->space_width)
-
-
 /* Pixel width of areas used to display truncation marks, continuation
    marks, overlay arrows.  This is 0 for terminal frames.  */
 
@@ -1185,7 +1137,7 @@ extern Lisp_Object Qalpha;
 extern Lisp_Object Qleft_fringe, Qright_fringe;
 extern Lisp_Object Qheight, Qwidth;
 extern Lisp_Object Qminibuffer, Qmodeline;
-extern Lisp_Object Qx, Qw32, Qmac, Qpc, Qns;
+extern Lisp_Object Qx, Qw32, Qpc, Qns;
 extern Lisp_Object Qvisible;
 extern Lisp_Object Qdisplay_type;
 
@@ -1206,14 +1158,14 @@ extern Lisp_Object Qrun_hook_with_args;
 extern void x_set_scroll_bar_default_width (struct frame *);
 extern void x_set_offset (struct frame *, int, int, int);
 extern void x_wm_set_icon_position (struct frame *, int, int);
-extern void x_wm_set_size_hint (FRAME_PTR f, long flags, int user_position);
+extern void x_wm_set_size_hint (FRAME_PTR f, long flags, bool user_position);
 
 extern Lisp_Object x_new_font (struct frame *, Lisp_Object, int);
 
 
 extern Lisp_Object Qface_set_after_frame_default;
 
-#ifdef WINDOWSNT
+#ifdef HAVE_NTGUI
 extern void x_fullscreen_adjust (struct frame *f, int *, int *,
                                  int *, int *);
 #endif
@@ -1252,7 +1204,7 @@ extern Lisp_Object display_x_get_resource (Display_Info *,
                                           Lisp_Object component,
                                           Lisp_Object subclass);
 
-extern void set_frame_menubar (struct frame *f, int first_time, int deep_p);
+extern void set_frame_menubar (struct frame *f, bool first_time, bool deep_p);
 extern void x_set_window_size (struct frame *f, int change_grav,
                               int cols, int rows);
 extern void x_sync (struct frame *);
@@ -1262,8 +1214,6 @@ extern void x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y);
 extern void x_make_frame_visible (struct frame *f);
 extern void x_make_frame_invisible (struct frame *f);
 extern void x_iconify_frame (struct frame *f);
-extern int x_char_width (struct frame *f);
-extern int x_char_height (struct frame *f);
 extern int x_pixel_width (struct frame *f);
 extern int x_pixel_height (struct frame *f);
 extern void x_set_frame_alpha (struct frame *f);
@@ -1285,9 +1235,7 @@ extern char *x_get_resource_string (const char *, const char *);
 #endif
 
 extern void x_query_colors (struct frame *f, XColor *, int);
-
-/* In xmenu.c */
-extern void set_frame_menubar (FRAME_PTR, int, int);
+extern void x_query_color (struct frame *f, XColor *);
 
 #endif /* HAVE_WINDOW_SYSTEM */