]> code.delx.au - gnu-emacs/blobdiff - src/frame.h
(Fget_char_property): Update call to overlays_at.
[gnu-emacs] / src / frame.h
index 8ff3091491a1d90b4ace13ff4e6ffcc17561e0d3..729cbf9e577eb1910dfc41ab886f145b642fdbc2 100644 (file)
@@ -1,3 +1,8 @@
+/* Don't multiply include: dispextern.h includes macterm.h which includes frame.h 
+   some emacs source includes both dispextern.h and frame.h */
+#ifndef _XFRAME_H_
+#define _XFRAME_H_
+
 /* Define frame-object for GNU Emacs.
    Copyright (C) 1993, 1994 Free Software Foundation, Inc.
 
@@ -39,7 +44,8 @@ enum output_method
   output_termcap,
   output_x_window,
   output_msdos_raw,
-  output_w32
+  output_w32,
+  output_mac
 };
 
 enum vertical_scroll_bar_type
@@ -49,6 +55,33 @@ enum vertical_scroll_bar_type
   vertical_scroll_bar_right
 };
 
+#if !defined(MSDOS) && !defined(WINDOWSNT) && !defined(macintosh)
+
+#if !defined(HAVE_X_WINDOWS)
+
+#define PIX_TYPE int
+
+/* A (mostly empty) x_output structure definition for building Emacs
+   on Unix and GNU/Linux without X support.  */
+struct x_output
+{
+  PIX_TYPE background_pixel;
+  PIX_TYPE foreground_pixel;
+};
+
+#define FRAME_INTERNAL_BORDER_WIDTH(f) 0
+
+#endif /* ! HAVE_X_WINDOWS */
+
+
+#define FRAME_FOREGROUND_PIXEL(f) ((f)->output_data.x->foreground_pixel)
+#define FRAME_BACKGROUND_PIXEL(f) ((f)->output_data.x->background_pixel)
+
+/* A structure describing a termcap frame display.  */
+extern struct x_output tty_display;
+
+#endif /* ! MSDOS && ! WINDOWSNT && ! macintosh */
+
 struct frame
 {
   EMACS_INT size;
@@ -142,14 +175,14 @@ struct frame
      toolkit support is available.  */
   Lisp_Object menu_bar_window;
 
-  /* A window used to display the toolbar of a frame.  */
-  Lisp_Object toolbar_window;
+  /* A window used to display the tool-bar of a frame.  */
+  Lisp_Object tool_bar_window;
 
-  /* Desired and current toolbar items.  */
-  Lisp_Object desired_toolbar_items, current_toolbar_items;
+  /* Desired and current tool-bar items.  */
+  Lisp_Object desired_tool_bar_items, current_tool_bar_items;
 
-  /* Desired and current contents displayed in toolbar_window.  */
-  Lisp_Object desired_toolbar_string, current_toolbar_string;
+  /* Desired and current contents displayed in tool_bar_window.  */
+  Lisp_Object desired_tool_bar_string, current_tool_bar_string;
 
   /* beyond here, there should be no more Lisp_Object components.  */
 
@@ -170,11 +203,11 @@ struct frame
      be used for output.  */
   unsigned glyphs_initialized_p : 1;
 
-  /* Margin at the top of the frame.  Used to display the toolbar.  */
-  int toolbar_lines;
+  /* Margin at the top of the frame.  Used to display the tool-bar.  */
+  int tool_bar_lines;
 
-  int n_desired_toolbar_items;
-  int n_current_toolbar_items;
+  int n_desired_tool_bar_items;
+  int n_current_tool_bar_items;
   
   /* A buffer for decode_mode_line. */
   char *decode_mode_spec_buffer;
@@ -211,6 +244,7 @@ struct frame
   {
     struct x_output *x;
     struct w32_output *w32;
+    struct mac_output *mac;
     int nothing;
   }
   output_data;
@@ -266,16 +300,10 @@ struct frame
   /* 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;
+  volatile char async_visible, async_iconified;
 
   /* Nonzero if this frame should be redrawn.  */
-#ifdef __STDC__
-  volatile
-#endif
-  char garbaged;
+  volatile char garbaged;
 
   /* True if frame actually has a minibuffer window on it.
      0 if using a minibuffer window that isn't on this frame.  */
@@ -331,14 +359,17 @@ struct frame
   /* The baud rate that was used to calculate costs for this frame.  */
   int cost_calculation_baud_rate;
 
-  /* A pointer to the data structure containing all information of
-     fontsets associated with this frame.  See the comments in
-     fontset.h for more detail.  */
-  struct fontset_data *fontset_data;
-
   /* Nonzero if the mouse has moved on this display
      since the last time we checked.  */
   char mouse_moved;
+
+  /* Exponent for gamma correction of colors.  1/(VIEWING_GAMMA *
+     SCREEN_GAMMA) where viewing_gamma is 0.4545 and SCREEN_GAMMA is a
+     frame parameter.  0 means don't do gamma correction.  */
+  double gamma;
+
+  /* Additional space to put between text lines on this frame.  */
+  int extra_line_spacing;
 };
 
 #ifdef MULTI_KBOARD
@@ -349,7 +380,7 @@ struct frame
 
 typedef struct frame *FRAME_PTR;
 
-#define XFRAME(p) ((struct frame *) XPNTR (p))
+#define XFRAME(p) (eassert (GC_FRAMEP(p)),(struct frame *) XPNTR (p))
 #define XSETFRAME(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FRAME))
 
 /* Given a window, return its frame as a Lisp_Object.  */
@@ -360,6 +391,7 @@ typedef struct frame *FRAME_PTR;
 #define FRAME_X_P(f) ((f)->output_method == output_x_window)
 #define FRAME_W32_P(f) ((f)->output_method == output_w32)
 #define FRAME_MSDOS_P(f) ((f)->output_method == output_msdos_raw)
+#define FRAME_MAC_P(f) ((f)->output_method == output_mac)
 
 /* FRAME_WINDOW_P tests whether the frame is a window, and is
    defined to be the predicate for the window system being used.  */
@@ -370,6 +402,9 @@ typedef struct frame *FRAME_PTR;
 #ifdef HAVE_NTGUI
 #define FRAME_WINDOW_P(f) FRAME_W32_P (f)
 #endif
+#ifdef macintosh
+#define FRAME_WINDOW_P(f) FRAME_MAC_P (f)
+#endif
 #ifndef FRAME_WINDOW_P
 #define FRAME_WINDOW_P(f) (0)
 #endif
@@ -396,14 +431,14 @@ typedef struct frame *FRAME_PTR;
    These lines are counted in FRAME_HEIGHT.  */
 #define FRAME_MENU_BAR_LINES(f) (f)->menu_bar_lines
 
-/* Number of lines of frame F used for the toolbar.  */
+/* Number of lines of frame F used for the tool-bar.  */
 
-#define FRAME_TOOLBAR_LINES(f) (f)->toolbar_lines
+#define FRAME_TOOL_BAR_LINES(f) (f)->tool_bar_lines
 
 /* Lines above the top-most window in frame F.  */
 
 #define FRAME_TOP_MARGIN(F) \
-     (FRAME_MENU_BAR_LINES (F) + FRAME_TOOLBAR_LINES (F))
+     (FRAME_MENU_BAR_LINES (F) + FRAME_TOOL_BAR_LINES (F))
 
 /* Nonzero if this frame should display a menu bar
    in a way that does not use any text lines.  */
@@ -511,7 +546,7 @@ typedef struct frame *FRAME_PTR;
 #define FRAME_WINDOW_WIDTH_ARG(f, width)       \
      ((width)                                  \
       + FRAME_SCROLL_BAR_WIDTH (f)             \
-      + 2 * FRAME_FLAGS_AREA_COLS (f))
+      + FRAME_FLAGS_AREA_COLS (f))
 
 /* Maximum + 1 legitimate value for FRAME_CURSOR_X.  */
 #define FRAME_CURSOR_X_LIMIT(f) \
@@ -523,7 +558,6 @@ typedef struct frame *FRAME_PTR;
 #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)
-#define FRAME_FONTSET_DATA(f) ((f)->fontset_data)
 
 /* Return a pointer to the face cache of frame F.  */
 
@@ -565,19 +599,18 @@ typedef struct frame *FRAME_PTR;
    (f)->visible = (f)->async_visible, \
    (f)->iconified = (f)->async_iconified)
 
-#define CHECK_FRAME(x, i)                      \
-     if (! FRAMEP (x))                         \
-       x = wrong_type_argument (Qframep, (x)); \
-     else                                      \
-       (void) 0
+#define CHECK_FRAME(x, i)                              \
+     do {                                              \
+       if (! FRAMEP (x))                               \
+         x = wrong_type_argument (Qframep, (x));       \
+     } while (0)
 
 #define CHECK_LIVE_FRAME(x, i)                         \
-     if (! FRAMEP (x)                                  \
-        || ! FRAME_LIVE_P (XFRAME (x)))                \
-       x = wrong_type_argument (Qframe_live_p, (x));   \
-     else                                              \
-       (void) 0
-
+     do {                                              \
+       if (! FRAMEP (x)                                        \
+          || ! FRAME_LIVE_P (XFRAME (x)))              \
+         x = wrong_type_argument (Qframe_live_p, (x)); \
+     } while (0)
 
 /* FOR_EACH_FRAME (LIST_VAR, FRAME_VAR) followed by a statement is a
    `for' loop which iterates over the elements of Vframe_list.  The
@@ -593,13 +626,12 @@ typedef struct frame *FRAME_PTR;
 #define FOR_EACH_FRAME(list_var, frame_var)                    \
   for ((list_var) = Vframe_list;                               \
        (CONSP (list_var)                                       \
-       && (frame_var = XCONS (list_var)->car, 1));             \
-       list_var = XCONS (list_var)->cdr)
+       && (frame_var = XCAR (list_var), 1));           \
+       list_var = XCDR (list_var))
 
 
 extern Lisp_Object Qframep, Qframe_live_p, Qicon;
 
-extern struct frame *selected_frame;
 extern struct frame *last_nonminibuf_frame;
 
 extern struct frame *make_terminal_frame P_ ((void));
@@ -639,6 +671,18 @@ extern Lisp_Object Vterminal_frame;
      
 #define WINDOW_VERTICAL_SCROLL_BAR_HEIGHT(w) (window_internal_height (w))
 
+/* The currently selected frame.  */
+
+extern Lisp_Object selected_frame;
+
+/* Value is a pointer to the selected frame.  If the selected frame
+   isn't live, abort.  */
+
+#define SELECTED_FRAME()                               \
+     ((FRAMEP (selected_frame)                         \
+       && FRAME_LIVE_P (XFRAME (selected_frame)))      \
+      ? XFRAME (selected_frame)                                \
+      : (abort (), (struct frame *) 0))
 
 \f
 /***********************************************************************
@@ -660,17 +704,18 @@ extern Lisp_Object Vterminal_frame;
      (FRAME_WINDOW_P (F) ? FRAME_DEFAULT_FONT_WIDTH (F) : 1)
 
 /* Pixel width of areas used to display truncation marks, continuation
-   marks, overlay arrows.  This is 0 for terminal frames.  Other
-   terminal headers must define FRAME_X_TRUNC_WIDTH.  */
+   marks, overlay arrows.  This is 0 for terminal frames.  */
 
 #ifdef HAVE_WINDOW_SYSTEM
 #define FRAME_FLAGS_AREA_COLS(F) \
      (FRAME_WINDOW_P ((F)) ? FRAME_X_FLAGS_AREA_COLS ((F)) : 0)
-#define FRAME_FLAGS_AREA_WIDTH(F) \
-     (FRAME_FLAGS_AREA_COLS ((F)) * CANON_X_UNIT ((F)))
+#define FRAME_FLAGS_AREA_WIDTH(F) FRAME_X_FLAGS_AREA_WIDTH (F)
+#define FRAME_LEFT_FLAGS_AREA_WIDTH(F) FRAME_X_LEFT_FLAGS_AREA_WIDTH (F)
+     
 #else
 #define FRAME_FLAGS_AREA_WIDTH(F)      0
 #define FRAME_FLAGS_AREA_COLS(F)       0
+#define FRAME_LEFT_FLAGS_AREA_WIDTH(F)  0
 #endif
      
 
@@ -691,7 +736,7 @@ extern Lisp_Object Vterminal_frame;
 #define PIXEL_X_FROM_CANON_X(F, X)                     \
      (INTEGERP (X)                                     \
       ? XINT (X) * CANON_X_UNIT (F)                    \
-      : (int) (XFLOAT (X)->data * CANON_X_UNIT (F)))
+      : (int) (XFLOAT_DATA (X) * CANON_X_UNIT (F)))
       
 /* Convert canonical value Y to pixels.  F is the frame whose
    canonical character height is to be used.  X must be a Lisp integer
@@ -700,7 +745,7 @@ extern Lisp_Object Vterminal_frame;
 #define PIXEL_Y_FROM_CANON_Y(F, Y)                     \
      (INTEGERP (Y)                                     \
       ? XINT (Y) * CANON_Y_UNIT (F)                    \
-      : (int) (XFLOAT (Y)->data * CANON_Y_UNIT (F)))
+      : (int) (XFLOAT_DATA (Y) * CANON_Y_UNIT (F)))
 
 /* Convert pixel-value X to canonical units.  F is the frame whose
    canonical character width is to be used.  X is a C integer.  Result
@@ -722,3 +767,4 @@ extern Lisp_Object Vterminal_frame;
       ? make_float ((double) (Y) / CANON_Y_UNIT (F))   \
       : make_number ((Y) / CANON_Y_UNIT (F)))  
                             
+#endif /* not defined _FRAME_H_ */