typedef struct w32_display_info Display_Info;
#endif
-#ifdef MAC_OS
+#ifdef HAVE_CARBON
#include "macgui.h"
typedef struct mac_display_info Display_Info;
+
+/* Include Carbon.h to define Cursor and Rect. */
+#undef mktime
+#undef DEBUG
+#undef Z
+#undef free
+#undef malloc
+#undef realloc
+/* Macros max and min defined in lisp.h conflict with those in
+ precompiled header Carbon.h. */
+#undef max
+#undef min
+#undef init_process
+#include <Carbon/Carbon.h>
+#undef Z
+#define Z (current_buffer->text->z)
+#undef free
+#define free unexec_free
+#undef malloc
+#define malloc unexec_malloc
+#undef realloc
+#define realloc unexec_realloc
+#undef min
+#define min(a, b) ((a) < (b) ? (a) : (b))
+#undef max
+#define max(a, b) ((a) > (b) ? (a) : (b))
+#undef init_process
+#define init_process emacs_init_process
+
+#endif
+
+
+#ifndef NativeRectangle
+#define NativeRectangle int
#endif
int matrix_w, matrix_h;
/* If this structure describes a window matrix of window W,
- window_left_x is the value of W->left, window_top_y the value of
- W->top, window_height and window_width are width and height of W,
- as returned by window_box, and window_vscroll is the value of
- W->vscroll at the time the matrix was last adjusted. Only set
- for window-based redisplay. */
- int window_left_x, window_top_y, window_height, window_width, window_vscroll;
+ window_left_col is the value of W->left_col, window_top_line the
+ value of W->top_line, window_height and window_width are width and
+ height of W, as returned by window_box, and window_vscroll is the
+ value of W->vscroll at the time the matrix was last adjusted.
+ Only set for window-based redisplay. */
+ int window_left_col, window_top_line;
+ int window_height, window_width;
+ int window_vscroll;
/* Number of glyphs reserved for left and right marginal areas when
the matrix was last adjusted. */
#define MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P(W, ROW) \
(MATRIX_ROW_PARTIALLY_VISIBLE_P ((ROW)) \
- && (ROW)->y < WINDOW_DISPLAY_HEADER_LINE_HEIGHT ((W)))
+ && (ROW)->y < WINDOW_HEADER_LINE_HEIGHT ((W)))
/* Non-zero if ROW is partially visible at the bottom of window W. */
#define MATRIX_ROW_PARTIALLY_VISIBLE_AT_BOTTOM_P(W, ROW) \
(MATRIX_ROW_PARTIALLY_VISIBLE_P ((ROW)) \
- && (ROW)->y + (ROW)->height > WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE ((W)))
+ && (ROW)->y + (ROW)->height > WINDOW_BOX_HEIGHT_NO_MODE_LINE ((W)))
/* Return the bottom Y + 1 of ROW. */
#define DESIRED_HEADER_LINE_HEIGHT(W) \
MATRIX_HEADER_LINE_HEIGHT ((W)->desired_matrix)
-/* Like FRAME_INTERNAL_BORDER_WIDTH but checks whether frame F is a
- window-system frame. */
-
-#define FRAME_INTERNAL_BORDER_WIDTH_SAFE(F) \
- (FRAME_WINDOW_P (F) ? FRAME_INTERNAL_BORDER_WIDTH (F) : 0)
-
-/* Width of display region of window W. For terminal frames, this
- equals the width of W since there are no vertical scroll bars. For
- window system frames, the value has to be corrected by the pixel
- width of vertical scroll bars, and fringes. */
-
-#define WINDOW_DISPLAY_PIXEL_WIDTH(W) \
- (((XFASTINT ((W)->width) \
- - FRAME_SCROLL_BAR_WIDTH (XFRAME (WINDOW_FRAME ((W)))) \
- - FRAME_FRINGE_COLS (XFRAME (WINDOW_FRAME ((W))))) \
- * CANON_X_UNIT (XFRAME (WINDOW_FRAME ((W))))))
-
-/* Height of the display region of W, including a mode line, if any. */
-
-#define WINDOW_DISPLAY_PIXEL_HEIGHT(W) \
- (XFASTINT ((W)->height) \
- * CANON_Y_UNIT (XFRAME (WINDOW_FRAME ((W)))))
-
-/* Height in pixels of the mode line. May be zero if W doesn't have a
- mode line. */
-
-#define WINDOW_DISPLAY_MODE_LINE_HEIGHT(W) \
- (WINDOW_WANTS_MODELINE_P ((W)) \
- ? CURRENT_MODE_LINE_HEIGHT (W) \
- : 0)
-
-/* Height in pixels of the header line. Zero if W doesn't have a header
- line. */
-
-#define WINDOW_DISPLAY_HEADER_LINE_HEIGHT(W) \
- (WINDOW_WANTS_HEADER_LINE_P ((W)) \
- ? CURRENT_HEADER_LINE_HEIGHT (W) \
- : 0)
-
-/* Pixel height of window W without mode line. */
-
-#define WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE(W) \
- (WINDOW_DISPLAY_PIXEL_HEIGHT ((W)) \
- - WINDOW_DISPLAY_MODE_LINE_HEIGHT ((W)))
-
-/* Pixel height of window W without mode and header line. */
-
-#define WINDOW_DISPLAY_TEXT_HEIGHT(W) \
- (WINDOW_DISPLAY_PIXEL_HEIGHT ((W)) \
- - WINDOW_DISPLAY_MODE_LINE_HEIGHT ((W)) \
- - WINDOW_DISPLAY_HEADER_LINE_HEIGHT ((W)))
-
-/* Left edge of W in pixels relative to its frame. */
-
-#define WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X(W) \
- (FRAME_INTERNAL_BORDER_WIDTH_SAFE (XFRAME (WINDOW_FRAME ((W)))) \
- + (WINDOW_LEFT_MARGIN ((W)) \
- * CANON_X_UNIT (XFRAME (WINDOW_FRAME ((W))))) \
- + FRAME_LEFT_FRINGE_WIDTH (XFRAME (WINDOW_FRAME ((W)))))
-
-/* Right edge of window W in pixels, relative to its frame. */
-
-#define WINDOW_DISPLAY_RIGHT_EDGE_PIXEL_X(W) \
- (WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X ((W)) \
- + WINDOW_DISPLAY_PIXEL_WIDTH ((W)))
-
-/* Top edge of W in pixels relative to its frame. */
-
-#define WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y(W) \
- (FRAME_INTERNAL_BORDER_WIDTH_SAFE (XFRAME (WINDOW_FRAME ((W)))) \
- + (XFASTINT ((W)->top) \
- * CANON_Y_UNIT (XFRAME (WINDOW_FRAME ((W))))))
-
-/* Bottom edge of window W relative to its frame. */
-
-#define WINDOW_DISPLAY_BOTTOM_EDGE_PIXEL_Y(W) \
- (WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y ((W)) \
- + WINDOW_DISPLAY_PIXEL_HEIGHT ((W)))
-
-/* Convert window W relative pixel X to frame pixel coordinates. */
-
-#define WINDOW_TO_FRAME_PIXEL_X(W, X) \
- ((X) + WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X ((W)))
-
-/* Convert window W relative pixel Y to frame pixel coordinates. */
-
-#define WINDOW_TO_FRAME_PIXEL_Y(W, Y) \
- ((Y) + WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y ((W)))
-
-/* Convert frame relative pixel X to window relative pixel X. */
-
-#define FRAME_TO_WINDOW_PIXEL_X(W, X) \
- ((X) - WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X ((W)))
-
-/* Convert frame relative pixel Y to window relative pixel Y. */
-
-#define FRAME_TO_WINDOW_PIXEL_Y(W, Y) \
- ((Y) - WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y ((W)))
-
-/* Width of left margin area in pixels. */
-
-#define WINDOW_DISPLAY_LEFT_AREA_PIXEL_WIDTH(W) \
- (NILP ((W)->left_margin_width) \
- ? 0 \
- : (XINT ((W)->left_margin_width) \
- * CANON_X_UNIT (XFRAME (WINDOW_FRAME ((W))))))
-
-/* Width of right marginal area in pixels. */
-
-#define WINDOW_DISPLAY_RIGHT_AREA_PIXEL_WIDTH(W) \
- (NILP ((W)->right_margin_width) \
- ? 0 \
- : (XINT ((W)->right_margin_width) \
- * CANON_X_UNIT (XFRAME (WINDOW_FRAME ((W))))))
-
-/* Width of text area in pixels. */
-
-#define WINDOW_DISPLAY_TEXT_AREA_PIXEL_WIDTH(W) \
- (WINDOW_DISPLAY_PIXEL_WIDTH ((W)) \
- - WINDOW_DISPLAY_LEFT_AREA_PIXEL_WIDTH ((W)) \
- - WINDOW_DISPLAY_RIGHT_AREA_PIXEL_WIDTH ((W)))
-
-/* Convert a text area relative x-position in window W to frame X
- pixel coordinates. */
-
-#define WINDOW_TEXT_TO_FRAME_PIXEL_X(W, X) \
- (WINDOW_TO_FRAME_PIXEL_X ((W), (X)) \
- + WINDOW_DISPLAY_LEFT_AREA_PIXEL_WIDTH ((W)))
-
-/* Translate an x-position relative to AREA in window W to frame pixel
- coordinates. */
-
-#define WINDOW_AREA_TO_FRAME_PIXEL_X(W, AREA, X) \
- (WINDOW_TO_FRAME_PIXEL_X ((W), (X)) \
- + (((AREA) > LEFT_MARGIN_AREA) \
- ? WINDOW_DISPLAY_LEFT_AREA_PIXEL_WIDTH ((W)) \
- : 0) \
- + (((AREA) > TEXT_AREA) \
- ? WINDOW_DISPLAY_TEXT_AREA_PIXEL_WIDTH ((W)) \
- : 0))
-
-/* Return the pixel width of AREA in W. */
-
-#define WINDOW_AREA_PIXEL_WIDTH(W, AREA) \
- (((AREA) == TEXT_AREA) \
- ? WINDOW_DISPLAY_TEXT_AREA_PIXEL_WIDTH ((W)) \
- : (((AREA) == LEFT_MARGIN_AREA) \
- ? WINDOW_DISPLAY_LEFT_AREA_PIXEL_WIDTH ((W)) \
- : WINDOW_DISPLAY_RIGHT_AREA_PIXEL_WIDTH ((W))))
-
/* Value is non-zero if window W wants a mode line. */
#define WINDOW_WANTS_MODELINE_P(W) \
&& FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W)))) \
&& BUFFERP ((W)->buffer) \
&& !NILP (XBUFFER ((W)->buffer)->mode_line_format) \
- && XFASTINT ((W)->height) > 1)
+ && WINDOW_TOTAL_LINES (W) > 1)
/* Value is non-zero if window W wants a header line. */
&& FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W)))) \
&& BUFFERP ((W)->buffer) \
&& !NILP (XBUFFER ((W)->buffer)->header_line_format) \
- && XFASTINT ((W)->height) > 1 + !NILP (XBUFFER ((W)->buffer)->mode_line_format))
+ && WINDOW_TOTAL_LINES (W) > 1 + !NILP (XBUFFER ((W)->buffer)->mode_line_format))
/* Return proper value to be used as baseline offset of font that has
BOFF = DESCENT + (F_HEIGHT - HEIGHT) / 2 - F_DESCENT
DESCENT = FONT->descent
HEIGHT = FONT_HEIGHT (FONT)
- F_DESCENT = (F->output_data.x->font->descent
+ F_DESCENT = (FRAME_FONT (F)->descent
- F->output_data.x->baseline_offset)
F_HEIGHT = FRAME_LINE_HEIGHT (F)
*/
LFACE_FONT_INDEX,
LFACE_INHERIT_INDEX,
LFACE_AVGWIDTH_INDEX,
+ LFACE_FONTSET_INDEX,
LFACE_VECTOR_SIZE
};
reallocated. */
int font_info_id;
- /* Fontset ID if this face uses a fontset, or -1. This is only >= 0
- if the face was realized for a composition sequence.
- Otherwise, a specific font is loaded from the set of fonts
- specified by the fontset given by the family attribute of the face. */
+ /* Fontset ID if for this face's fontset. Non-ASCII faces derived
+ from the same ASCII face have the same fontset. */
int fontset;
/* Pixmap width and height. */
/* The hash value of this face. */
unsigned hash;
- /* The charset for which this face was realized if it was realized
- for use in multibyte text. If fontset >= 0, this is the charset
- of the first character of the composition sequence. A value of
- charset < 0 means the face was realized for use in unibyte text
- where the idea of Emacs charsets isn't applicable. */
- int charset;
-
/* Non-zero if text in this face should be underlined, overlined,
strike-through or have a box drawn around it. */
unsigned underline_p : 1;
/* Next and previous face in hash collision list of face cache. */
struct face *next, *prev;
- /* If this face is for ASCII characters, this points this face
- itself. Otherwise, this points a face for ASCII characters. */
+ /* If this face is an ASCII face, this points to this face itself.
+ Otherwise, this points to an ASCII face that has the same
+ attributes except the font. */
struct face *ascii_face;
};
/* Non-zero if FACE is suitable for displaying character CHAR. */
#define FACE_SUITABLE_FOR_CHAR_P(FACE, CHAR) \
- (SINGLE_BYTE_CHAR_P (CHAR) \
+ (ASCII_CHAR_P (CHAR) \
? (FACE) == (FACE)->ascii_face \
: face_suitable_for_char_p ((FACE), (CHAR)))
with id ID but is suitable for displaying character CHAR.
This macro is only meaningful for multibyte character CHAR. */
-#define FACE_FOR_CHAR(F, FACE, CHAR) \
- (SINGLE_BYTE_CHAR_P (CHAR) \
- ? (FACE)->ascii_face->id \
- : face_for_char ((F), (FACE), (CHAR)))
+#define FACE_FOR_CHAR(F, FACE, CHAR, POS, OBJECT) \
+ (ASCII_CHAR_P (CHAR) \
+ ? (FACE)->ascii_face->id \
+ : face_for_char ((F), (FACE), (CHAR), (POS), (OBJECT)))
#else /* not HAVE_WINDOW_SYSTEM */
#define FACE_SUITABLE_FOR_CHAR_P(FACE, CHAR) 1
-#define FACE_FOR_CHAR(F, FACE, CHAR) ((FACE)->id)
+#define FACE_FOR_CHAR(F, FACE, CHAR, POS, OBJECT) ((FACE)->id)
#endif /* not HAVE_WINDOW_SYSTEM */
enum prop_idx
{
+ AUTO_COMPOSED_PROP_IDX,
FONTIFIED_PROP_IDX,
FACE_PROP_IDX,
INVISIBLE_PROP_IDX,
short truncation_pixel_width, continuation_pixel_width;
/* First and last visible x-position in the display area. If window
- is hscrolled by n columns, first_visible_x == n * CANON_X_UNIT
+ is hscrolled by n columns, first_visible_x == n * FRAME_COLUMN_WIDTH
(f), and last_visible_x == pixel width of W + first_visible_x. */
int first_visible_x, last_visible_x;
};
+/* Handlers for setting frame parameters. */
+
+typedef void (*frame_parm_handler) P_ ((struct frame *, Lisp_Object, Lisp_Object));
+
+
/* Structure holding system-dependent interface functions needed
for window-based redisplay. */
struct redisplay_interface
{
+ /* Handlers for setting frame parameters. */
+ frame_parm_handler *frame_parm_handlers;
+
/* Produce glyphs/get display metrics for the display element IT is
loaded with. */
void (*produce_glyphs) P_ ((struct it *it));
the two-byte form of C. Encoding is returned in *CHAR2B. If
TWO_BYTE_P is non-null, return non-zero there if font is two-byte. */
int (*encode_char) P_ ((int c, XChar2b *char2b,
- struct font_info *font_into, int *two_byte_p));
+ struct font_info *font_into,
+ struct charset *charset,
+ int *two_byte_p));
/* Compute left and right overhang of glyph string S.
A NULL pointer if platform does not support this. */
void (*clear_frame_area) P_ ((struct frame *f, int x, int y,
int width, int height));
-/* Draw specified cursor NEW_CURSOR_TYPE of width NEW_CURSOR_WIDTH
- at row GLYPH_ROW on window W. */
+/* Draw specified cursor CURSOR_TYPE of width CURSOR_WIDTH
+ at row GLYPH_ROW on window W if ON_P is 1. If ON_P is
+ 0, don't draw cursor. If ACTIVE_P is 1, system caret
+ should track this cursor (when applicable). */
void (*draw_window_cursor) P_ ((struct window *w,
struct glyph_row *glyph_row,
- int on, int x, int y,
- int new_cursor_type,
- int new_cursor_width));
+ int x, int y,
+ int cursor_type, int cursor_width,
+ int on_p, int active_p));
/* Draw vertical border for window W from (X,Y0) to (X,Y1). */
void (*draw_vertical_window_border) P_ ((struct window *w,
int window_box_right P_ ((struct window *, int));
void window_box_edges P_ ((struct window *, int, int *, int *, int *, int *));
int estimate_mode_line_height P_ ((struct frame *, enum face_id));
+void pixel_to_glyph_coords P_ ((struct frame *, int, int, int *, int *,
+ NativeRectangle *, int));
+int glyph_to_pixel_coords P_ ((struct window *, int, int, int *, int *));
void mark_window_display_accurate P_ ((Lisp_Object, int));
void redisplay_preserve_echo_area P_ ((int));
void set_cursor_from_row P_ ((struct window *, struct glyph_row *,
unsigned long load_color P_ ((struct frame *, struct face *, Lisp_Object,
enum lface_attribute_index));
void unload_color P_ ((struct frame *, unsigned long));
-int frame_update_line_height P_ ((struct frame *));
+char *choose_face_font P_ ((struct frame *, Lisp_Object *, Lisp_Object,
+ int *));
int ascii_face_of_lisp_face P_ ((struct frame *, int));
void prepare_face_for_display P_ ((struct frame *, struct face *));
int xstricmp P_ ((const unsigned char *, const unsigned char *));
-int lookup_face P_ ((struct frame *, Lisp_Object *, int, struct face *));
-int lookup_named_face P_ ((struct frame *, Lisp_Object, int));
+int lookup_face P_ ((struct frame *, Lisp_Object *));
+int lookup_non_ascii_face P_ ((struct frame *, int, struct face *));
+int lookup_named_face P_ ((struct frame *, Lisp_Object));
int smaller_face P_ ((struct frame *, int, int));
int face_with_height P_ ((struct frame *, int, int));
-int lookup_derived_face P_ ((struct frame *, Lisp_Object, int, int));
+int lookup_derived_face P_ ((struct frame *, Lisp_Object, int));
void init_frame_faces P_ ((struct frame *));
void free_frame_faces P_ ((struct frame *));
void recompute_basic_faces P_ ((struct frame *));
int, int *, enum face_id, int));
int compute_char_face P_ ((struct frame *, int, Lisp_Object));
void free_all_realized_faces P_ ((Lisp_Object));
+void free_realized_face P_ ((struct frame *, struct face *));
extern Lisp_Object Qforeground_color, Qbackground_color;
extern char unspecified_fg[], unspecified_bg[];
-void free_realized_multibyte_face P_ ((struct frame *, int));
+extern Lisp_Object split_font_name_into_vector P_ ((Lisp_Object));
+extern Lisp_Object build_font_name_from_vector P_ ((Lisp_Object));
/* Defined in xfns.c */
void scrolling_1 P_ ((struct frame *, int, int, int, int *, int *, int *,
int *, int));
+/* Defined in frame.c */
+
+#ifdef HAVE_WINDOW_SYSTEM
+
+/* Types we might convert a resource string into. */
+enum resource_types
+{
+ RES_TYPE_NUMBER,
+ RES_TYPE_FLOAT,
+ RES_TYPE_BOOLEAN,
+ RES_TYPE_STRING,
+ RES_TYPE_SYMBOL
+};
+
+extern Lisp_Object x_get_arg P_ ((Display_Info *, Lisp_Object,
+ Lisp_Object, char *, char *class,
+ enum resource_types));
+extern Lisp_Object x_frame_get_arg P_ ((struct frame *, Lisp_Object,
+ Lisp_Object, char *, char *,
+ enum resource_types));
+extern Lisp_Object x_frame_get_and_record_arg P_ ((
+ struct frame *, Lisp_Object,
+ Lisp_Object, char *, char *,
+ enum resource_types));
+extern Lisp_Object x_default_parameter P_ ((struct frame *, Lisp_Object,
+ Lisp_Object, Lisp_Object,
+ char *, char *,
+ enum resource_types));
+
+#endif /* HAVE_WINDOW_SYSTEM */
+
#endif /* not DISPEXTERN_H_INCLUDED */