X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/d235ca2ff8fab139ce797757fcb159d1e28fa7e0..99f3388e53a58a319a0584358b3ca0d151e50328:/src/dispextern.h diff --git a/src/dispextern.h b/src/dispextern.h index daca52590b..dba0d06732 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -1,14 +1,14 @@ /* Interface definitions for display code. Copyright (C) 1985, 1993, 1994, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005, 2006, 2007, 2008 + 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. -GNU Emacs is free software; you can redistribute it and/or modify +GNU Emacs is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 3, or (at your option) -any later version. +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. GNU Emacs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -16,9 +16,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with GNU Emacs; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -Boston, MA 02110-1301, USA. */ +along with GNU Emacs. If not, see . */ /* New redisplay written by Gerd Moellmann . */ @@ -63,10 +61,10 @@ typedef XImage *XImagePtr; typedef HDC XImagePtr_or_DC; #endif -#ifdef MAC_OS -#include "macgui.h" -typedef struct mac_display_info Display_Info; -/* Mac equivalent of XImage. */ +#ifdef HAVE_NS +#include "nsgui.h" +/* following typedef needed to accomodate the MSDOS port, believe it or not */ +typedef struct ns_display_info Display_Info; typedef Pixmap XImagePtr; typedef XImagePtr XImagePtr_or_DC; #endif @@ -107,6 +105,8 @@ enum window_part /* Number of bits allocated to store fringe bitmap numbers. */ #define FRINGE_ID_BITS 16 +/* Number of bits allocated to store fringe bitmap height. */ +#define FRINGE_HEIGHT_BITS 8 /*********************************************************************** @@ -175,10 +175,10 @@ extern int trace_redisplay_p; struct text_pos { /* Character position. */ - int charpos; + EMACS_INT charpos; /* Corresponding byte position. */ - int bytepos; + EMACS_INT bytepos; }; /* Access character and byte position of POS in a functional form. */ @@ -276,7 +276,7 @@ enum glyph_type /* Glyph describes a character. */ CHAR_GLYPH, - /* Glyph describes a composition sequence. */ + /* Glyph describes a static composition. */ COMPOSITE_GLYPH, /* Glyph describes an image. */ @@ -313,7 +313,7 @@ struct glyph buffer, this is a position in that buffer. A value of -1 together with a null object means glyph is a truncation glyph at the start of a row. */ - int charpos; + EMACS_INT charpos; /* Lisp object source of this glyph. Currently either a buffer or a string, if the glyph was produced from characters which came from @@ -351,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. @@ -365,7 +368,21 @@ struct glyph doesn't have a glyph in a font. */ unsigned glyph_not_available_p : 1; -#define FACE_ID_BITS 21 + + /* Non-zero means don't display cursor here. */ + unsigned avoid_cursor_p : 1; + + /* Resolved bidirectional level of this character [0..63]. */ + unsigned resolved_level : 5; + + /* Resolved bidirectional type of this character, see enum + bidi_type_t below. Note that according to UAX#9, only some + values (STRONG_L, STRONG_R, WEAK_AN, WEAK_EN, WEAK_BN, and + NEUTRAL_B) can appear in the resolved type, so we only reserve + space for those that can. */ + unsigned bidi_type : 3; + +#define FACE_ID_BITS 20 /* Face of the glyph. This is a realized face ID, an index in the face cache of the frame. */ @@ -385,8 +402,17 @@ struct glyph /* Character code for character glyphs (type == CHAR_GLYPH). */ unsigned ch; - /* Composition ID for composition glyphs (type == COMPOSITION_GLYPH) */ - unsigned cmp_id; + /* Sub-structures for type == COMPOSITION_GLYPH. */ + struct + { + /* Flag to tell if the composition is automatic or not. */ + unsigned automatic : 1; + /* ID of the composition. */ + unsigned id : 23; + /* Start and end indices of glyphs of the composition. */ + unsigned from : 4; + unsigned to : 4; + } cmp; /* Image ID for image glyphs (type == IMAGE_GLYPH). */ unsigned img_id; @@ -415,7 +441,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 */ @@ -462,18 +488,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? */ @@ -611,7 +644,7 @@ struct glyph_matrix This aborts if any pointer is found twice. */ #if GLYPH_DEBUG -void check_matrix_pointer_lossage P_ ((struct glyph_matrix *)); +void check_matrix_pointer_lossage (struct glyph_matrix *); #define CHECK_MATRIX(MATRIX) check_matrix_pointer_lossage ((MATRIX)) #else #define CHECK_MATRIX(MATRIX) (void) 0 @@ -717,17 +750,29 @@ struct glyph_row /* First position in this row. This is the text position, including overlay position information etc, where the display of this row - started, and can thus be less the position of the first glyph - (e.g. due to invisible text or horizontal scrolling). */ + started, and can thus be less than the position of the first + glyph (e.g. due to invisible text or horizontal scrolling). + BIDI Note: In R2L rows, that have its reversed_p flag set, this + position is at or beyond the right edge of the row. */ struct display_pos start; /* Text position at the end of this row. This is the position after the last glyph on this row. It can be greater than the last - glyph position + 1, due to truncation, invisible text etc. In an - up-to-date display, this should always be equal to the start - position of the next row. */ + glyph position + 1, due to a newline that ends the line, + truncation, invisible text etc. In an up-to-date display, this + should always be equal to the start position of the next row. + BIDI Note: In R2L rows, this position is at or beyond the left + edge of the row. */ struct display_pos end; + /* The smallest and the largest buffer positions that contributed to + glyphs in this row. Note that due to bidi reordering, these are + in general different from the text positions stored in `start' + and `end' members above, and also different from the buffer + positions recorded in the glyphs displayed the leftmost and + rightmost on the screen. */ + struct text_pos minpos, maxpos; + /* Non-zero means the overlay arrow bitmap is on this line. -1 means use default overlay arrow bitmap, else it specifies actual fringe bitmap number. */ @@ -757,6 +802,12 @@ struct glyph_row /* Face of the right fringe glyph. */ unsigned right_fringe_face_id : FACE_ID_BITS; + /* Vertical offset of the left fringe bitmap. */ + signed left_fringe_offset : FRINGE_HEIGHT_BITS; + + /* Vertical offset of the right fringe bitmap. */ + signed right_fringe_offset : FRINGE_HEIGHT_BITS; + /* 1 means that we must draw the bitmaps of this row. */ unsigned redraw_fringe_bitmaps_p : 1; @@ -851,6 +902,10 @@ struct glyph_row the bottom line of the window, but not end of the buffer. */ unsigned indicate_bottom_line_p : 1; + /* Non-zero means the row was reversed to display text in a + right-to-left paragraph. */ + unsigned reversed_p : 1; + /* Continuation lines width at the start of the row. */ int continuation_lines_width; @@ -867,7 +922,7 @@ struct glyph_row we don't try to access rows that are out of bounds. */ #if GLYPH_DEBUG -struct glyph_row *matrix_row P_ ((struct glyph_matrix *, int)); +struct glyph_row *matrix_row (struct glyph_matrix *, int); #define MATRIX_ROW(MATRIX, ROW) matrix_row ((MATRIX), (ROW)) #else #define MATRIX_ROW(MATRIX, ROW) ((MATRIX)->rows + (ROW)) @@ -903,15 +958,21 @@ struct glyph_row *matrix_row P_ ((struct glyph_matrix *, int)); (MATRIX_ROW ((MATRIX), (ROW))->used[TEXT_AREA]) /* Return the character/ byte position at which the display of ROW - starts. */ + starts. BIDI Note: this is the smallest character/byte position + among characters in ROW, i.e. the first logical-order character + displayed by ROW, which is not necessarily the smallest horizontal + position. */ -#define MATRIX_ROW_START_CHARPOS(ROW) ((ROW)->start.pos.charpos) -#define MATRIX_ROW_START_BYTEPOS(ROW) ((ROW)->start.pos.bytepos) +#define MATRIX_ROW_START_CHARPOS(ROW) ((ROW)->minpos.charpos) +#define MATRIX_ROW_START_BYTEPOS(ROW) ((ROW)->minpos.bytepos) -/* Return the character/ byte position at which ROW ends. */ +/* Return the character/ byte position at which ROW ends. BIDI Note: + this is the largest character/byte position among characters in + ROW, i.e. the last logical-order character displayed by ROW, which + is not necessarily the largest horizontal position. */ -#define MATRIX_ROW_END_CHARPOS(ROW) ((ROW)->end.pos.charpos) -#define MATRIX_ROW_END_BYTEPOS(ROW) ((ROW)->end.pos.bytepos) +#define MATRIX_ROW_END_CHARPOS(ROW) ((ROW)->maxpos.charpos) +#define MATRIX_ROW_END_BYTEPOS(ROW) ((ROW)->maxpos.bytepos) /* Return the vertical position of ROW in MATRIX. */ @@ -1057,17 +1118,9 @@ extern int cursor_in_echo_area; extern int display_completed; -/* Non-zero means redisplay has been performed directly (see also - direct_output_for_insert and direct_output_forward_char), so that - no further updating has to be performed. The function - redisplay_internal checks this flag, and does nothing but reset it - to zero if it is non-zero. */ - -extern int redisplay_performed_directly_p; - /* A temporary storage area, including a row of glyphs. Initialized in xdisp.c. Used for various purposes, as an example see - direct_output_for_insert. */ + get_overlay_arrow_glyph_row. */ extern struct glyph_row scratch_glyph_row; @@ -1151,19 +1204,17 @@ struct glyph_string struct face *face; /* Font in which this string is to be drawn. */ - XFontStruct *font; - - /* Font info for this string. */ - struct font_info *font_info; + struct font *font; - /* Non-null means this string describes (part of) a composition. - All characters from char2b are drawn composed. */ + /* Non-null means this string describes (part of) a static + composition. */ struct composition *cmp; - /* Index of this glyph string's first character in the glyph - definition of CMP. If this is zero, this glyph string describes - the first character of a composition. */ - int gidx; + /* If not negative, this string describes a compos. */ + int cmp_id; + + /* Start and end glyph indices in a glyph-string. */ + int cmp_from, cmp_to; /* 1 means this glyph strings face has to be drawn to the right end of the window's drawing area. */ @@ -1197,8 +1248,13 @@ 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) +#if defined(HAVE_X_WINDOWS) GC gc; #endif #if defined(HAVE_NTGUI) @@ -1228,6 +1284,10 @@ struct glyph_string /* Number of clipping areas. */ int num_clips; + int underline_position; + + int underline_thickness; + struct glyph_string *next, *prev; }; @@ -1384,6 +1444,7 @@ struct glyph_string enum lface_attribute_index { LFACE_FAMILY_INDEX = 1, + LFACE_FOUNDRY_INDEX, LFACE_SWIDTH_INDEX, LFACE_HEIGHT_INDEX, LFACE_WEIGHT_INDEX, @@ -1398,7 +1459,6 @@ enum lface_attribute_index LFACE_BOX_INDEX, LFACE_FONT_INDEX, LFACE_INHERIT_INDEX, - LFACE_AVGWIDTH_INDEX, LFACE_FONTSET_INDEX, LFACE_VECTOR_SIZE }; @@ -1441,12 +1501,6 @@ struct face drawing the characters in this face. */ GC gc; - /* Font used for this face, or null if the font could not be loaded - for some reason. This points to a `font' slot of a struct - font_info, and we should not call XFreeFont on it because the - font may still be used somewhere else. */ - XFontStruct *font; - /* Background stipple or bitmap used for this face. This is an id as returned from load_pixmap. */ int stipple; @@ -1474,17 +1528,7 @@ struct face unsigned long strike_through_color; unsigned long box_color; - /* The font's name. This points to a `name' of a font_info, and it - must not be freed. */ - char *font_name; - - /* Font info ID for this face's font. An ID is stored here because - pointers to font_info structures may change. The reason is that - they are pointers into a font table vector that is itself - reallocated. */ - int font_info_id; - - struct font_info *font_info; + struct font *font; /* Fontset ID if for this face's fontset. Non-ASCII faces derived from the same ASCII face have the same fontset. */ @@ -1512,13 +1556,6 @@ struct face drawing shadows. */ unsigned use_box_color_for_shadows_p : 1; - /* The Lisp face attributes this face realizes. All attributes - in this vector are non-nil. */ - Lisp_Object lface[LFACE_VECTOR_SIZE]; - - /* The hash value of this face. */ - unsigned hash; - /* Non-zero if text in this face should be underlined, overlined, strike-through or have a box drawn around it. */ unsigned underline_p : 1; @@ -1561,6 +1598,20 @@ struct face /* If non-zero, use overstrike (to simulate bold-face). */ unsigned overstrike : 1; +/* NOTE: this is not used yet, but eventually this impl should be done + similarly to overstrike */ +#ifdef HAVE_NS + /* If non-zero, use geometric rotation (to simulate italic). */ + unsigned synth_ital : 1; +#endif + + /* The Lisp face attributes this face realizes. All attributes + in this vector are non-nil. */ + Lisp_Object lface[LFACE_VECTOR_SIZE]; + + /* The hash value of this face. */ + unsigned hash; + /* Next and previous face in hash collision list of face cache. */ struct face *next, *prev; @@ -1683,7 +1734,93 @@ struct face_cache extern int face_change_count; +/* For reordering of bidirectional text. */ +#define BIDI_MAXLEVEL 64 + +/* Data type for describing the bidirectional character types. The + first 7 must be at the beginning, because they are the only values + valid in the `bidi_type' member of `struct glyph'; we only reserve + 3 bits for it, so we cannot use there values larger than 7. */ +typedef enum { + UNKNOWN_BT = 0, + STRONG_L, /* strong left-to-right */ + STRONG_R, /* strong right-to-left */ + WEAK_EN, /* european number */ + WEAK_AN, /* arabic number */ + WEAK_BN, /* boundary neutral */ + NEUTRAL_B, /* paragraph separator */ + STRONG_AL, /* arabic right-to-left letter */ + LRE, /* left-to-right embedding */ + LRO, /* left-to-right override */ + RLE, /* right-to-left embedding */ + RLO, /* right-to-left override */ + PDF, /* pop directional format */ + WEAK_ES, /* european number separator */ + WEAK_ET, /* european number terminator */ + WEAK_CS, /* common separator */ + WEAK_NSM, /* non-spacing mark */ + NEUTRAL_S, /* segment separator */ + NEUTRAL_WS, /* whitespace */ + NEUTRAL_ON /* other neutrals */ +} bidi_type_t; + +/* The basic directionality data type. */ +typedef enum { NEUTRAL_DIR, L2R, R2L } bidi_dir_t; + +/* Data type for storing information about characters we need to + remember. */ +struct bidi_saved_info { + int bytepos, charpos; /* character's buffer position */ + bidi_type_t type; /* character's resolved bidi type */ + bidi_type_t type_after_w1; /* original type of the character, after W1 */ + bidi_type_t orig_type; /* type as we found it in the buffer */ +}; + +/* Data type for keeping track of saved embedding levels and override + status information. */ +struct bidi_stack { + int level; + bidi_dir_t override; +}; + +/* Data type for iterating over bidi text. */ +struct bidi_it { + EMACS_INT bytepos; /* iterator's position in buffer */ + EMACS_INT charpos; + int ch; /* character itself */ + int ch_len; /* length of its multibyte sequence */ + bidi_type_t type; /* bidi type of this character, after + resolving weak and neutral types */ + bidi_type_t type_after_w1; /* original type, after overrides and W1 */ + bidi_type_t orig_type; /* original type, as found in the buffer */ + int resolved_level; /* final resolved level of this character */ + int invalid_levels; /* how many PDFs to ignore */ + int invalid_rl_levels; /* how many PDFs from RLE/RLO to ignore */ + int prev_was_pdf; /* if non-zero, previous char was PDF */ + struct bidi_saved_info prev; /* info about previous character */ + struct bidi_saved_info last_strong; /* last-seen strong directional char */ + struct bidi_saved_info next_for_neutral; /* surrounding characters for... */ + struct bidi_saved_info prev_for_neutral; /* ...resolving neutrals */ + struct bidi_saved_info next_for_ws; /* character after sequence of ws */ + EMACS_INT next_en_pos; /* position of next EN char for ET */ + EMACS_INT ignore_bn_limit; /* position until which to ignore BNs */ + bidi_dir_t sor; /* direction of start-of-run in effect */ + int scan_dir; /* direction of text scan, 1: forw, -1: back */ + int stack_idx; /* index of current data on the stack */ + /* Note: Everything from here on is not copied/saved when the bidi + iterator state is saved, pushed, or popped. So only put here + stuff that is not part of the bidi iterator's state! */ + struct bidi_stack level_stack[BIDI_MAXLEVEL]; /* stack of embedding levels */ + int first_elt; /* if non-zero, examine current char first */ + bidi_dir_t paragraph_dir; /* current paragraph direction */ + int new_paragraph; /* if non-zero, we expect a new paragraph */ + EMACS_INT separator_limit; /* where paragraph separator should end */ +}; +/* Value is non-zero when the bidi iterator is at base paragraph + embedding level. */ +#define BIDI_AT_BASE_LEVEL(BIDI_IT) \ + ((BIDI_IT).resolved_level == (BIDI_IT).level_stack[0].level) /*********************************************************************** @@ -1765,7 +1902,7 @@ enum display_element_type /* A normal character. */ IT_CHARACTER, - /* A composition sequence. */ + /* A composition (static and automatic). */ IT_COMPOSITION, /* An image. */ @@ -1792,7 +1929,6 @@ enum display_element_type enum prop_idx { - AUTO_COMPOSED_PROP_IDX, FONTIFIED_PROP_IDX, FACE_PROP_IDX, INVISIBLE_PROP_IDX, @@ -1806,6 +1942,14 @@ enum prop_idx LAST_PROP_IDX }; +/* An enumerator for the method of wrapping long lines. */ + +enum line_wrap_method +{ + TRUNCATE, + WORD_WRAP, + WINDOW_WRAP +}; struct it_slice { @@ -1821,7 +1965,6 @@ struct it_slice enum it_method { GET_FROM_BUFFER = 0, GET_FROM_DISPLAY_VECTOR, - GET_FROM_COMPOSITION, GET_FROM_STRING, GET_FROM_C_STRING, GET_FROM_IMAGE, @@ -1829,7 +1972,52 @@ enum it_method { NUM_IT_METHODS }; -#define IT_STACK_SIZE 4 +/* FIXME: What is this? Why 5? */ +#define IT_STACK_SIZE 5 + +/* Iterator for composition (both for static and automatic). */ +struct composition_it +{ + /* Next position at which to check the composition. */ + EMACS_INT stop_pos; + /* ID number of the composition or glyph-string. If negative, we + are not iterating over a composition now. */ + int id; + /* If non-negative, character that triggers the automatic + composition at `stop_pos', and this is an automatic composition. + If negative, this is a static composition. This is set to -2 + temporarily if searching of composition reach a limit or a + newline. */ + int ch; + /* If this is an automatic composition, index of a rule for making + the automatic composition. Provided that ELT is an element of + Vcomposition_function_table for CH, (nth ELT RULE_IDX) is the + rule for the composition. */ + int rule_idx; + /* If this is an automatic composition, how many characters to look + back from the position where a character triggering the + composition exists. */ + int lookback; + /* If non-negative, number of glyphs of the glyph-string. */ + int nglyphs; + /* Nonzero iff the composition is created while buffer is scanned in + reverse order, and thus the grapheme clusters must be rendered + from the last to the first. */ + int reversed_p; + + /** The following members contain information about the current + grapheme cluster. */ + /* Position of the first character of the current grapheme cluster. */ + EMACS_INT charpos; + /* Number of characters and bytes of the current grapheme cluster. */ + int nchars, nbytes; + /* Indices of the glyphs for the current grapheme cluster. */ + int from, to; + /* Width of the current grapheme cluster in units of pixels on a + graphic display and in units of canonical characters on a + terminal display. */ + int width; +}; struct it { @@ -1845,11 +2033,19 @@ struct it /* The next position at which to check for face changes, invisible text, overlay strings, end of text etc., which see. */ - int stop_charpos; + EMACS_INT stop_charpos; + + /* Previous stop position, i.e. the last one before the current + iterator position in `current'. */ + EMACS_INT prev_stop; + + /* Last stop position iterated across whose bidi embedding level is + equal to the current paragraph's base embedding level. */ + EMACS_INT base_level_stop; /* Maximum string or buffer position + 1. ZV when iterating over current_buffer. */ - int end_charpos; + EMACS_INT end_charpos; /* C string to iterate over. Non-null means get characters from this string, otherwise characters are read from current_buffer @@ -1862,10 +2058,10 @@ struct it /* Start and end of a visible region; -1 if the region is not visible in the window. */ - int region_beg_charpos, region_end_charpos; + EMACS_INT region_beg_charpos, region_end_charpos; /* Position at which redisplay end trigger functions should be run. */ - int redisplay_end_trigger_charpos; + EMACS_INT redisplay_end_trigger_charpos; /* 1 means multibyte characters are enabled. */ unsigned multibyte_p : 1; @@ -1881,6 +2077,9 @@ struct it this is 1 if we're doing an ellipsis. Otherwise meaningless. */ unsigned ellipsis_p : 1; + /* True means cursor shouldn't be displayed here. */ + unsigned avoid_cursor_p : 1; + /* Display table in effect or null for none. */ struct Lisp_Char_Table *dp; @@ -1948,8 +2147,11 @@ struct it { Lisp_Object string; int string_nchars; - int end_charpos; - int stop_charpos; + EMACS_INT end_charpos; + EMACS_INT stop_charpos; + EMACS_INT prev_stop; + EMACS_INT base_level_stop; + struct composition_it cmp_it; int face_id; /* Save values specific to a given method. */ @@ -1963,8 +2165,6 @@ struct it /* method == GET_FROM_COMPOSITION */ struct { Lisp_Object object; - int c, len; - int cmp_id, cmp_len; } comp; /* method == GET_FROM_STRETCH */ struct { @@ -1981,11 +2181,13 @@ struct it unsigned multibyte_p : 1; unsigned string_from_display_prop_p : 1; unsigned display_ellipsis_p : 1; + unsigned avoid_cursor_p : 1; + enum line_wrap_method line_wrap; /* properties from display property that are reset by another display property. */ + short voffset; Lisp_Object space_width; Lisp_Object font_height; - short voffset; } stack[IT_STACK_SIZE]; @@ -2010,9 +2212,6 @@ struct it 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; @@ -2048,22 +2247,33 @@ struct it descent/ascent (line-height property). Reset after this glyph. */ unsigned constrain_row_ascent_descent_p : 1; + enum line_wrap_method line_wrap; + /* The ID of the default face to use. One of DEFAULT_FACE_ID, MODE_LINE_FACE_ID, etc, depending on what we are displaying. */ int base_face_id; - /* If what == IT_CHARACTER, character and length in bytes. This is - a character from a buffer or string. It may be different from - the character displayed in case that - unibyte_display_via_language_environment is set. + /* If `what' == IT_CHARACTER, the character and the length in bytes + of its multibyte sequence. The character comes from a buffer or + a string. It may be different from the character displayed in + case that unibyte_display_via_language_environment is set. + + If `what' == IT_COMPOSITION, the first component of a composition + and length in bytes of the composition. + + If `what' is anything else, these two are undefined (will + probably hold values for the last IT_CHARACTER or IT_COMPOSITION + traversed by the iterator. - If what == IT_COMPOSITION, the first component of a composition - and length in bytes of the composition. */ + The values are updated by get_next_display_element, so they are + out of sync with the value returned by IT_CHARPOS between the + time set_iterator_to_next advances the position and the time + get_next_display_element loads the new values into c and len. */ int c, len; - /* If what == IT_COMPOSITION, identification number and length in - chars of a composition. */ - int cmp_id, cmp_len; + /* If what == IT_COMPOSITION, iterator substructure for the + composition. */ + struct composition_it cmp_it; /* The character to display, possibly translated to multibyte if unibyte_display_via_language_environment is set. This @@ -2082,6 +2292,9 @@ struct it /* Computed from the value of the `raise' property. */ short voffset; + /* Number of columns per \t. */ + short tab_width; + /* Value of the `height' property, if any; nil if none. */ Lisp_Object font_height; @@ -2092,9 +2305,6 @@ struct it Lisp_Object object; struct text_pos position; - /* Number of columns per \t. */ - short tab_width; - /* Width in pixels of truncation and continuation glyphs. */ short truncation_pixel_width, continuation_pixel_width; @@ -2149,6 +2359,14 @@ struct it incremented/reset by display_line, move_it_to etc. */ int continuation_lines_width; + /* Buffer position that ends the buffer text line being iterated. + This is normally the position after the newline at EOL. If this + is the last line of the buffer and it doesn't have a newline, + value is ZV/ZV_BYTE. Set and used only if IT->bidi_p, for + setting the end position of glyph rows produced for continuation + lines, see display_line. */ + struct text_pos eol_pos; + /* Current y-position. Automatically incremented by the height of glyph_row in move_it_to and display_line. */ int current_y; @@ -2175,6 +2393,14 @@ struct it /* Face of the right fringe glyph. */ unsigned right_user_fringe_face_id : FACE_ID_BITS; + + /* Non-zero means we need to reorder bidirectional text for display + in the visual order. */ + int bidi_p; + + /* For iterating over bidirectional text. */ + struct bidi_it bidi_it; + bidi_dir_t paragraph_embedding; }; @@ -2199,12 +2425,19 @@ struct it && ((IT)->c == '\n' \ || ((IT)->c == '\r' && (IT)->selective))) -/* Call produce_glyphs or produce_glyphs_hook, if set. Shortcut to - avoid the function call overhead. */ +/* Call produce_glyphs or FRAME_RIF->produce_glyphs, if set. Shortcut + to avoid the function call overhead. */ #define PRODUCE_GLYPHS(IT) \ do { \ extern int inhibit_free_realized_faces; \ + if ((IT)->glyph_row != NULL && (IT)->bidi_p) \ + { \ + if ((IT)->bidi_it.paragraph_dir == R2L) \ + (IT)->glyph_row->reversed_p = 1; \ + else \ + (IT)->glyph_row->reversed_p = 0; \ + } \ if (FRAME_RIF ((IT)->f) != NULL) \ FRAME_RIF ((IT)->f)->produce_glyphs ((IT)); \ else \ @@ -2253,7 +2486,7 @@ struct run /* Handlers for setting frame parameters. */ -typedef void (*frame_parm_handler) P_ ((struct frame *, Lisp_Object, Lisp_Object)); +typedef void (*frame_parm_handler) (struct frame *, Lisp_Object, Lisp_Object); /* Structure holding system-dependent interface functions needed @@ -2266,123 +2499,110 @@ struct redisplay_interface /* Produce glyphs/get display metrics for the display element IT is loaded with. */ - void (*produce_glyphs) P_ ((struct it *it)); + void (*produce_glyphs) (struct it *it); /* Write or insert LEN glyphs from STRING at the nominal output position. */ - void (*write_glyphs) P_ ((struct glyph *string, int len)); - void (*insert_glyphs) P_ ((struct glyph *start, int len)); + void (*write_glyphs) (struct glyph *string, int len); + void (*insert_glyphs) (struct glyph *start, int len); /* Clear from nominal output position to X. X < 0 means clear to right end of display. */ - void (*clear_end_of_line) P_ ((int x)); + void (*clear_end_of_line) (int x); /* Function to call to scroll the display as described by RUN on window W. */ - void (*scroll_run_hook) P_ ((struct window *w, struct run *run)); + void (*scroll_run_hook) (struct window *w, struct run *run); /* Function to call after a line in a display has been completely updated. Used to draw truncation marks and alike. DESIRED_ROW is the desired row which has been updated. */ - void (*after_update_window_line_hook) P_ ((struct glyph_row *desired_row)); + void (*after_update_window_line_hook) (struct glyph_row *desired_row); /* Function to call before beginning to update window W in window-based redisplay. */ - void (*update_window_begin_hook) P_ ((struct window *w)); + void (*update_window_begin_hook) (struct window *w); /* Function to call after window W has been updated in window-based redisplay. CURSOR_ON_P non-zero means switch cursor on. MOUSE_FACE_OVERWRITTEN_P non-zero means that some lines in W that contained glyphs in mouse-face were overwritten, so we have to update the mouse highlight. */ - void (*update_window_end_hook) P_ ((struct window *w, int cursor_on_p, - int mouse_face_overwritten_p)); + void (*update_window_end_hook) (struct window *w, int cursor_on_p, + int mouse_face_overwritten_p); /* Move cursor to row/column position VPOS/HPOS, pixel coordinates Y/X. HPOS/VPOS are window-relative row and column numbers and X/Y are window-relative pixel positions. */ - void (*cursor_to) P_ ((int vpos, int hpos, int y, int x)); + void (*cursor_to) (int vpos, int hpos, int y, int x); /* Flush the display of frame F. For X, this is XFlush. */ - void (*flush_display) P_ ((struct frame *f)); + void (*flush_display) (struct frame *f); /* Flush the display of frame F if non-NULL. This is called during redisplay, and should be NULL on systems which flushes automatically before reading input. */ - void (*flush_display_optional) P_ ((struct frame *f)); + void (*flush_display_optional) (struct frame *f); /* Clear the mouse hightlight in window W, if there is any. */ - void (*clear_window_mouse_face) P_ ((struct window *w)); + void (*clear_window_mouse_face) (struct window *w); /* Set *LEFT and *RIGHT to the left and right overhang of GLYPH on frame F. */ - void (*get_glyph_overhangs) P_ ((struct glyph *glyph, struct frame *f, - int *left, int *right)); + void (*get_glyph_overhangs) (struct glyph *glyph, struct frame *f, + int *left, int *right); /* Fix the display of AREA of ROW in window W for overlapping rows. This function is called from redraw_overlapping_rows after desired rows have been made current. */ - void (*fix_overlapping_area) P_ ((struct window *w, struct glyph_row *row, - enum glyph_row_area area, int)); + void (*fix_overlapping_area) (struct window *w, struct glyph_row *row, + enum glyph_row_area area, int); #ifdef HAVE_WINDOW_SYSTEM /* Draw a fringe bitmap in window W of row ROW using parameters P. */ - void (*draw_fringe_bitmap) P_ ((struct window *w, struct glyph_row *row, - struct draw_fringe_bitmap_params *p)); + void (*draw_fringe_bitmap) (struct window *w, struct glyph_row *row, + struct draw_fringe_bitmap_params *p); /* Define and destroy fringe bitmap no. WHICH. */ - void (*define_fringe_bitmap) P_ ((int which, unsigned short *bits, - int h, int wd)); - void (*destroy_fringe_bitmap) P_ ((int which)); - -/* Get metrics of character CHAR2B in FONT of type FONT_TYPE. - Value is null if CHAR2B is not contained in the font. */ - XCharStruct * (*per_char_metric) P_ ((XFontStruct *font, XChar2b *char2b, - int font_type)); - -/* Encode CHAR2B using encoding information from FONT_INFO. CHAR2B is - 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, - struct charset *charset, - int *two_byte_p)); + void (*define_fringe_bitmap) (int which, unsigned short *bits, + int h, int wd); + void (*destroy_fringe_bitmap) (int which); /* Compute left and right overhang of glyph string S. A NULL pointer if platform does not support this. */ - void (*compute_glyph_string_overhangs) P_ ((struct glyph_string *s)); + void (*compute_glyph_string_overhangs) (struct glyph_string *s); /* Draw a glyph string S. */ - void (*draw_glyph_string) P_ ((struct glyph_string *s)); + void (*draw_glyph_string) (struct glyph_string *s); /* Define cursor CURSOR on frame F. */ - void (*define_frame_cursor) P_ ((struct frame *f, Cursor cursor)); + void (*define_frame_cursor) (struct frame *f, Cursor cursor); /* Clear the area at (X,Y,WIDTH,HEIGHT) of frame F. */ - void (*clear_frame_area) P_ ((struct frame *f, int x, int y, - int width, int height)); + void (*clear_frame_area) (struct frame *f, int x, int y, + int width, int height); /* 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 x, int y, - int cursor_type, int cursor_width, - int on_p, int active_p)); + void (*draw_window_cursor) (struct window *w, + struct glyph_row *glyph_row, + 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 x, int y0, int y1)); + void (*draw_vertical_window_border) (struct window *w, + int x, int y0, int y1); /* Shift display of frame F to make room for inserted glyphs. The area at pixel (X,Y) of width WIDTH and height HEIGHT is shifted right by SHIFT_BY pixels. */ - void (*shift_glyphs_for_insert) P_ ((struct frame *f, - int x, int y, int width, - int height, int shift_by)); + void (*shift_glyphs_for_insert) (struct frame *f, + int x, int y, int width, + int height, int shift_by); #endif /* HAVE_WINDOW_SYSTEM */ }; @@ -2409,14 +2629,14 @@ struct image_type /* Check that SPEC is a valid image specification for the given image type. Value is non-zero if SPEC is valid. */ - int (* valid_p) P_ ((Lisp_Object spec)); + int (* valid_p) (Lisp_Object spec); /* Load IMG which is used on frame F from information contained in IMG->spec. Value is non-zero if successful. */ - int (* load) P_ ((struct frame *f, struct image *img)); + int (* load) (struct frame *f, struct image *img); /* Free resources of image IMG which is used on frame F. */ - void (* free) P_ ((struct frame *f, struct image *img)); + void (* free) (struct frame *f, struct image *img); /* Next in list of all supported image types. */ struct image_type *next; @@ -2487,6 +2707,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; @@ -2547,8 +2772,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. */ @@ -2598,6 +2823,9 @@ enum tool_bar_item_idx /* Icon file name of right to left image when an RTL locale is used. */ TOOL_BAR_ITEM_RTL_IMAGE, + /* Label to show when text labels are enabled. */ + TOOL_BAR_ITEM_LABEL, + /* Sentinel = number of slots in tool_bar_items occupied by one tool-bar item. */ TOOL_BAR_ITEM_NSLOTS @@ -2619,6 +2847,15 @@ enum tool_bar_item_image extern Lisp_Object Vtool_bar_button_margin; +/* Tool bar style */ + +extern Lisp_Object Vtool_bar_style; + +/* Maximum number of characters a label can have to be shown. */ + +extern EMACS_INT tool_bar_max_label_size; +#define DEFAULT_TOOL_BAR_LABEL_SIZE 14 + /* Thickness of relief to draw around tool-bar buttons. */ extern EMACS_INT tool_bar_button_relief; @@ -2654,56 +2891,66 @@ extern EMACS_INT tool_bar_button_relief; Function Prototypes ***********************************************************************/ +/* Defined in bidi.c */ + +extern void bidi_init_it (EMACS_INT, EMACS_INT, struct bidi_it *); +extern void bidi_move_to_visually_next (struct bidi_it *); +extern void bidi_paragraph_init (bidi_dir_t, struct bidi_it *); +extern int bidi_mirror_char (int); + /* Defined in xdisp.c */ -struct glyph_row *row_containing_pos P_ ((struct window *, int, - struct glyph_row *, - struct glyph_row *, int)); -int string_buffer_position P_ ((struct window *, Lisp_Object, int)); -int line_bottom_y P_ ((struct it *)); -int display_prop_intangible_p P_ ((Lisp_Object)); -void resize_echo_area_exactly P_ ((void)); -int resize_mini_window P_ ((struct window *, int)); -int try_window P_ ((Lisp_Object, struct text_pos, int)); -void window_box P_ ((struct window *, int, int *, int *, int *, int *)); -int window_box_height P_ ((struct window *)); -int window_text_bottom_y P_ ((struct window *)); -int window_box_width P_ ((struct window *, int)); -int window_box_left P_ ((struct window *, int)); -int window_box_left_offset P_ ((struct window *, int)); -int window_box_right P_ ((struct window *, int)); -int window_box_right_offset 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 remember_mouse_glyph P_ ((struct frame *, int, int, NativeRectangle *)); - -void mark_window_display_accurate P_ ((Lisp_Object, int)); -void redisplay_preserve_echo_area P_ ((int)); -int set_cursor_from_row P_ ((struct window *, struct glyph_row *, - struct glyph_matrix *, int, int, int, int)); -void init_iterator P_ ((struct it *, struct window *, int, - int, struct glyph_row *, enum face_id)); -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 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)); -void move_it_vertically_backward P_ ((struct it *, int)); -void move_it_by_lines P_ ((struct it *, int, int)); -void move_it_past_eol P_ ((struct it *)); -int in_display_vector_p P_ ((struct it *)); -int frame_mode_line_height P_ ((struct frame *)); -void highlight_trailing_whitespace P_ ((struct frame *, struct glyph_row *)); +struct glyph_row *row_containing_pos (struct window *, int, + struct glyph_row *, + struct glyph_row *, int); +EMACS_INT string_buffer_position (struct window *, Lisp_Object, + EMACS_INT); +int line_bottom_y (struct it *); +int display_prop_intangible_p (Lisp_Object); +void resize_echo_area_exactly (void); +int resize_mini_window (struct window *, int); +int try_window (Lisp_Object, struct text_pos, int); +void window_box (struct window *, int, int *, int *, int *, int *); +int window_box_height (struct window *); +int window_text_bottom_y (struct window *); +int window_box_width (struct window *, int); +int window_box_left (struct window *, int); +int window_box_left_offset (struct window *, int); +int window_box_right (struct window *, int); +int window_box_right_offset (struct window *, int); +void window_box_edges (struct window *, int, int *, int *, int *, int *); +int estimate_mode_line_height (struct frame *, enum face_id); +void pixel_to_glyph_coords (struct frame *, int, int, int *, int *, + NativeRectangle *, int); +int glyph_to_pixel_coords (struct window *, int, int, int *, int *); +void remember_mouse_glyph (struct frame *, int, int, NativeRectangle *); + +void mark_window_display_accurate (Lisp_Object, int); +void redisplay_preserve_echo_area (int); +int set_cursor_from_row (struct window *, struct glyph_row *, + struct glyph_matrix *, int, int, int, int); +void init_iterator (struct it *, struct window *, EMACS_INT, + EMACS_INT, struct glyph_row *, enum face_id); +void init_iterator_to_row_start (struct it *, struct window *, + struct glyph_row *); +int get_next_display_element (struct it *); +void set_iterator_to_next (struct it *, int); +void start_display (struct it *, struct window *, struct text_pos); +void move_it_to (struct it *, int, int, int, int, int); +void move_it_vertically (struct it *, int); +void move_it_vertically_backward (struct it *, int); +void move_it_by_lines (struct it *, int, int); +void move_it_past_eol (struct it *); +void move_it_in_display_line (struct it *it, + EMACS_INT to_charpos, int to_x, + enum move_operation_enum op); +int in_display_vector_p (struct it *); +int frame_mode_line_height (struct frame *); +void highlight_trailing_whitespace (struct frame *, struct glyph_row *); extern Lisp_Object Qtool_bar; extern Lisp_Object Vshow_trailing_whitespace; extern int mode_line_in_non_selected_windows; extern int redisplaying_p; -extern void add_to_log P_ ((char *, Lisp_Object, Lisp_Object)); extern int help_echo_showing_p; extern int current_mode_line_height, current_header_line_height; extern Lisp_Object help_echo_string, help_echo_window; @@ -2713,205 +2960,217 @@ extern struct frame *last_mouse_frame; extern int last_tool_bar_item; extern Lisp_Object Vmouse_autoselect_window; extern int unibyte_display_via_language_environment; +extern EMACS_INT underline_minimum_offset; -extern void reseat_at_previous_visible_line_start P_ ((struct it *)); +extern void reseat_at_previous_visible_line_start (struct it *); -extern int calc_pixel_width_or_height P_ ((double *, struct it *, Lisp_Object, - /* XFontStruct */ void *, int, int *)); +extern int calc_pixel_width_or_height (double *, struct it *, Lisp_Object, + struct font *, int, int *); #ifdef HAVE_WINDOW_SYSTEM #if GLYPH_DEBUG -extern void dump_glyph_string P_ ((struct glyph_string *)); +extern void dump_glyph_string (struct glyph_string *); #endif -extern void x_get_glyph_overhangs P_ ((struct glyph *, struct frame *, - int *, int *)); -extern void x_produce_glyphs P_ ((struct it *)); +extern void x_get_glyph_overhangs (struct glyph *, struct frame *, + int *, int *); +extern void x_produce_glyphs (struct it *); -extern void x_write_glyphs P_ ((struct glyph *, int)); -extern void x_insert_glyphs P_ ((struct glyph *, int len)); -extern void x_clear_end_of_line P_ ((int)); +extern void x_write_glyphs (struct glyph *, int); +extern void x_insert_glyphs (struct glyph *, int len); +extern void x_clear_end_of_line (int); extern int x_stretch_cursor_p; extern struct cursor_pos output_cursor; -extern void x_fix_overlapping_area P_ ((struct window *, struct glyph_row *, - enum glyph_row_area, int)); -extern void draw_phys_cursor_glyph P_ ((struct window *, - struct glyph_row *, - enum draw_glyphs_face)); -extern void get_phys_cursor_geometry P_ ((struct window *, struct glyph_row *, - struct glyph *, int *, int *, int *)); -extern void erase_phys_cursor P_ ((struct window *)); -extern void display_and_set_cursor P_ ((struct window *, - int, int, int, int, int)); - -extern void set_output_cursor P_ ((struct cursor_pos *)); -extern void x_cursor_to P_ ((int, int, int, int)); - -extern void x_update_cursor P_ ((struct frame *, int)); -extern void x_clear_cursor P_ ((struct window *)); -extern void x_draw_vertical_border P_ ((struct window *w)); - -extern void frame_to_window_pixel_xy P_ ((struct window *, int *, int *)); -extern int get_glyph_string_clip_rects P_ ((struct glyph_string *, - NativeRectangle *, int)); -extern void get_glyph_string_clip_rect P_ ((struct glyph_string *, - NativeRectangle *nr)); -extern Lisp_Object find_hot_spot P_ ((Lisp_Object, int, int)); -extern void note_mouse_highlight P_ ((struct frame *, int, int)); -extern void x_clear_window_mouse_face P_ ((struct window *)); -extern void cancel_mouse_face P_ ((struct frame *)); - -extern void handle_tool_bar_click P_ ((struct frame *, - int, int, int, unsigned int)); +extern void x_fix_overlapping_area (struct window *, struct glyph_row *, + enum glyph_row_area, int); +extern void draw_phys_cursor_glyph (struct window *, + struct glyph_row *, + enum draw_glyphs_face); +extern void get_phys_cursor_geometry (struct window *, struct glyph_row *, + struct glyph *, int *, int *, int *); +extern void erase_phys_cursor (struct window *); +extern void display_and_set_cursor (struct window *, + int, int, int, int, int); + +extern void set_output_cursor (struct cursor_pos *); +extern void x_cursor_to (int, int, int, int); + +extern void x_update_cursor (struct frame *, int); +extern void x_clear_cursor (struct window *); +extern void x_draw_vertical_border (struct window *w); + +extern void frame_to_window_pixel_xy (struct window *, int *, int *); +extern int get_glyph_string_clip_rects (struct glyph_string *, + NativeRectangle *, int); +extern void get_glyph_string_clip_rect (struct glyph_string *, + NativeRectangle *nr); +extern Lisp_Object find_hot_spot (Lisp_Object, int, int); +extern void note_mouse_highlight (struct frame *, int, int); +extern void x_clear_window_mouse_face (struct window *); +extern void cancel_mouse_face (struct frame *); + +extern void handle_tool_bar_click (struct frame *, + int, int, int, unsigned int); /* msdos.c defines its own versions of these functions. */ -extern int clear_mouse_face P_ ((Display_Info *)); -extern void show_mouse_face P_ ((Display_Info *, enum draw_glyphs_face)); -extern int cursor_in_mouse_face_p P_ ((struct window *w)); +extern int clear_mouse_face (Display_Info *); +extern void show_mouse_face (Display_Info *, enum draw_glyphs_face); +extern int cursor_in_mouse_face_p (struct window *w); -extern void expose_frame P_ ((struct frame *, int, int, int, int)); -extern int x_intersect_rectangles P_ ((XRectangle *, XRectangle *, - XRectangle *)); +extern void expose_frame (struct frame *, int, int, int, int); +extern int x_intersect_rectangles (XRectangle *, XRectangle *, + XRectangle *); #endif +/* Flags passed to try_window. */ +#define TRY_WINDOW_CHECK_MARGINS (1 << 0) +#define TRY_WINDOW_IGNORE_FONTS_CHANGE (1 << 1) + /* Defined in fringe.c */ +extern Lisp_Object Voverflow_newline_into_fringe; int lookup_fringe_bitmap (Lisp_Object); -void draw_fringe_bitmap P_ ((struct window *, struct glyph_row *, int)); -void draw_row_fringe_bitmaps P_ ((struct window *, struct glyph_row *)); -int draw_window_fringes P_ ((struct window *, int)); -int update_window_fringes P_ ((struct window *, int)); -void compute_fringe_widths P_ ((struct frame *, int)); +void draw_fringe_bitmap (struct window *, struct glyph_row *, int); +void draw_row_fringe_bitmaps (struct window *, struct glyph_row *); +int draw_window_fringes (struct window *, int); +int update_window_fringes (struct window *, int); +void compute_fringe_widths (struct frame *, int); #ifdef WINDOWSNT -void w32_init_fringe P_ ((struct redisplay_interface *)); -void w32_reset_fringes P_ ((void)); +void w32_init_fringe (struct redisplay_interface *); +void w32_reset_fringes (void); #endif -#ifdef MAC_OS -void mac_init_fringe P_ ((struct redisplay_interface *)); -#endif - /* Defined in image.c */ #ifdef HAVE_WINDOW_SYSTEM -extern int x_bitmap_height P_ ((struct frame *, int)); -extern int x_bitmap_width P_ ((struct frame *, int)); -extern int x_bitmap_pixmap P_ ((struct frame *, int)); -extern void x_reference_bitmap P_ ((struct frame *, int)); -extern int x_create_bitmap_from_data P_ ((struct frame *, char *, - unsigned int, unsigned int)); -extern int x_create_bitmap_from_file P_ ((struct frame *, Lisp_Object)); +extern int x_bitmap_height (struct frame *, int); +extern int x_bitmap_width (struct frame *, int); +extern int x_bitmap_pixmap (struct frame *, int); +extern void x_reference_bitmap (struct frame *, int); +extern int x_create_bitmap_from_data (struct frame *, char *, + unsigned int, unsigned int); +extern int x_create_bitmap_from_file (struct frame *, Lisp_Object); #if defined (HAVE_XPM) && defined (HAVE_X_WINDOWS) -extern int x_create_bitmap_from_xpm_data P_ ((struct frame *f, char **bits)); +extern int x_create_bitmap_from_xpm_data (struct frame *f, char **bits); #endif #ifndef x_destroy_bitmap -extern void x_destroy_bitmap P_ ((struct frame *, int)); +extern void x_destroy_bitmap (struct frame *, int); #endif -extern void x_destroy_all_bitmaps P_ ((Display_Info *)); -extern int x_create_bitmap_mask P_ ((struct frame * , int)); -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 *)))); -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)); - -unsigned long image_background P_ ((struct image *, struct frame *, - XImagePtr_or_DC ximg)); -int image_background_transparent P_ ((struct image *, struct frame *, - XImagePtr_or_DC mask)); - -int image_ascent P_ ((struct image *, struct face *, struct glyph_slice *)); +extern void x_destroy_all_bitmaps (Display_Info *); +extern int x_create_bitmap_mask (struct frame * , int); +extern Lisp_Object x_find_image_file (Lisp_Object); + +void x_kill_gs_process (Pixmap, struct frame *); +struct image_cache *make_image_cache (void); +void free_image_cache (struct frame *); +void clear_image_caches (Lisp_Object); +void mark_image_cache (struct image_cache *); +int valid_image_p (Lisp_Object); +void prepare_image_for_display (struct frame *, struct image *); +int lookup_image (struct frame *, Lisp_Object); + +unsigned long image_background (struct image *, struct frame *, + XImagePtr_or_DC ximg); +int image_background_transparent (struct image *, struct frame *, + XImagePtr_or_DC mask); + +int image_ascent (struct image *, struct face *, struct glyph_slice *); #endif /* Defined in sysdep.c */ -void get_tty_size P_ ((int, int *, int *)); -void request_sigio P_ ((void)); -void unrequest_sigio P_ ((void)); -int tabs_safe_p P_ ((int)); -void init_baud_rate P_ ((int)); -void init_sigio P_ ((int)); +void get_tty_size (int, int *, int *); +void request_sigio (void); +void unrequest_sigio (void); +int tabs_safe_p (int); +void init_baud_rate (int); +void init_sigio (int); /* Defined in xfaces.c */ #ifdef HAVE_X_WINDOWS -void x_free_colors P_ ((struct frame *, unsigned long *, int)); +void x_free_colors (struct frame *, unsigned long *, int); #endif -void update_face_from_frame_parameter P_ ((struct frame *, Lisp_Object, - Lisp_Object)); -Lisp_Object tty_color_name P_ ((struct frame *, int)); -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)); -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 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)); -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_for_overlay_string P_ ((struct window *, int, int, - int, int *, - int, int, Lisp_Object)); -int face_at_string_position P_ ((struct window *, Lisp_Object, int, int, int, - int, int *, enum face_id, int)); -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 *)); +void update_face_from_frame_parameter (struct frame *, Lisp_Object, + Lisp_Object); +Lisp_Object tty_color_name (struct frame *, int); +void clear_face_cache (int); +unsigned long load_color (struct frame *, struct face *, Lisp_Object, + enum lface_attribute_index); +void unload_color (struct frame *, unsigned long); +char *choose_face_font (struct frame *, Lisp_Object *, Lisp_Object, + int *); +int ascii_face_of_lisp_face (struct frame *, int); +void prepare_face_for_display (struct frame *, struct face *); +int xstrcasecmp (const unsigned char *, const unsigned char *); +int lookup_face (struct frame *, Lisp_Object *); +int lookup_named_face (struct frame *, Lisp_Object, int); +int lookup_basic_face (struct frame *, int); +int smaller_face (struct frame *, int, int); +int face_with_height (struct frame *, int, int); +int lookup_derived_face (struct frame *, Lisp_Object, int, int); +void init_frame_faces (struct frame *); +void free_frame_faces (struct frame *); +void recompute_basic_faces (struct frame *); +int face_at_buffer_position (struct window *w, EMACS_INT pos, + EMACS_INT region_beg, EMACS_INT region_end, + EMACS_INT *endptr, EMACS_INT limit, + int mouse, int base_face_id); +int face_for_overlay_string (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 (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 (struct frame *, Lisp_Object, int, int); +int compute_char_face (struct frame *, int, Lisp_Object); +void free_all_realized_faces (Lisp_Object); +void free_realized_face (struct frame *, struct face *); extern Lisp_Object Qforeground_color, Qbackground_color; extern Lisp_Object Qframe_set_background_mode; extern char unspecified_fg[], unspecified_bg[]; -extern Lisp_Object split_font_name_into_vector P_ ((Lisp_Object)); -extern Lisp_Object build_font_name_from_vector P_ ((Lisp_Object)); + +extern Lisp_Object Vface_remapping_alist; /* Defined in xfns.c */ #ifdef HAVE_X_WINDOWS -void gamma_correct P_ ((struct frame *, XColor *)); +void gamma_correct (struct frame *, XColor *); #endif #ifdef WINDOWSNT -void gamma_correct P_ ((struct frame *, COLORREF *)); -#endif -#ifdef MAC_OS -void gamma_correct P_ ((struct frame *, unsigned long *)); +void gamma_correct (struct frame *, COLORREF *); #endif #ifdef HAVE_WINDOW_SYSTEM -int x_screen_planes P_ ((struct frame *)); -void x_implicitly_set_name P_ ((struct frame *, Lisp_Object, Lisp_Object)); +int x_screen_planes (struct frame *); +void x_implicitly_set_name (struct frame *, Lisp_Object, Lisp_Object); extern Lisp_Object tip_frame; extern Window tip_window; EXFUN (Fx_show_tip, 6); EXFUN (Fx_hide_tip, 0); -extern void start_hourglass P_ ((void)); -extern void cancel_hourglass P_ ((void)); -extern int hourglass_started P_ ((void)); +extern void start_hourglass (void); +extern void cancel_hourglass (void); +extern int hourglass_started (void); extern int display_hourglass_p; +extern int hourglass_shown_p; +struct atimer; /* Defined in atimer.h. */ +/* If non-null, an asynchronous timer that, when it expires, displays + an hourglass cursor on all frames. */ +extern struct atimer *hourglass_atimer; + +/* Each GUI implements these. FIXME: move into RIF. */ +extern void show_hourglass (struct atimer *); +extern void hide_hourglass (void); /* Returns the background color of IMG, calculating one heuristically if necessary. If non-zero, XIMG is an existing XImage object to use for @@ -2936,120 +3195,116 @@ extern int display_hourglass_p; /* Defined in xmenu.c */ -int popup_activated P_ ((void)); +int popup_activated (void); /* Defined in dispnew.c */ extern int inverse_video; -extern int required_matrix_width P_ ((struct window *)); -extern int required_matrix_height P_ ((struct window *)); -extern Lisp_Object buffer_posn_from_coords P_ ((struct window *, - int *, int *, - struct display_pos *, - Lisp_Object *, - int *, int *, int *, int *)); -extern Lisp_Object mode_line_string P_ ((struct window *, enum window_part, - int *, int *, int *, - Lisp_Object *, - int *, int *, int *, int *)); -extern Lisp_Object marginal_area_string P_ ((struct window *, enum window_part, - int *, int *, int *, - Lisp_Object *, - int *, int *, int *, int *)); -extern void redraw_frame P_ ((struct frame *)); -extern void redraw_garbaged_frames P_ ((void)); -extern void cancel_line P_ ((int, struct frame *)); -extern void init_desired_glyphs P_ ((struct frame *)); -extern int scroll_frame_lines P_ ((struct frame *, int, int, int, int)); -extern int direct_output_for_insert P_ ((int)); -extern int direct_output_forward_char P_ ((int)); -extern int update_frame P_ ((struct frame *, int, int)); -extern int scrolling P_ ((struct frame *)); -extern void bitch_at_user P_ ((void)); -void adjust_glyphs P_ ((struct frame *)); -void free_glyphs P_ ((struct frame *)); -void free_window_matrices P_ ((struct window *)); -void check_glyph_memory P_ ((void)); -void mirrored_line_dance P_ ((struct glyph_matrix *, int, int, int *, char *)); -void clear_glyph_matrix P_ ((struct glyph_matrix *)); -void clear_current_matrices P_ ((struct frame *f)); -void clear_desired_matrices P_ ((struct frame *)); -void shift_glyph_matrix P_ ((struct window *, struct glyph_matrix *, - int, int, int)); -void rotate_matrix P_ ((struct glyph_matrix *, int, int, int)); -void increment_matrix_positions P_ ((struct glyph_matrix *, - int, int, int, int)); -void blank_row P_ ((struct window *, struct glyph_row *, int)); -void increment_row_positions P_ ((struct glyph_row *, int, int)); -void enable_glyph_matrix_rows P_ ((struct glyph_matrix *, int, int, int)); -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 redraw_frame P_ ((struct frame *)); -void redraw_garbaged_frames P_ ((void)); -int scroll_cost P_ ((struct frame *, int, int, int)); -int direct_output_for_insert P_ ((int)); -int direct_output_forward_char P_ ((int)); -int update_frame P_ ((struct frame *, int, int)); -void update_single_window P_ ((struct window *, int)); -int scrolling P_ ((struct frame *)); -void do_pending_window_change P_ ((int)); -void change_frame_size P_ ((struct frame *, int, int, int, int, int)); -void bitch_at_user P_ ((void)); -void init_display P_ ((void)); -void syms_of_display P_ ((void)); +extern int required_matrix_width (struct window *); +extern int required_matrix_height (struct window *); +extern Lisp_Object buffer_posn_from_coords (struct window *, + int *, int *, + struct display_pos *, + Lisp_Object *, + int *, int *, int *, int *); +extern Lisp_Object mode_line_string (struct window *, enum window_part, + int *, int *, int *, + Lisp_Object *, + int *, int *, int *, int *); +extern Lisp_Object marginal_area_string (struct window *, enum window_part, + int *, int *, int *, + Lisp_Object *, + int *, int *, int *, int *); +extern void redraw_frame (struct frame *); +extern void redraw_garbaged_frames (void); +extern void cancel_line (int, struct frame *); +extern void init_desired_glyphs (struct frame *); +extern int scroll_frame_lines (struct frame *, int, int, int, int); +extern int update_frame (struct frame *, int, int); +extern int scrolling (struct frame *); +extern void bitch_at_user (void); +void adjust_glyphs (struct frame *); +void free_glyphs (struct frame *); +void free_window_matrices (struct window *); +void check_glyph_memory (void); +void mirrored_line_dance (struct glyph_matrix *, int, int, int *, char *); +void clear_glyph_matrix (struct glyph_matrix *); +void clear_current_matrices (struct frame *f); +void clear_desired_matrices (struct frame *); +void shift_glyph_matrix (struct window *, struct glyph_matrix *, + int, int, int); +void rotate_matrix (struct glyph_matrix *, int, int, int); +void increment_matrix_positions (struct glyph_matrix *, + int, int, int, int); +void blank_row (struct window *, struct glyph_row *, int); +void increment_row_positions (struct glyph_row *, int, int); +void enable_glyph_matrix_rows (struct glyph_matrix *, int, int, int); +void clear_glyph_row (struct glyph_row *); +void prepare_desired_row (struct glyph_row *); +int line_hash_code (struct glyph_row *); +void set_window_update_flags (struct window *, int); +void redraw_frame (struct frame *); +void redraw_garbaged_frames (void); +int scroll_cost (struct frame *, int, int, int); +int update_frame (struct frame *, int, int); +void update_single_window (struct window *, int); +int scrolling (struct frame *); +void do_pending_window_change (int); +void change_frame_size (struct frame *, int, int, int, int, int); +void bitch_at_user (void); +void init_display (void); +void syms_of_display (void); extern Lisp_Object Qredisplay_dont_pause; -GLYPH spec_glyph_lookup_face P_ ((struct window *, GLYPH)); +void spec_glyph_lookup_face (struct window *, GLYPH *); /* Defined in terminal.c */ -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_ ((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 void ring_bell (struct frame *); +extern void update_begin (struct frame *); +extern void update_end (struct frame *); +extern void set_terminal_window (struct frame *, int); +extern void cursor_to (struct frame *, int, int); +extern void raw_cursor_to (struct frame *, int, int); +extern void clear_to_end (struct frame *); +extern void clear_frame (struct frame *); +extern void clear_end_of_line (struct frame *, int); +extern void write_glyphs (struct frame *, struct glyph *, int); +extern void insert_glyphs (struct frame *, struct glyph *, int); +extern void delete_glyphs (struct frame *, int); +extern void ins_del_lines (struct frame *, int, int); -extern struct terminal *init_initial_terminal P_ ((void)); +extern struct terminal *init_initial_terminal (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 struct terminal *get_tty_terminal P_ ((Lisp_Object, int)); -extern struct terminal *get_named_tty P_ ((char *)); +extern void tty_set_terminal_modes (struct terminal *); +extern void tty_reset_terminal_modes (struct terminal *); +extern void tty_turn_off_insert (struct tty_display_info *); +extern void tty_turn_off_highlight (struct tty_display_info *); +extern int string_cost (char *); +extern int per_line_cost (char *); +extern void calculate_costs (struct frame *); +extern void produce_glyphs (struct it *); +extern void produce_special_glyphs (struct it *, enum display_element_type); +extern int tty_capable_p (struct tty_display_info *, unsigned, unsigned long, unsigned long); +extern void set_tty_color_mode (struct tty_display_info *, struct frame *); +extern struct terminal *get_tty_terminal (Lisp_Object, int); +extern struct terminal *get_named_tty (char *); EXFUN (Ftty_type, 1); -extern void create_tty_output P_ ((struct frame *)); -extern struct terminal *init_tty P_ ((char *, char *, int)); +extern void create_tty_output (struct frame *); +extern struct terminal *init_tty (char *, char *, int); /* Defined in scroll.c */ -extern int scrolling_max_lines_saved P_ ((int, int, int *, int *, int *)); -extern int scroll_cost P_ ((struct frame *, int, int, int)); -extern void do_line_insertion_deletion_costs P_ ((struct frame *, char *, - char *, char *, char *, - char *, char *, int)); -void scrolling_1 P_ ((struct frame *, int, int, int, int *, int *, int *, - int *, int)); +extern int scrolling_max_lines_saved (int, int, int *, int *, int *); +extern int scroll_cost (struct frame *, int, int, int); +extern void do_line_insertion_deletion_costs (struct frame *, char *, + char *, char *, char *, + char *, char *, int); +void scrolling_1 (struct frame *, int, int, int, int *, int *, int *, + int *, int); /* Defined in frame.c */ @@ -3062,23 +3317,24 @@ enum resource_types RES_TYPE_FLOAT, RES_TYPE_BOOLEAN, RES_TYPE_STRING, - RES_TYPE_SYMBOL + RES_TYPE_SYMBOL, + RES_TYPE_BOOLEAN_NUMBER }; -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)); +extern Lisp_Object x_get_arg (Display_Info *, Lisp_Object, + Lisp_Object, const char *, const char *class, + enum resource_types); +extern Lisp_Object x_frame_get_arg (struct frame *, Lisp_Object, + Lisp_Object, const char *, const char *, + enum resource_types); +extern Lisp_Object x_frame_get_and_record_arg (struct frame *, Lisp_Object, + Lisp_Object, + const char *, const char *, + enum resource_types); +extern Lisp_Object x_default_parameter (struct frame *, Lisp_Object, + Lisp_Object, Lisp_Object, + const char *, const char *, + enum resource_types); #endif /* HAVE_WINDOW_SYSTEM */