diff options
| author | Gerd Moellmann | 2000-11-14 05:43:18 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-11-14 05:43:18 +0000 |
| commit | 04612a647fb6bd6d4e38326a46a3396cd271c3ed (patch) | |
| tree | 232f97f1eeef7bbed4ca4f4ef999a26231ae4f45 | |
| parent | d7652128aad99fd07b3cdf4cb214e8ab3480dc6f (diff) | |
| download | emacs-04612a647fb6bd6d4e38326a46a3396cd271c3ed.tar.gz emacs-04612a647fb6bd6d4e38326a46a3396cd271c3ed.zip | |
(current_mode_line_height, current_header_line_height):
New variables.
(init_xdisp): Initialize them.
(pos_visible_p): Add parameter EXACT_MODE_LINE_HEIGHTS_P. Compute
and use exact mode line heights if it is set.
| -rw-r--r-- | src/xdisp.c | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 7bc591c9652..1b31b682102 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -516,6 +516,12 @@ static int last_max_ascent, last_height; | |||
| 516 | 516 | ||
| 517 | int help_echo_showing_p; | 517 | int help_echo_showing_p; |
| 518 | 518 | ||
| 519 | /* If >= 0, computed, exact values of mode-line and header-line height | ||
| 520 | to use in the macros CURRENT_MODE_LINE_HEIGHT and | ||
| 521 | CURRENT_HEADER_LINE_HEIGHT. */ | ||
| 522 | |||
| 523 | int current_mode_line_height, current_header_line_height; | ||
| 524 | |||
| 519 | /* The maximum distance to look ahead for text properties. Values | 525 | /* The maximum distance to look ahead for text properties. Values |
| 520 | that are too small let us call compute_char_face and similar | 526 | that are too small let us call compute_char_face and similar |
| 521 | functions too often which is expensive. Values that are too large | 527 | functions too often which is expensive. Values that are too large |
| @@ -700,8 +706,7 @@ static int try_window_reusing_current_matrix P_ ((struct window *)); | |||
| 700 | static int try_window_id P_ ((struct window *)); | 706 | static int try_window_id P_ ((struct window *)); |
| 701 | static int display_line P_ ((struct it *)); | 707 | static int display_line P_ ((struct it *)); |
| 702 | static int display_mode_lines P_ ((struct window *)); | 708 | static int display_mode_lines P_ ((struct window *)); |
| 703 | static void display_mode_line P_ ((struct window *, enum face_id, | 709 | static int display_mode_line P_ ((struct window *, enum face_id, Lisp_Object)); |
| 704 | Lisp_Object)); | ||
| 705 | static int display_mode_element P_ ((struct it *, int, int, int, Lisp_Object)); | 710 | static int display_mode_element P_ ((struct it *, int, int, int, Lisp_Object)); |
| 706 | static char *decode_mode_spec P_ ((struct window *, int, int, int)); | 711 | static char *decode_mode_spec P_ ((struct window *, int, int, int)); |
| 707 | static void display_menu_bar P_ ((struct window *)); | 712 | static void display_menu_bar P_ ((struct window *)); |
| @@ -942,9 +947,9 @@ window_box_edges (w, area, top_left_x, top_left_y, | |||
| 942 | POS is fully visible. */ | 947 | POS is fully visible. */ |
| 943 | 948 | ||
| 944 | int | 949 | int |
| 945 | pos_visible_p (w, charpos, fully) | 950 | pos_visible_p (w, charpos, fully, exact_mode_line_heights_p) |
| 946 | struct window *w; | 951 | struct window *w; |
| 947 | int charpos, *fully; | 952 | int charpos, *fully, exact_mode_line_heights_p; |
| 948 | { | 953 | { |
| 949 | struct it it; | 954 | struct it it; |
| 950 | struct text_pos top; | 955 | struct text_pos top; |
| @@ -959,8 +964,22 @@ pos_visible_p (w, charpos, fully) | |||
| 959 | 964 | ||
| 960 | *fully = visible_p = 0; | 965 | *fully = visible_p = 0; |
| 961 | SET_TEXT_POS_FROM_MARKER (top, w->start); | 966 | SET_TEXT_POS_FROM_MARKER (top, w->start); |
| 962 | start_display (&it, w, top); | 967 | |
| 968 | /* Compute exact mode line heights, if requested. */ | ||
| 969 | if (exact_mode_line_heights_p) | ||
| 970 | { | ||
| 971 | if (WINDOW_WANTS_MODELINE_P (w)) | ||
| 972 | current_mode_line_height | ||
| 973 | = display_mode_line (w, MODE_LINE_FACE_ID, | ||
| 974 | current_buffer->mode_line_format); | ||
| 975 | |||
| 976 | if (WINDOW_WANTS_HEADER_LINE_P (w)) | ||
| 977 | current_header_line_height | ||
| 978 | = display_mode_line (w, HEADER_LINE_FACE_ID, | ||
| 979 | current_buffer->header_line_format); | ||
| 980 | } | ||
| 963 | 981 | ||
| 982 | start_display (&it, w, top); | ||
| 964 | move_it_to (&it, charpos, 0, it.last_visible_y, -1, | 983 | move_it_to (&it, charpos, 0, it.last_visible_y, -1, |
| 965 | MOVE_TO_POS | MOVE_TO_X | MOVE_TO_Y); | 984 | MOVE_TO_POS | MOVE_TO_X | MOVE_TO_Y); |
| 966 | 985 | ||
| @@ -1005,7 +1024,8 @@ pos_visible_p (w, charpos, fully) | |||
| 1005 | 1024 | ||
| 1006 | if (old_buffer) | 1025 | if (old_buffer) |
| 1007 | set_buffer_internal_1 (old_buffer); | 1026 | set_buffer_internal_1 (old_buffer); |
| 1008 | 1027 | ||
| 1028 | current_header_line_height = current_mode_line_height = -1; | ||
| 1009 | return visible_p; | 1029 | return visible_p; |
| 1010 | } | 1030 | } |
| 1011 | 1031 | ||
| @@ -12430,9 +12450,10 @@ display_mode_lines (w) | |||
| 12430 | 12450 | ||
| 12431 | /* Display mode or top line of window W. FACE_ID specifies which line | 12451 | /* Display mode or top line of window W. FACE_ID specifies which line |
| 12432 | to display; it is either MODE_LINE_FACE_ID or HEADER_LINE_FACE_ID. | 12452 | to display; it is either MODE_LINE_FACE_ID or HEADER_LINE_FACE_ID. |
| 12433 | FORMAT is the mode line format to display. */ | 12453 | FORMAT is the mode line format to display. Value is the pixel |
| 12454 | height of the mode line displayed. */ | ||
| 12434 | 12455 | ||
| 12435 | static void | 12456 | static int |
| 12436 | display_mode_line (w, face_id, format) | 12457 | display_mode_line (w, face_id, format) |
| 12437 | struct window *w; | 12458 | struct window *w; |
| 12438 | enum face_id face_id; | 12459 | enum face_id face_id; |
| @@ -12471,6 +12492,8 @@ display_mode_line (w, face_id, format) | |||
| 12471 | + it.glyph_row->used[TEXT_AREA] - 1); | 12492 | + it.glyph_row->used[TEXT_AREA] - 1); |
| 12472 | last->right_box_line_p = 1; | 12493 | last->right_box_line_p = 1; |
| 12473 | } | 12494 | } |
| 12495 | |||
| 12496 | return it.glyph_row->height; | ||
| 12474 | } | 12497 | } |
| 12475 | 12498 | ||
| 12476 | 12499 | ||
| @@ -13924,6 +13947,8 @@ init_xdisp () | |||
| 13924 | Lisp_Object root_window; | 13947 | Lisp_Object root_window; |
| 13925 | struct window *mini_w; | 13948 | struct window *mini_w; |
| 13926 | 13949 | ||
| 13950 | current_header_line_height = current_mode_line_height = -1; | ||
| 13951 | |||
| 13927 | CHARPOS (this_line_start_pos) = 0; | 13952 | CHARPOS (this_line_start_pos) = 0; |
| 13928 | 13953 | ||
| 13929 | mini_w = XWINDOW (minibuf_window); | 13954 | mini_w = XWINDOW (minibuf_window); |