From d74b2553d9423c3e1fc3d070a5e88299cb39fef5 Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Fri, 21 Mar 2003 13:49:19 +0000 Subject: [PATCH] * dispextern.h (Display_Info): Generic typedef for *_display_info. (NativeRectangle): Generic typedef for rectangle type. (enum window_part): Move here from window.c. (struct redisplay_interface): New members flush_display_optional, define_frame_cursor, clear_frame_area, draw_window_cursor, draw_vertical_window_border, shift_glyphs_for_insert. Rename member clear_mouse_face to clear_window_mouse_face. (estimate_mode_line_height_hook): Remove hook. (auto_raise_tool_bar_buttons_p): Don't declare extern. (tool_bar_item_info): Remove prototype. (help_echo_string, help_echo_window, help_echo_object) (previous_help_echo_string, help_echo_pos) (last_mouse_frame, last_tool_bar_item, mouse_autoselect_window): (x_stretch_cursor_p, output_cursor): Declare extern. (x_draw_glyphs, notice_overwritten_cursor): Remove prototypes. (x_write_glyphs), x_insert_glyphs, x_clear_end_of_line) (x_fix_overlapping_area, draw_phys_cursor_glyph, erase_phys_cursor) (display_and_set_cursor, set_output_cursor, x_cursor_to) (x_update_cursor, x_clear_cursor, x_draw_vertical_border) (frame_to_window_pixel_xy, get_glyph_string_clip_rect) (note_mouse_highlight, x_clear_window_mouse_face, cancel_mouse_face) (handle_tool_bar_click, clear_mouse_face, show_mouse_face) (cursor_in_mouse_face_p, expose_frame, x_intersect_rectangles): Add prototypes. (mode_line_string, marginal_area_string): Fix prototypes. --- src/dispextern.h | 201 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 146 insertions(+), 55 deletions(-) diff --git a/src/dispextern.h b/src/dispextern.h index 00bb2ca0950..ad42527fdc0 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -48,14 +48,22 @@ typedef struct { #include "msdos.h" #endif +#ifdef HAVE_X_WINDOWS +typedef struct x_display_info Display_Info; +#define NativeRectangle XRectangle +#endif + #ifdef HAVE_NTGUI #include "w32gui.h" +typedef struct w32_display_info Display_Info; #endif #ifdef MAC_OS #include "macgui.h" +typedef struct mac_display_info Display_Info; #endif + /* Structure forward declarations. Some are here because function prototypes below reference structure types before their definition in this file. Some are here because not every file including @@ -69,6 +77,22 @@ struct frame; struct window; +/* Values returned from coordinates_in_window. */ + +enum window_part +{ + ON_NOTHING, + ON_TEXT, + ON_MODE_LINE, + ON_VERTICAL_BORDER, + ON_HEADER_LINE, + ON_LEFT_FRINGE, + ON_RIGHT_FRINGE, + ON_LEFT_MARGIN, + ON_RIGHT_MARGIN +}; + + /*********************************************************************** Debugging @@ -921,7 +945,7 @@ extern struct glyph_row scratch_glyph_row; ************************************************************************/ /* Enumeration for overriding/changing the face to use for drawing - glyphs in x_draw_glyphs. */ + glyphs in draw_glyphs. */ enum draw_glyphs_face { @@ -1309,6 +1333,41 @@ struct glyph_string && !NILP (XBUFFER ((W)->buffer)->header_line_format) \ && XFASTINT ((W)->height) > 1 + !NILP (XBUFFER ((W)->buffer)->mode_line_format)) + +/* Return proper value to be used as baseline offset of font that has + ASCENT and DESCENT to draw characters by the font at the vertical + center of the line of frame F. + + Here, our task is to find the value of BOFF in the following figure; + + -------------------------+-----------+- + -+-+---------+-+ | | + | | | | | | + | | | | F_ASCENT F_HEIGHT + | | | ASCENT | | + HEIGHT | | | | | + | | |-|-+------+-----------|------- baseline + | | | | BOFF | | + | |---------|-+-+ | | + | | | DESCENT | | + -+-+---------+-+ F_DESCENT | + -------------------------+-----------+- + + -BOFF + DESCENT + (F_HEIGHT - HEIGHT) / 2 = F_DESCENT + BOFF = DESCENT + (F_HEIGHT - HEIGHT) / 2 - F_DESCENT + DESCENT = FONT->descent + HEIGHT = FONT_HEIGHT (FONT) + F_DESCENT = (F->output_data.x->font->descent + - F->output_data.x->baseline_offset) + F_HEIGHT = FRAME_LINE_HEIGHT (F) +*/ + +#define VCENTER_BASELINE_OFFSET(FONT, F) \ + (FONT_DESCENT (FONT) \ + + (FRAME_LINE_HEIGHT ((F)) - FONT_HEIGHT ((FONT)) \ + + (FRAME_LINE_HEIGHT ((F)) > FONT_HEIGHT ((FONT)))) / 2 \ + - (FONT_DESCENT (FRAME_FONT (F)) - FRAME_BASELINE_OFFSET (F))) + /*********************************************************************** Faces @@ -2149,8 +2208,13 @@ struct redisplay_interface /* Flush the display of frame F. For X, this is XFlush. */ void (*flush_display) P_ ((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)); + /* Clear the mouse hightlight in window W, if there is any. */ - void (*clear_mouse_face) P_ ((struct window *w)); + void (*clear_window_mouse_face) P_ ((struct window *w)); /* Set *LEFT and *RIGHT to the left and right overhang of GLYPH on frame F. */ @@ -2187,52 +2251,38 @@ struct redisplay_interface /* Draw a glyph string S. */ void (*draw_glyph_string) P_ ((struct glyph_string *s)); -#endif /* HAVE_WINDOW_SYSTEM */ -}; +/* Define cursor CURSOR on frame F. */ + void (*define_frame_cursor) P_ ((struct frame *f, Cursor cursor)); -/* The current interface for window-based redisplay. */ - -extern struct redisplay_interface *rif; +/* 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)); -/* Hook to call in estimate_mode_line_height. */ +/* Draw specified cursor NEW_CURSOR_TYPE of width NEW_CURSOR_WIDTH + at row GLYPH_ROW on window W. */ + 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)); -extern int (* estimate_mode_line_height_hook) P_ ((struct frame *, - enum face_id)); - - -/* Return proper value to be used as baseline offset of font that has - ASCENT and DESCENT to draw characters by the font at the vertical - center of the line of frame F. +/* 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)); - Here, out task is to find the value of BOFF in the following figure; +/* 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)); - -------------------------+-----------+- - -+-+---------+-+ | | - | | | | | | - | | | | F_ASCENT F_HEIGHT - | | | ASCENT | | - HEIGHT | | | | | - | | |-|-+------+-----------|------- baseline - | | | | BOFF | | - | |---------|-+-+ | | - | | | DESCENT | | - -+-+---------+-+ F_DESCENT | - -------------------------+-----------+- +#endif /* HAVE_WINDOW_SYSTEM */ +}; - -BOFF + DESCENT + (F_HEIGHT - HEIGHT) / 2 = F_DESCENT - BOFF = DESCENT + (F_HEIGHT - HEIGHT) / 2 - F_DESCENT - DESCENT = FONT->descent - HEIGHT = FONT_HEIGHT (FONT) - F_DESCENT = (F->output_data.x->font->descent - - F->output_data.x->baseline_offset) - F_HEIGHT = FRAME_LINE_HEIGHT (F) -*/ +/* The current interface for window-based redisplay. */ -#define VCENTER_BASELINE_OFFSET(FONT, F) \ - (FONT_DESCENT (FONT) \ - + (FRAME_LINE_HEIGHT ((F)) - FONT_HEIGHT ((FONT)) \ - + (FRAME_LINE_HEIGHT ((F)) > FONT_HEIGHT ((FONT)))) / 2 \ - - (FONT_DESCENT (FRAME_FONT (F)) - FRAME_BASELINE_OFFSET (F))) +extern struct redisplay_interface *rif; /*********************************************************************** @@ -2446,10 +2496,6 @@ enum tool_bar_item_image TOOL_BAR_IMAGE_DISABLED_DESELECTED }; -/* Non-zero means raise tool-bar buttons when the mouse moves over them. */ - -extern int auto_raise_tool_bar_buttons_p; - /* Margin around tool-bar buttons in pixels. */ extern Lisp_Object Vtool_bar_button_margin; @@ -2507,6 +2553,7 @@ int window_box_width P_ ((struct window *, int)); int window_box_left P_ ((struct window *, int)); 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 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 *, @@ -2528,7 +2575,6 @@ 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 *)); -int tool_bar_item_info P_ ((struct frame *, struct glyph *, int *)); void draw_row_fringe_bitmaps P_ ((struct window *, struct glyph_row *)); void compute_fringe_widths P_ ((struct frame *, int)); extern Lisp_Object Qtool_bar; @@ -2539,6 +2585,14 @@ extern Lisp_Object Vimage_types; 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; +extern Lisp_Object help_echo_object, previous_help_echo_string; +extern int help_echo_pos; +extern struct frame *last_mouse_frame; +extern int last_tool_bar_item; +extern int mouse_autoselect_window; + +#ifdef HAVE_WINDOW_SYSTEM #if GLYPH_DEBUG extern void dump_glyph_string P_ ((struct glyph_string *)); @@ -2547,13 +2601,49 @@ extern void dump_glyph_string P_ ((struct glyph_string *)); extern void x_get_glyph_overhangs P_ ((struct glyph *, struct frame *, int *, int *)); extern void x_produce_glyphs P_ ((struct it *)); -extern int x_draw_glyphs P_ ((struct window *, int , struct glyph_row *, - enum glyph_row_area, int, int, - enum draw_glyphs_face, int)); -extern void notice_overwritten_cursor P_ ((struct window *, - enum glyph_row_area, - int, int, int, int)); +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 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)); +extern void draw_phys_cursor_glyph P_ ((struct window *, + struct glyph_row *, + enum draw_glyphs_face)); +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 void get_glyph_string_clip_rect P_ ((struct glyph_string *, + NativeRectangle *nr)); +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)); + +/* 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 void expose_frame P_ ((struct frame *, int, int, int, int)); +extern int x_intersect_rectangles P_ ((XRectangle *, XRectangle *, + XRectangle *)); +#endif /* Defined in sysdep.c */ @@ -2667,9 +2757,10 @@ int popup_activated P_ ((void)); extern int inverse_video; extern int required_matrix_width P_ ((struct window *)); extern int required_matrix_height P_ ((struct window *)); -extern int estimate_mode_line_height P_ ((struct frame *, enum face_id)); -extern Lisp_Object mode_line_string P_ ((struct window *, int, int, int, int *)); -extern Lisp_Object marginal_area_string P_ ((struct window *, int, int, int, int *)); +extern Lisp_Object mode_line_string P_ ((struct window *, int, int, + enum window_part, int *)); +extern Lisp_Object marginal_area_string P_ ((struct window *, int, int, + enum window_part, int *)); extern void redraw_frame P_ ((struct frame *)); extern void redraw_garbaged_frames P_ ((void)); extern void cancel_line P_ ((int, struct frame *)); -- 2.39.2