X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/490943fe146878558e7e123b0fe7ded4b8df6384..6b8aa22a8ac19a46416737a6579cfcb77f647f18:/src/dispextern.h diff --git a/src/dispextern.h b/src/dispextern.h index c59403b020..8e8d856198 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -1,6 +1,7 @@ /* Interface definitions for display code. Copyright (C) 1985, 1993, 1994, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. + 2003, 2004, 2005, 2006, 2007, 2008 + Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -350,13 +351,16 @@ struct glyph glyphs above or below it. */ unsigned overlaps_vertically_p : 1; - /* 1 means glyph is a padding glyph. Padding glyphs are used for - characters whose visual shape consists of more than one glyph - (e.g. Asian characters). All but the first glyph of such a glyph - sequence have the padding_p flag set. Only used for terminal - frames, and there only to minimize code changes. A better way - would probably be to use the width field of glyphs to express - padding. */ + /* For terminal frames, 1 means glyph is a padding glyph. Padding + glyphs are used for characters whose visual shape consists of + more than one glyph (e.g. Asian characters). All but the first + glyph of such a glyph sequence have the padding_p flag set. This + flag is used only to minimize code changes. A better way would + probably be to use the width field of glyphs to express padding. + + For graphic frames, 1 means the pixel width of the glyph in a + font is 0, but 1-pixel is padded on displaying for correct cursor + displaying. The member `pixel_width' above is set to 1. */ unsigned padding_p : 1; /* 1 means the actual glyph is not available, draw a box instead. @@ -414,7 +418,7 @@ struct glyph /* Is GLYPH a space? */ #define CHAR_GLYPH_SPACE_P(GLYPH) \ - (GLYPH_FROM_CHAR_GLYPH ((GLYPH)) == SPACEGLYPH) + ((GLYPH).u.ch == SPACEGLYPH && (GLYPH).face_id == DEFAULT_FACE_ID) /* Are glyph slices of glyphs *X and *Y equal */ @@ -461,18 +465,25 @@ struct glyph #define SET_CHAR_GLYPH_FROM_GLYPH(GLYPH, FROM) \ SET_CHAR_GLYPH ((GLYPH), \ - FAST_GLYPH_CHAR ((FROM)), \ - FAST_GLYPH_FACE ((FROM)), \ + GLYPH_CHAR ((FROM)), \ + GLYPH_FACE ((FROM)), \ 0) /* Construct a glyph code from a character glyph GLYPH. If the character is multibyte, return -1 as we can't use glyph table for a multibyte character. */ -#define GLYPH_FROM_CHAR_GLYPH(GLYPH) \ - ((GLYPH).u.ch < 256 \ - ? ((GLYPH).u.ch | ((GLYPH).face_id << CHARACTERBITS)) \ - : -1) +#define SET_GLYPH_FROM_CHAR_GLYPH(G, GLYPH) \ + do \ + { \ + if ((GLYPH).u.ch < 256) \ + SET_GLYPH ((G), (GLYPH).u.ch, ((GLYPH).face_id)); \ + else \ + SET_GLYPH ((G), -1, 0); \ + } \ + while (0) + +#define GLYPH_INVALID_P(GLYPH) (GLYPH_CHAR (GLYPH) < 0) /* Is GLYPH a padding glyph? */ @@ -680,9 +691,9 @@ struct glyph_row short used[LAST_AREA]; /* Window-relative x and y-position of the top-left corner of this - row. If y < 0, this means that abs (y) pixels of the row are + row. If y < 0, this means that eabs (y) pixels of the row are invisible because it is partially visible at the top of a window. - If x < 0, this means that abs (x) pixels of the first glyph of + If x < 0, this means that eabs (x) pixels of the first glyph of the text area of the row are invisible because the glyph is partially visible. */ int x, y; @@ -852,6 +863,12 @@ struct glyph_row /* Continuation lines width at the start of the row. */ int continuation_lines_width; + +#ifdef HAVE_WINDOW_SYSTEM + /* Non-NULL means the current clipping area. This is temporarily + set while exposing a region. Coordinates are frame-relative. */ + XRectangle *clip; +#endif }; @@ -1029,13 +1046,8 @@ extern int fonts_changed_p; extern struct glyph space_glyph; -/* Frame being updated by update_window/update_frame. */ - -extern struct frame *updating_frame; - /* Window being updated by update_window. This is non-null as long as - update_window has not finished, and null otherwise. It's role is - analogous to updating_frame. */ + update_window has not finished, and null otherwise. */ extern struct window *updated_window; @@ -1195,6 +1207,11 @@ struct glyph_string respectively. */ unsigned for_overlaps : 3; + /* 1 means that all glyphs in this glyph string has the flag + padding_p set, and thus must be drawn one by one to have 1-pixel + width even though the logical width in the font is zero. */ + unsigned padding_p : 1; + /* The GC to use for drawing this glyph string. */ #if defined(HAVE_X_WINDOWS) || defined(MAC_OS) GC gc; @@ -1220,6 +1237,12 @@ struct glyph_string *clip_tail, not including their overhangs. */ struct glyph_string *clip_head, *clip_tail; + /* The current clipping areas. */ + NativeRectangle clip[2]; + + /* Number of clipping areas. */ + int num_clips; + struct glyph_string *next, *prev; }; @@ -1355,7 +1378,7 @@ struct glyph_string DESCENT = FONT->descent HEIGHT = FONT_HEIGHT (FONT) F_DESCENT = (FRAME_FONT (F)->descent - - F->output_data.x->baseline_offset) + - F->terminal->output_data.x->baseline_offset) F_HEIGHT = FRAME_LINE_HEIGHT (F) */ @@ -1391,6 +1414,7 @@ enum lface_attribute_index LFACE_FONT_INDEX, LFACE_INHERIT_INDEX, LFACE_AVGWIDTH_INDEX, + LFACE_FONTSET_INDEX, LFACE_VECTOR_SIZE }; @@ -1475,10 +1499,10 @@ struct face 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. */ + struct font_info *font_info; + + /* 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. */ @@ -1510,13 +1534,6 @@ struct face /* 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; @@ -1562,9 +1579,13 @@ struct face /* 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; + + /* Extra member that a font-driver uses privately. */ + void *extra; }; @@ -1652,7 +1673,7 @@ struct face_cache /* 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))) @@ -1660,15 +1681,15 @@ struct face_cache 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 */ @@ -1786,6 +1807,7 @@ enum display_element_type enum prop_idx { + AUTO_COMPOSED_PROP_IDX, FONTIFIED_PROP_IDX, FACE_PROP_IDX, INVISIBLE_PROP_IDX, @@ -1912,20 +1934,27 @@ struct it position in overlay strings etc. */ struct display_pos current; + /* Total number of overlay strings to process. This can be > + OVERLAY_STRING_CHUNK_SIZE. */ + int n_overlay_strings; + /* Vector of overlays to process. Overlay strings are processed OVERLAY_STRING_CHUNK_SIZE at a time. */ #define OVERLAY_STRING_CHUNK_SIZE 16 Lisp_Object overlay_strings[OVERLAY_STRING_CHUNK_SIZE]; - /* Total number of overlay strings to process. This can be > - OVERLAY_STRING_CHUNK_SIZE. */ - int n_overlay_strings; + /* For each overlay string, the overlay it came from. */ + Lisp_Object string_overlays[OVERLAY_STRING_CHUNK_SIZE]; /* If non-nil, a Lisp string being processed. If current.overlay_string_index >= 0, this is an overlay string from pos. */ Lisp_Object string; + /* If non-nil, we are processing a string that came + from a `display' property given by an overlay. */ + Lisp_Object from_overlay; + /* Stack of saved values. New entries are pushed when we begin to process an overlay string or a string from a `glyph' property. Entries are popped when we return to deliver display elements @@ -1961,6 +1990,7 @@ struct it /* current text and display positions. */ struct text_pos position; struct display_pos current; + Lisp_Object from_overlay; enum glyph_row_area area; enum it_method method; unsigned multibyte_p : 1; @@ -1977,13 +2007,6 @@ struct it /* Stack pointer. */ int sp; - /* Setting of buffer-local variable selective-display-ellipsis. */ - unsigned selective_display_ellipsis_p : 1; - - /* 1 means control characters are translated into the form `^C' - where the `^' can be replaced by a display table entry. */ - unsigned ctl_arrow_p : 1; - /* -1 means selective display hides everything between a \r and the next newline; > 0 means hide lines indented more than that value. */ int selective; @@ -1995,6 +2018,16 @@ struct it /* Face to use. */ int face_id; + /* Setting of buffer-local variable selective-display-ellipsis. */ + unsigned selective_display_ellipsis_p : 1; + + /* 1 means control characters are translated into the form `^C' + where the `^' can be replaced by a display table entry. */ + unsigned ctl_arrow_p : 1; + + /* 1 means lines are truncated. */ + unsigned truncate_lines_p : 1; + /* Non-zero means that the current face has a box. */ unsigned face_box_p : 1; @@ -2074,9 +2107,6 @@ struct it Lisp_Object object; struct text_pos position; - /* 1 means lines are truncated. */ - unsigned truncate_lines_p : 1; - /* Number of columns per \t. */ short tab_width; @@ -2187,16 +2217,16 @@ struct it /* Call produce_glyphs or produce_glyphs_hook, if set. Shortcut to avoid the function call overhead. */ -#define PRODUCE_GLYPHS(IT) \ - do { \ - extern int inhibit_free_realized_faces; \ - if (rif != NULL) \ - rif->produce_glyphs ((IT)); \ - else \ - produce_glyphs ((IT)); \ - if ((IT)->glyph_row != NULL) \ - inhibit_free_realized_faces = 1; \ - } while (0) +#define PRODUCE_GLYPHS(IT) \ + do { \ + extern int inhibit_free_realized_faces; \ + if (FRAME_RIF ((IT)->f) != NULL) \ + FRAME_RIF ((IT)->f)->produce_glyphs ((IT)); \ + else \ + produce_glyphs ((IT)); \ + if ((IT)->glyph_row != NULL) \ + inhibit_free_realized_faces = 1; \ + } while (0) /* Bit-flags indicating what operation move_it_to should perform. */ @@ -2330,7 +2360,9 @@ struct redisplay_interface 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. */ @@ -2370,10 +2402,6 @@ struct redisplay_interface #endif /* HAVE_WINDOW_SYSTEM */ }; -/* The current interface for window-based redisplay. */ - -extern struct redisplay_interface *rif; - /*********************************************************************** Images @@ -2474,6 +2502,11 @@ struct image /* Lisp specification of this image. */ Lisp_Object spec; + /* List of "references" followed to build the image. + Typically will just contain the name of the image file. + Used to allow fine-grained cache flushing. */ + Lisp_Object dependencies; + /* Relief to draw around the image. */ int relief; @@ -2534,8 +2567,8 @@ struct image_cache no image with that id exists. */ #define IMAGE_FROM_ID(F, ID) \ - (((ID) >= 0 && (ID) < (FRAME_X_IMAGE_CACHE (F)->used)) \ - ? FRAME_X_IMAGE_CACHE (F)->images[ID] \ + (((ID) >= 0 && (ID) < (FRAME_IMAGE_CACHE (F)->used)) \ + ? FRAME_IMAGE_CACHE (F)->images[ID] \ : NULL) /* Size of bucket vector of image caches. Should be prime. */ @@ -2677,8 +2710,6 @@ void init_iterator_to_row_start P_ ((struct it *, struct window *, struct glyph_row *)); int get_next_display_element P_ ((struct it *)); void set_iterator_to_next P_ ((struct it *, int)); -void produce_glyphs P_ ((struct it *)); -void produce_special_glyphs P_ ((struct it *, enum display_element_type)); void start_display P_ ((struct it *, struct window *, struct text_pos)); void move_it_to P_ ((struct it *, int, int, int, int, int)); void move_it_vertically P_ ((struct it *, int)); @@ -2775,12 +2806,12 @@ int draw_window_fringes P_ ((struct window *, int)); int update_window_fringes P_ ((struct window *, int)); void compute_fringe_widths P_ ((struct frame *, int)); -#ifdef WINDOWS_NT -void w32_init_fringe P_ ((void)); +#ifdef WINDOWSNT +void w32_init_fringe P_ ((struct redisplay_interface *)); void w32_reset_fringes P_ ((void)); #endif #ifdef MAC_OS -void mac_init_fringe P_ ((void)); +void mac_init_fringe P_ ((struct redisplay_interface *)); #endif /* Defined in image.c */ @@ -2807,9 +2838,8 @@ extern Lisp_Object x_find_image_file P_ ((Lisp_Object)); void x_kill_gs_process P_ ((Pixmap, struct frame *)); struct image_cache *make_image_cache P_ ((void)); void free_image_cache P_ ((struct frame *)); -void clear_image_cache P_ ((struct frame *, int)); -void forall_images_in_image_cache P_ ((struct frame *, - void (*) P_ ((struct image *)))); +void clear_image_caches P_ ((Lisp_Object)); +void mark_image_cache P_ ((struct image_cache *)); int valid_image_p P_ ((Lisp_Object)); void prepare_image_for_display P_ ((struct frame *, struct image *)); int lookup_image P_ ((struct frame *, Lisp_Object)); @@ -2825,11 +2855,11 @@ int image_ascent P_ ((struct image *, struct face *, struct glyph_slice *)); /* Defined in sysdep.c */ -void get_frame_size P_ ((int *, int *)); +void get_tty_size P_ ((int, int *, int *)); void request_sigio P_ ((void)); void unrequest_sigio P_ ((void)); -int tabs_safe_p P_ ((void)); -void init_baud_rate P_ ((void)); +int tabs_safe_p P_ ((int)); +void init_baud_rate P_ ((int)); void init_sigio P_ ((int)); /* Defined in xfaces.c */ @@ -2845,32 +2875,41 @@ void clear_face_cache P_ ((int)); unsigned long load_color P_ ((struct frame *, struct face *, Lisp_Object, enum lface_attribute_index)); void unload_color P_ ((struct frame *, unsigned long)); -int face_font_available_p P_ ((struct frame *, Lisp_Object)); +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)); +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)); 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)); +int lookup_derived_face P_ ((struct frame *, Lisp_Object, int, int)); void init_frame_faces P_ ((struct frame *)); void free_frame_faces P_ ((struct frame *)); void recompute_basic_faces P_ ((struct frame *)); -int face_at_buffer_position P_ ((struct window *, int, int, int, int *, - int, int)); -int face_at_buffer_position_no_overlays P_ ((struct window *, int, int, - int, int *, - int, int)); -int face_at_string_position P_ ((struct window *, Lisp_Object, int, int, int, - int, int *, enum face_id, int)); +int face_at_buffer_position P_ ((struct window *w, EMACS_INT pos, + EMACS_INT region_beg, EMACS_INT region_end, + EMACS_INT *endptr, EMACS_INT limit, + int mouse)); +int face_for_overlay_string P_ ((struct window *w, EMACS_INT pos, + EMACS_INT region_beg, EMACS_INT region_end, + EMACS_INT *endptr, EMACS_INT limit, + int mouse, Lisp_Object overlay)); +int face_at_string_position P_ ((struct window *w, Lisp_Object string, + EMACS_INT pos, EMACS_INT bufpos, + EMACS_INT region_beg, EMACS_INT region_end, + EMACS_INT *endptr, enum face_id, int mouse)); int merge_faces P_ ((struct frame *, Lisp_Object, int, 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 Lisp_Object Qframe_set_background_mode; 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 */ @@ -2971,8 +3010,6 @@ void clear_glyph_row P_ ((struct glyph_row *)); void prepare_desired_row P_ ((struct glyph_row *)); int line_hash_code P_ ((struct glyph_row *)); void set_window_update_flags P_ ((struct window *, int)); -void write_glyphs P_ ((struct glyph *, int)); -void insert_glyphs P_ ((struct glyph *, int)); void redraw_frame P_ ((struct frame *)); void redraw_garbaged_frames P_ ((void)); int scroll_cost P_ ((struct frame *, int, int, int)); @@ -2987,33 +3024,46 @@ void bitch_at_user P_ ((void)); void init_display P_ ((void)); void syms_of_display P_ ((void)); extern Lisp_Object Qredisplay_dont_pause; -GLYPH spec_glyph_lookup_face P_ ((struct window *, GLYPH)); +void spec_glyph_lookup_face P_ ((struct window *, GLYPH *)); -/* Defined in term.c */ +/* Defined in terminal.c */ -extern void ring_bell P_ ((void)); -extern void set_terminal_modes P_ ((void)); -extern void reset_terminal_modes P_ ((void)); +extern void ring_bell P_ ((struct frame *)); extern void update_begin P_ ((struct frame *)); extern void update_end P_ ((struct frame *)); -extern void set_terminal_window P_ ((int)); -extern void set_scroll_region P_ ((int, int)); -extern void turn_off_insert P_ ((void)); -extern void turn_off_highlight P_ ((void)); -extern void background_highlight P_ ((void)); -extern void clear_frame P_ ((void)); -extern void clear_end_of_line P_ ((int)); -extern void clear_end_of_line_raw P_ ((int)); -extern void delete_glyphs P_ ((int)); -extern void ins_del_lines P_ ((int, int)); +extern void set_terminal_window P_ ((struct frame *, int)); +extern void cursor_to P_ ((struct frame *, int, int)); +extern void raw_cursor_to P_ ((struct frame *, int, int)); +extern void clear_to_end P_ ((struct frame *)); +extern void clear_frame P_ ((struct frame *)); +extern void clear_end_of_line P_ ((struct frame *, int)); +extern void write_glyphs P_ ((struct frame *, struct glyph *, int)); +extern void insert_glyphs P_ ((struct frame *, struct glyph *, int)); +extern void delete_glyphs P_ ((struct frame *, int)); +extern void ins_del_lines P_ ((struct frame *, int, int)); + +extern struct terminal *init_initial_terminal P_ ((void)); + + +/* Defined in term.c */ + +extern void tty_set_terminal_modes P_ ((struct terminal *)); +extern void tty_reset_terminal_modes P_ ((struct terminal *)); +extern void tty_turn_off_insert P_ ((struct tty_display_info *)); +extern void tty_turn_off_highlight P_ ((struct tty_display_info *)); extern int string_cost P_ ((char *)); extern int per_line_cost P_ ((char *)); extern void calculate_costs P_ ((struct frame *)); +extern void produce_glyphs P_ ((struct it *)); +extern void produce_special_glyphs P_ ((struct it *, enum display_element_type)); +extern int tty_capable_p P_ ((struct tty_display_info *, unsigned, unsigned long, unsigned long)); extern void set_tty_color_mode P_ ((struct frame *, Lisp_Object)); -extern void tty_setup_colors P_ ((int)); -extern void term_init P_ ((char *)); -void cursor_to P_ ((int, int)); -extern int tty_capable_p P_ ((struct frame *, unsigned, unsigned long, unsigned long)); +extern struct terminal *get_tty_terminal P_ ((Lisp_Object, int)); +extern struct terminal *get_named_tty P_ ((char *)); +EXFUN (Ftty_type, 1); +extern void create_tty_output P_ ((struct frame *)); +extern struct terminal *init_tty P_ ((char *, char *, int)); + /* Defined in scroll.c */