1 |
/* Display generation from window structure and buffer text. |
/* Display generation from window structure and buffer text. |
2 |
Copyright (C) 1985,86,87,88,93,94,95,97,98,99, 2000, 2001, 2002, 2003 |
Copyright (C) 1985,86,87,88,93,94,95,97,98,99,2000,01,02,03 |
3 |
Free Software Foundation, Inc. |
Free Software Foundation, Inc. |
4 |
|
|
5 |
This file is part of GNU Emacs. |
This file is part of GNU Emacs. |
424 |
|
|
425 |
/* Recenter the window whenever point gets within this many lines of |
/* Recenter the window whenever point gets within this many lines of |
426 |
the top or bottom of the window. This value is translated into a |
the top or bottom of the window. This value is translated into a |
427 |
pixel value by multiplying it with CANON_Y_UNIT, which means that |
pixel value by multiplying it with FRAME_LINE_HEIGHT, which means |
428 |
there is really a fixed pixel height scroll margin. */ |
that there is really a fixed pixel height scroll margin. */ |
429 |
|
|
430 |
EMACS_INT scroll_margin; |
EMACS_INT scroll_margin; |
431 |
|
|
772 |
|
|
773 |
static int next_element_from_ellipsis P_ ((struct it *)); |
static int next_element_from_ellipsis P_ ((struct it *)); |
774 |
static void pint2str P_ ((char *, int, int)); |
static void pint2str P_ ((char *, int, int)); |
775 |
|
static void pint2hrstr P_ ((char *, int, int)); |
776 |
static struct text_pos run_window_scroll_functions P_ ((Lisp_Object, |
static struct text_pos run_window_scroll_functions P_ ((Lisp_Object, |
777 |
struct text_pos)); |
struct text_pos)); |
778 |
static void reconsider_clip_changes P_ ((struct window *, struct buffer *)); |
static void reconsider_clip_changes P_ ((struct window *, struct buffer *)); |
913 |
window_text_bottom_y (w) |
window_text_bottom_y (w) |
914 |
struct window *w; |
struct window *w; |
915 |
{ |
{ |
916 |
struct frame *f = XFRAME (w->frame); |
int height = WINDOW_TOTAL_HEIGHT (w); |
|
int height = XFASTINT (w->height) * CANON_Y_UNIT (f); |
|
917 |
|
|
918 |
if (WINDOW_WANTS_MODELINE_P (w)) |
if (WINDOW_WANTS_MODELINE_P (w)) |
919 |
height -= CURRENT_MODE_LINE_HEIGHT (w); |
height -= CURRENT_MODE_LINE_HEIGHT (w); |
920 |
return height; |
return height; |
921 |
} |
} |
922 |
|
|
|
|
|
923 |
/* Return the pixel width of display area AREA of window W. AREA < 0 |
/* Return the pixel width of display area AREA of window W. AREA < 0 |
924 |
means return the total width of W, not including fringes to |
means return the total width of W, not including fringes to |
925 |
the left and right of the window. */ |
the left and right of the window. */ |
929 |
struct window *w; |
struct window *w; |
930 |
int area; |
int area; |
931 |
{ |
{ |
932 |
struct frame *f = XFRAME (w->frame); |
int cols = XFASTINT (w->total_cols); |
933 |
int width = XFASTINT (w->width); |
int pixels = 0; |
934 |
|
|
935 |
if (!w->pseudo_window_p) |
if (!w->pseudo_window_p) |
936 |
{ |
{ |
937 |
width -= FRAME_SCROLL_BAR_WIDTH (f) + FRAME_FRINGE_COLS (f); |
cols -= WINDOW_SCROLL_BAR_COLS (w); |
938 |
|
|
939 |
if (area == TEXT_AREA) |
if (area == TEXT_AREA) |
940 |
{ |
{ |
941 |
if (INTEGERP (w->left_margin_width)) |
if (INTEGERP (w->left_margin_cols)) |
942 |
width -= XFASTINT (w->left_margin_width); |
cols -= XFASTINT (w->left_margin_cols); |
943 |
if (INTEGERP (w->right_margin_width)) |
if (INTEGERP (w->right_margin_cols)) |
944 |
width -= XFASTINT (w->right_margin_width); |
cols -= XFASTINT (w->right_margin_cols); |
945 |
|
pixels = -WINDOW_TOTAL_FRINGE_WIDTH (w); |
946 |
} |
} |
947 |
else if (area == LEFT_MARGIN_AREA) |
else if (area == LEFT_MARGIN_AREA) |
948 |
width = (INTEGERP (w->left_margin_width) |
{ |
949 |
? XFASTINT (w->left_margin_width) : 0); |
cols = (INTEGERP (w->left_margin_cols) |
950 |
|
? XFASTINT (w->left_margin_cols) : 0); |
951 |
|
pixels = 0; |
952 |
|
} |
953 |
else if (area == RIGHT_MARGIN_AREA) |
else if (area == RIGHT_MARGIN_AREA) |
954 |
width = (INTEGERP (w->right_margin_width) |
{ |
955 |
? XFASTINT (w->right_margin_width) : 0); |
cols = (INTEGERP (w->right_margin_cols) |
956 |
|
? XFASTINT (w->right_margin_cols) : 0); |
957 |
|
pixels = 0; |
958 |
|
} |
959 |
} |
} |
960 |
|
|
961 |
return width * CANON_X_UNIT (f); |
return cols * WINDOW_FRAME_COLUMN_WIDTH (w) + pixels; |
962 |
} |
} |
963 |
|
|
964 |
|
|
970 |
struct window *w; |
struct window *w; |
971 |
{ |
{ |
972 |
struct frame *f = XFRAME (w->frame); |
struct frame *f = XFRAME (w->frame); |
973 |
int height = XFASTINT (w->height) * CANON_Y_UNIT (f); |
int height = WINDOW_TOTAL_HEIGHT (w); |
974 |
|
|
975 |
xassert (height >= 0); |
xassert (height >= 0); |
976 |
|
|
1009 |
return max (0, height); |
return max (0, height); |
1010 |
} |
} |
1011 |
|
|
1012 |
|
/* Return the window-relative coordinate of the left edge of display |
1013 |
|
area AREA of window W. AREA < 0 means return the left edge of the |
1014 |
|
whole window, to the right of the left fringe of W. */ |
1015 |
|
|
1016 |
|
INLINE int |
1017 |
|
window_box_left_offset (w, area) |
1018 |
|
struct window *w; |
1019 |
|
int area; |
1020 |
|
{ |
1021 |
|
int x; |
1022 |
|
|
1023 |
|
if (w->pseudo_window_p) |
1024 |
|
return 0; |
1025 |
|
|
1026 |
|
x = WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (w); |
1027 |
|
|
1028 |
|
if (area == TEXT_AREA) |
1029 |
|
x += (WINDOW_LEFT_FRINGE_WIDTH (w) |
1030 |
|
+ window_box_width (w, LEFT_MARGIN_AREA)); |
1031 |
|
else if (area == RIGHT_MARGIN_AREA) |
1032 |
|
x += (WINDOW_LEFT_FRINGE_WIDTH (w) |
1033 |
|
+ window_box_width (w, LEFT_MARGIN_AREA) |
1034 |
|
+ window_box_width (w, TEXT_AREA) |
1035 |
|
+ (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) |
1036 |
|
? 0 |
1037 |
|
: WINDOW_RIGHT_FRINGE_WIDTH (w))); |
1038 |
|
else if (area == LEFT_MARGIN_AREA |
1039 |
|
&& WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)) |
1040 |
|
x += WINDOW_LEFT_FRINGE_WIDTH (w); |
1041 |
|
|
1042 |
|
return x; |
1043 |
|
} |
1044 |
|
|
1045 |
|
|
1046 |
|
/* Return the window-relative coordinate of the right edge of display |
1047 |
|
area AREA of window W. AREA < 0 means return the left edge of the |
1048 |
|
whole window, to the left of the right fringe of W. */ |
1049 |
|
|
1050 |
|
INLINE int |
1051 |
|
window_box_right_offset (w, area) |
1052 |
|
struct window *w; |
1053 |
|
int area; |
1054 |
|
{ |
1055 |
|
return window_box_left_offset (w, area) + window_box_width (w, area); |
1056 |
|
} |
1057 |
|
|
1058 |
/* Return the frame-relative coordinate of the left edge of display |
/* Return the frame-relative coordinate of the left edge of display |
1059 |
area AREA of window W. AREA < 0 means return the left edge of the |
area AREA of window W. AREA < 0 means return the left edge of the |
1065 |
int area; |
int area; |
1066 |
{ |
{ |
1067 |
struct frame *f = XFRAME (w->frame); |
struct frame *f = XFRAME (w->frame); |
1068 |
int x = FRAME_INTERNAL_BORDER_WIDTH_SAFE (f); |
int x; |
1069 |
|
|
1070 |
if (!w->pseudo_window_p) |
if (w->pseudo_window_p) |
1071 |
{ |
return FRAME_INTERNAL_BORDER_WIDTH (f); |
|
x += (WINDOW_LEFT_MARGIN (w) * CANON_X_UNIT (f) |
|
|
+ FRAME_LEFT_FRINGE_WIDTH (f)); |
|
1072 |
|
|
1073 |
if (area == TEXT_AREA) |
x = (WINDOW_LEFT_EDGE_X (w) |
1074 |
x += window_box_width (w, LEFT_MARGIN_AREA); |
+ window_box_left_offset (w, area)); |
|
else if (area == RIGHT_MARGIN_AREA) |
|
|
x += (window_box_width (w, LEFT_MARGIN_AREA) |
|
|
+ window_box_width (w, TEXT_AREA)); |
|
|
} |
|
1075 |
|
|
1076 |
return x; |
return x; |
1077 |
} |
} |
1089 |
return window_box_left (w, area) + window_box_width (w, area); |
return window_box_left (w, area) + window_box_width (w, area); |
1090 |
} |
} |
1091 |
|
|
|
|
|
1092 |
/* Get the bounding box of the display area AREA of window W, without |
/* Get the bounding box of the display area AREA of window W, without |
1093 |
mode lines, in frame-relative coordinates. AREA < 0 means the |
mode lines, in frame-relative coordinates. AREA < 0 means the |
1094 |
whole window, not including the left and right fringes of |
whole window, not including the left and right fringes of |
1102 |
int area; |
int area; |
1103 |
int *box_x, *box_y, *box_width, *box_height; |
int *box_x, *box_y, *box_width, *box_height; |
1104 |
{ |
{ |
1105 |
struct frame *f = XFRAME (w->frame); |
if (box_width) |
1106 |
|
*box_width = window_box_width (w, area); |
1107 |
*box_width = window_box_width (w, area); |
if (box_height) |
1108 |
*box_height = window_box_height (w); |
*box_height = window_box_height (w); |
1109 |
*box_x = window_box_left (w, area); |
if (box_x) |
1110 |
*box_y = (FRAME_INTERNAL_BORDER_WIDTH_SAFE (f) |
*box_x = window_box_left (w, area); |
1111 |
+ XFASTINT (w->top) * CANON_Y_UNIT (f)); |
if (box_y) |
1112 |
if (WINDOW_WANTS_HEADER_LINE_P (w)) |
{ |
1113 |
*box_y += CURRENT_HEADER_LINE_HEIGHT (w); |
*box_y = WINDOW_TOP_EDGE_Y (w); |
1114 |
|
if (WINDOW_WANTS_HEADER_LINE_P (w)) |
1115 |
|
*box_y += CURRENT_HEADER_LINE_HEIGHT (w); |
1116 |
|
} |
1117 |
} |
} |
1118 |
|
|
1119 |
|
|
1231 |
{ |
{ |
1232 |
int top_y = it.current_y; |
int top_y = it.current_y; |
1233 |
int bottom_y = line_bottom_y (&it); |
int bottom_y = line_bottom_y (&it); |
1234 |
int window_top_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w); |
int window_top_y = WINDOW_HEADER_LINE_HEIGHT (w); |
1235 |
|
|
1236 |
if (top_y < window_top_y) |
if (top_y < window_top_y) |
1237 |
visible_p = bottom_y > window_top_y; |
visible_p = bottom_y > window_top_y; |
1468 |
#ifdef HAVE_WINDOW_SYSTEM |
#ifdef HAVE_WINDOW_SYSTEM |
1469 |
if (FRAME_WINDOW_P (f)) |
if (FRAME_WINDOW_P (f)) |
1470 |
{ |
{ |
1471 |
/* Arrange for the division in PIXEL_TO_CHAR_COL etc. to round down |
/* Arrange for the division in FRAME_PIXEL_X_TO_COL etc. to round down |
1472 |
even for negative values. */ |
even for negative values. */ |
1473 |
if (pix_x < 0) |
if (pix_x < 0) |
1474 |
pix_x -= FONT_WIDTH (FRAME_FONT (f)) - 1; |
pix_x -= FRAME_COLUMN_WIDTH (f) - 1; |
1475 |
if (pix_y < 0) |
if (pix_y < 0) |
1476 |
pix_y -= FRAME_X_OUTPUT(f)->line_height - 1; |
pix_y -= FRAME_LINE_HEIGHT (f) - 1; |
1477 |
|
|
1478 |
pix_x = PIXEL_TO_CHAR_COL (f, pix_x); |
pix_x = FRAME_PIXEL_X_TO_COL (f, pix_x); |
1479 |
pix_y = PIXEL_TO_CHAR_ROW (f, pix_y); |
pix_y = FRAME_PIXEL_Y_TO_LINE (f, pix_y); |
1480 |
|
|
1481 |
if (bounds) |
if (bounds) |
1482 |
STORE_NATIVE_RECT (*bounds, |
STORE_NATIVE_RECT (*bounds, |
1483 |
CHAR_TO_PIXEL_COL (f, pix_x), |
FRAME_COL_TO_PIXEL_X (f, pix_x), |
1484 |
CHAR_TO_PIXEL_ROW (f, pix_y), |
FRAME_LINE_TO_PIXEL_Y (f, pix_y), |
1485 |
FONT_WIDTH (FRAME_FONT (f)) - 1, |
FRAME_COLUMN_WIDTH (f) - 1, |
1486 |
FRAME_X_OUTPUT (f)->line_height - 1); |
FRAME_LINE_HEIGHT (f) - 1); |
1487 |
|
|
1488 |
if (!noclip) |
if (!noclip) |
1489 |
{ |
{ |
1490 |
if (pix_x < 0) |
if (pix_x < 0) |
1491 |
pix_x = 0; |
pix_x = 0; |
1492 |
else if (pix_x > FRAME_WINDOW_WIDTH (f)) |
else if (pix_x > FRAME_TOTAL_COLS (f)) |
1493 |
pix_x = FRAME_WINDOW_WIDTH (f); |
pix_x = FRAME_TOTAL_COLS (f); |
1494 |
|
|
1495 |
if (pix_y < 0) |
if (pix_y < 0) |
1496 |
pix_y = 0; |
pix_y = 0; |
1497 |
else if (pix_y > f->height) |
else if (pix_y > FRAME_LINES (f)) |
1498 |
pix_y = f->height; |
pix_y = FRAME_LINES (f); |
1499 |
} |
} |
1500 |
} |
} |
1501 |
#endif |
#endif |
1577 |
{ |
{ |
1578 |
struct glyph *glyph, *end; |
struct glyph *glyph, *end; |
1579 |
struct glyph_row *row = NULL; |
struct glyph_row *row = NULL; |
1580 |
int x0, i, left_area_width; |
int x0, i; |
1581 |
|
|
1582 |
/* Find row containing Y. Give up if some row is not enabled. */ |
/* Find row containing Y. Give up if some row is not enabled. */ |
1583 |
for (i = 0; i < w->current_matrix->nrows; ++i) |
for (i = 0; i < w->current_matrix->nrows; ++i) |
1604 |
} |
} |
1605 |
else |
else |
1606 |
{ |
{ |
1607 |
left_area_width = window_box_width (w, LEFT_MARGIN_AREA); |
if (x < window_box_left_offset (w, TEXT_AREA)) |
|
if (x < left_area_width) |
|
1608 |
{ |
{ |
1609 |
*area = LEFT_MARGIN_AREA; |
*area = LEFT_MARGIN_AREA; |
1610 |
x0 = 0; |
x0 = window_box_left_offset (w, LEFT_MARGIN_AREA); |
1611 |
} |
} |
1612 |
else if (x < left_area_width + window_box_width (w, TEXT_AREA)) |
else if (x < window_box_right_offset (w, TEXT_AREA)) |
1613 |
{ |
{ |
1614 |
*area = TEXT_AREA; |
*area = TEXT_AREA; |
1615 |
x0 = row->x + left_area_width; |
x0 = window_box_left_offset (w, TEXT_AREA); |
1616 |
} |
} |
1617 |
else |
else |
1618 |
{ |
{ |
1619 |
*area = RIGHT_MARGIN_AREA; |
*area = RIGHT_MARGIN_AREA; |
1620 |
x0 = left_area_width + window_box_width (w, TEXT_AREA); |
x0 = window_box_left_offset (w, RIGHT_MARGIN_AREA); |
1621 |
} |
} |
1622 |
} |
} |
1623 |
|
|
1660 |
/* A pseudo-window is always full-width, and starts at the |
/* A pseudo-window is always full-width, and starts at the |
1661 |
left edge of the frame, plus a frame border. */ |
left edge of the frame, plus a frame border. */ |
1662 |
struct frame *f = XFRAME (w->frame); |
struct frame *f = XFRAME (w->frame); |
1663 |
*x -= FRAME_INTERNAL_BORDER_WIDTH_SAFE (f); |
*x -= FRAME_INTERNAL_BORDER_WIDTH (f); |
1664 |
*y = FRAME_TO_WINDOW_PIXEL_Y (w, *y); |
*y = FRAME_TO_WINDOW_PIXEL_Y (w, *y); |
1665 |
} |
} |
1666 |
else |
else |
1667 |
{ |
{ |
1668 |
*x = FRAME_TO_WINDOW_PIXEL_X (w, *x); |
*x -= WINDOW_LEFT_EDGE_X (w); |
1669 |
*y = FRAME_TO_WINDOW_PIXEL_Y (w, *y); |
*y = FRAME_TO_WINDOW_PIXEL_Y (w, *y); |
1670 |
} |
} |
1671 |
} |
} |
1682 |
|
|
1683 |
if (s->row->full_width_p) |
if (s->row->full_width_p) |
1684 |
{ |
{ |
1685 |
/* Draw full-width. X coordinates are relative to S->w->left. */ |
/* Draw full-width. X coordinates are relative to S->w->left_col. */ |
1686 |
int canon_x = CANON_X_UNIT (s->f); |
r.x = WINDOW_LEFT_EDGE_X (s->w); |
1687 |
|
r.width = WINDOW_TOTAL_WIDTH (s->w); |
|
r.x = WINDOW_LEFT_MARGIN (s->w) * canon_x; |
|
|
r.width = XFASTINT (s->w->width) * canon_x; |
|
|
|
|
|
if (FRAME_HAS_VERTICAL_SCROLL_BARS (s->f)) |
|
|
{ |
|
|
int width = FRAME_SCROLL_BAR_WIDTH (s->f) * canon_x; |
|
|
if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (s->f)) |
|
|
r.x -= width; |
|
|
} |
|
|
|
|
|
r.x += FRAME_INTERNAL_BORDER_WIDTH (s->f); |
|
1688 |
|
|
1689 |
/* Unless displaying a mode or menu bar line, which are always |
/* Unless displaying a mode or menu bar line, which are always |
1690 |
fully visible, clip to the visible part of the row. */ |
fully visible, clip to the visible part of the row. */ |
1696 |
else |
else |
1697 |
{ |
{ |
1698 |
/* This is a text line that may be partially visible. */ |
/* This is a text line that may be partially visible. */ |
1699 |
r.x = WINDOW_AREA_TO_FRAME_PIXEL_X (s->w, s->area, 0); |
r.x = window_box_left (s->w, s->area); |
1700 |
r.width = window_box_width (s->w, s->area); |
r.width = window_box_width (s->w, s->area); |
1701 |
r.height = s->row->visible_height; |
r.height = s->row->visible_height; |
1702 |
} |
} |
1706 |
intentionally draws over other lines. */ |
intentionally draws over other lines. */ |
1707 |
if (s->for_overlaps_p) |
if (s->for_overlaps_p) |
1708 |
{ |
{ |
1709 |
r.y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (s->w); |
r.y = WINDOW_HEADER_LINE_HEIGHT (s->w); |
1710 |
r.height = window_text_bottom_y (s->w) - r.y; |
r.height = window_text_bottom_y (s->w) - r.y; |
1711 |
} |
} |
1712 |
else |
else |
1716 |
partially visible lines at the top of a window. */ |
partially visible lines at the top of a window. */ |
1717 |
if (!s->row->full_width_p |
if (!s->row->full_width_p |
1718 |
&& MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P (s->w, s->row)) |
&& MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P (s->w, s->row)) |
1719 |
r.y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (s->w); |
r.y = WINDOW_HEADER_LINE_HEIGHT (s->w); |
1720 |
else |
else |
1721 |
r.y = max (0, s->row->y); |
r.y = max (0, s->row->y); |
1722 |
|
|
2000 |
attribute changes of named faces, recompute them. When running |
attribute changes of named faces, recompute them. When running |
2001 |
in batch mode, the face cache of Vterminal_frame is null. If |
in batch mode, the face cache of Vterminal_frame is null. If |
2002 |
we happen to get called, make a dummy face cache. */ |
we happen to get called, make a dummy face cache. */ |
2003 |
if ( |
if (noninteractive && FRAME_FACE_CACHE (it->f) == NULL) |
|
#ifndef WINDOWSNT |
|
|
noninteractive && |
|
|
#endif |
|
|
FRAME_FACE_CACHE (it->f) == NULL) |
|
2004 |
init_frame_faces (it->f); |
init_frame_faces (it->f); |
2005 |
if (FRAME_FACE_CACHE (it->f)->used == 0) |
if (FRAME_FACE_CACHE (it->f)->used == 0) |
2006 |
recompute_basic_faces (it->f); |
recompute_basic_faces (it->f); |
2118 |
{ |
{ |
2119 |
/* Mode lines, menu bar in terminal frames. */ |
/* Mode lines, menu bar in terminal frames. */ |
2120 |
it->first_visible_x = 0; |
it->first_visible_x = 0; |
2121 |
it->last_visible_x = XFASTINT (w->width) * CANON_X_UNIT (it->f); |
it->last_visible_x = WINDOW_TOTAL_WIDTH (w); |
2122 |
} |
} |
2123 |
else |
else |
2124 |
{ |
{ |
2125 |
it->first_visible_x |
it->first_visible_x |
2126 |
= XFASTINT (it->w->hscroll) * CANON_X_UNIT (it->f); |
= XFASTINT (it->w->hscroll) * FRAME_COLUMN_WIDTH (it->f); |
2127 |
it->last_visible_x = (it->first_visible_x |
it->last_visible_x = (it->first_visible_x |
2128 |
+ window_box_width (w, TEXT_AREA)); |
+ window_box_width (w, TEXT_AREA)); |
2129 |
|
|
2140 |
} |
} |
2141 |
|
|
2142 |
it->header_line_p = WINDOW_WANTS_HEADER_LINE_P (w); |
it->header_line_p = WINDOW_WANTS_HEADER_LINE_P (w); |
2143 |
it->current_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w) + w->vscroll; |
it->current_y = WINDOW_HEADER_LINE_HEIGHT (w) + w->vscroll; |
2144 |
} |
} |
2145 |
|
|
2146 |
/* Leave room for a border glyph. */ |
/* Leave room for a border glyph. */ |
3597 |
return 0; |
return 0; |
3598 |
} |
} |
3599 |
|
|
3600 |
return CONSP (prop) && EQ (XCAR (prop), Qimage); |
return (CONSP (prop) |
3601 |
|
&& (EQ (XCAR (prop), Qimage) |
3602 |
|
|| EQ (XCAR (prop), Qspace))); |
3603 |
} |
} |
3604 |
|
|
3605 |
|
|
3983 |
int charpos; |
int charpos; |
3984 |
{ |
{ |
3985 |
extern Lisp_Object Qafter_string, Qbefore_string, Qwindow, Qpriority; |
extern Lisp_Object Qafter_string, Qbefore_string, Qwindow, Qpriority; |
3986 |
Lisp_Object ov, overlay, window, str, invisible; |
Lisp_Object overlay, window, str, invisible; |
3987 |
|
struct Lisp_Overlay *ov; |
3988 |
int start, end; |
int start, end; |
3989 |
int size = 20; |
int size = 20; |
3990 |
int n = 0, i, j, invis_p; |
int n = 0, i, j, invis_p; |
4024 |
while (0) |
while (0) |
4025 |
|
|
4026 |
/* Process overlay before the overlay center. */ |
/* Process overlay before the overlay center. */ |
4027 |
for (ov = current_buffer->overlays_before; CONSP (ov); ov = XCDR (ov)) |
for (ov = current_buffer->overlays_before; ov; ov = ov->next) |
4028 |
{ |
{ |
4029 |
overlay = XCAR (ov); |
XSETMISC (overlay, ov); |
4030 |
xassert (OVERLAYP (overlay)); |
xassert (OVERLAYP (overlay)); |
4031 |
start = OVERLAY_POSITION (OVERLAY_START (overlay)); |
start = OVERLAY_POSITION (OVERLAY_START (overlay)); |
4032 |
end = OVERLAY_POSITION (OVERLAY_END (overlay)); |
end = OVERLAY_POSITION (OVERLAY_END (overlay)); |
4064 |
} |
} |
4065 |
|
|
4066 |
/* Process overlays after the overlay center. */ |
/* Process overlays after the overlay center. */ |
4067 |
for (ov = current_buffer->overlays_after; CONSP (ov); ov = XCDR (ov)) |
for (ov = current_buffer->overlays_after; ov; ov = ov->next) |
4068 |
{ |
{ |
4069 |
overlay = XCAR (ov); |
XSETMISC (overlay, ov); |
4070 |
xassert (OVERLAYP (overlay)); |
xassert (OVERLAYP (overlay)); |
4071 |
start = OVERLAY_POSITION (OVERLAY_START (overlay)); |
start = OVERLAY_POSITION (OVERLAY_START (overlay)); |
4072 |
end = OVERLAY_POSITION (OVERLAY_END (overlay)); |
end = OVERLAY_POSITION (OVERLAY_END (overlay)); |
4534 |
IT_STRING_BYTEPOS (*it) = -1; |
IT_STRING_BYTEPOS (*it) = -1; |
4535 |
it->string = Qnil; |
it->string = Qnil; |
4536 |
it->method = next_element_from_buffer; |
it->method = next_element_from_buffer; |
4537 |
|
/* RMS: I added this to fix a bug in move_it_vertically_backward |
4538 |
|
where it->area continued to relate to the starting point |
4539 |
|
for the backward motion. Bug report from |
4540 |
|
Nick Roberts <nick@nick.uklinux.net> on 19 May 2003. |
4541 |
|
However, I am not sure whether reseat still does the right thing |
4542 |
|
in general after this change. */ |
4543 |
|
it->area = TEXT_AREA; |
4544 |
it->multibyte_p = !NILP (current_buffer->enable_multibyte_characters); |
it->multibyte_p = !NILP (current_buffer->enable_multibyte_characters); |
4545 |
it->sp = 0; |
it->sp = 0; |
4546 |
it->face_before_selective_p = 0; |
it->face_before_selective_p = 0; |
5835 |
xassert (dy >= 0); |
xassert (dy >= 0); |
5836 |
|
|
5837 |
/* Estimate how many newlines we must move back. */ |
/* Estimate how many newlines we must move back. */ |
5838 |
nlines = max (1, dy / CANON_Y_UNIT (it->f)); |
nlines = max (1, dy / FRAME_LINE_HEIGHT (it->f)); |
5839 |
|
|
5840 |
/* Set the iterator's position that many lines back. */ |
/* Set the iterator's position that many lines back. */ |
5841 |
while (nlines-- && IT_CHARPOS (*it) > BEGV) |
while (nlines-- && IT_CHARPOS (*it) > BEGV) |
5864 |
|
|
5865 |
move_it_to (&it2, start_pos, -1, -1, -1, MOVE_TO_POS); |
move_it_to (&it2, start_pos, -1, -1, -1, MOVE_TO_POS); |
5866 |
xassert (IT_CHARPOS (*it) >= BEGV); |
xassert (IT_CHARPOS (*it) >= BEGV); |
5867 |
|
/* H is the actual vertical distance from the position in *IT |
5868 |
|
and the starting position. */ |
5869 |
h = it2.current_y - it->current_y; |
h = it2.current_y - it->current_y; |
5870 |
|
/* NLINES is the distance in number of lines. */ |
5871 |
nlines = it2.vpos - it->vpos; |
nlines = it2.vpos - it->vpos; |
5872 |
|
|
5873 |
/* Correct IT's y and vpos position. */ |
/* Correct IT's y and vpos position |
5874 |
|
so that they are relative to the starting point. */ |
5875 |
it->vpos -= nlines; |
it->vpos -= nlines; |
5876 |
it->current_y -= h; |
it->current_y -= h; |
5877 |
|
|
5883 |
move_it_by_lines (it, nlines, 1); |
move_it_by_lines (it, nlines, 1); |
5884 |
xassert (IT_CHARPOS (*it) <= start_pos); |
xassert (IT_CHARPOS (*it) <= start_pos); |
5885 |
} |
} |
5886 |
else if (nlines) |
else |
5887 |
{ |
{ |
5888 |
/* The y-position we try to reach. Note that h has been |
/* The y-position we try to reach, relative to *IT. |
5889 |
subtracted in front of the if-statement. */ |
Note that H has been subtracted in front of the if-statement. */ |
5890 |
int target_y = it->current_y + h - dy; |
int target_y = it->current_y + h - dy; |
5891 |
int y0 = it3.current_y; |
int y0 = it3.current_y; |
5892 |
int y1 = line_bottom_y (&it3); |
int y1 = line_bottom_y (&it3); |
6301 |
XMARKER (oldpoint)->bytepos); |
XMARKER (oldpoint)->bytepos); |
6302 |
|
|
6303 |
UNGCPRO; |
UNGCPRO; |
6304 |
unchain_marker (oldpoint); |
unchain_marker (XMARKER (oldpoint)); |
6305 |
unchain_marker (oldbegv); |
unchain_marker (XMARKER (oldbegv)); |
6306 |
unchain_marker (oldzv); |
unchain_marker (XMARKER (oldzv)); |
6307 |
|
|
6308 |
tem = Fget_buffer_window (Fcurrent_buffer (), Qt); |
tem = Fget_buffer_window (Fcurrent_buffer (), Qt); |
6309 |
set_buffer_internal (oldbuf); |
set_buffer_internal (oldbuf); |
7146 |
{ |
{ |
7147 |
struct it it; |
struct it it; |
7148 |
struct window *root = XWINDOW (FRAME_ROOT_WINDOW (f)); |
struct window *root = XWINDOW (FRAME_ROOT_WINDOW (f)); |
7149 |
int total_height = XFASTINT (root->height) + XFASTINT (w->height); |
int total_height = WINDOW_TOTAL_LINES (root) + WINDOW_TOTAL_LINES (w); |
7150 |
int height, max_height; |
int height, max_height; |
7151 |
int unit = CANON_Y_UNIT (f); |
int unit = FRAME_LINE_HEIGHT (f); |
7152 |
struct text_pos start; |
struct text_pos start; |
7153 |
struct buffer *old_current_buffer = NULL; |
struct buffer *old_current_buffer = NULL; |
7154 |
|
|
7162 |
|
|
7163 |
/* Compute the max. number of lines specified by the user. */ |
/* Compute the max. number of lines specified by the user. */ |
7164 |
if (FLOATP (Vmax_mini_window_height)) |
if (FLOATP (Vmax_mini_window_height)) |
7165 |
max_height = XFLOATINT (Vmax_mini_window_height) * FRAME_HEIGHT (f); |
max_height = XFLOATINT (Vmax_mini_window_height) * FRAME_LINES (f); |
7166 |
else if (INTEGERP (Vmax_mini_window_height)) |
else if (INTEGERP (Vmax_mini_window_height)) |
7167 |
max_height = XINT (Vmax_mini_window_height); |
max_height = XINT (Vmax_mini_window_height); |
7168 |
else |
else |
7203 |
{ |
{ |
7204 |
/* Let it grow only, until we display an empty message, in which |
/* Let it grow only, until we display an empty message, in which |
7205 |
case the window shrinks again. */ |
case the window shrinks again. */ |
7206 |
if (height > XFASTINT (w->height)) |
if (height > WINDOW_TOTAL_LINES (w)) |
7207 |
{ |
{ |
7208 |
int old_height = XFASTINT (w->height); |
int old_height = WINDOW_TOTAL_LINES (w); |
7209 |
freeze_window_starts (f, 1); |
freeze_window_starts (f, 1); |
7210 |
grow_mini_window (w, height - XFASTINT (w->height)); |
grow_mini_window (w, height - WINDOW_TOTAL_LINES (w)); |
7211 |
window_height_changed_p = XFASTINT (w->height) != old_height; |
window_height_changed_p = WINDOW_TOTAL_LINES (w) != old_height; |
7212 |
} |
} |
7213 |
else if (height < XFASTINT (w->height) |
else if (height < WINDOW_TOTAL_LINES (w) |
7214 |
&& (exact_p || BEGV == ZV)) |
&& (exact_p || BEGV == ZV)) |
7215 |
{ |
{ |
7216 |
int old_height = XFASTINT (w->height); |
int old_height = WINDOW_TOTAL_LINES (w); |
7217 |
freeze_window_starts (f, 0); |
freeze_window_starts (f, 0); |
7218 |
shrink_mini_window (w); |
shrink_mini_window (w); |
7219 |
window_height_changed_p = XFASTINT (w->height) != old_height; |
window_height_changed_p = WINDOW_TOTAL_LINES (w) != old_height; |
7220 |
} |
} |
7221 |
} |
} |
7222 |
else |
else |
7223 |
{ |
{ |
7224 |
/* Always resize to exact size needed. */ |
/* Always resize to exact size needed. */ |
7225 |
if (height > XFASTINT (w->height)) |
if (height > WINDOW_TOTAL_LINES (w)) |
7226 |
{ |
{ |
7227 |
int old_height = XFASTINT (w->height); |
int old_height = WINDOW_TOTAL_LINES (w); |
7228 |
freeze_window_starts (f, 1); |
freeze_window_starts (f, 1); |
7229 |
grow_mini_window (w, height - XFASTINT (w->height)); |
grow_mini_window (w, height - WINDOW_TOTAL_LINES (w)); |
7230 |
window_height_changed_p = XFASTINT (w->height) != old_height; |
window_height_changed_p = WINDOW_TOTAL_LINES (w) != old_height; |
7231 |
} |
} |
7232 |
else if (height < XFASTINT (w->height)) |
else if (height < WINDOW_TOTAL_LINES (w)) |
7233 |
{ |
{ |
7234 |
int old_height = XFASTINT (w->height); |
int old_height = WINDOW_TOTAL_LINES (w); |
7235 |
freeze_window_starts (f, 0); |
freeze_window_starts (f, 0); |
7236 |
shrink_mini_window (w); |
shrink_mini_window (w); |
7237 |
|
|
7238 |
if (height) |
if (height) |
7239 |
{ |
{ |
7240 |
freeze_window_starts (f, 1); |
freeze_window_starts (f, 1); |
7241 |
grow_mini_window (w, height - XFASTINT (w->height)); |
grow_mini_window (w, height - WINDOW_TOTAL_LINES (w)); |
7242 |
} |
} |
7243 |
|
|
7244 |
window_height_changed_p = XFASTINT (w->height) != old_height; |
window_height_changed_p = WINDOW_TOTAL_LINES (w) != old_height; |
7245 |
} |
} |
7246 |
} |
} |
7247 |
|
|
8144 |
int do_update = FRAME_EXTERNAL_TOOL_BAR(f); |
int do_update = FRAME_EXTERNAL_TOOL_BAR(f); |
8145 |
#else |
#else |
8146 |
int do_update = WINDOWP (f->tool_bar_window) |
int do_update = WINDOWP (f->tool_bar_window) |
8147 |
&& XFASTINT (XWINDOW (f->tool_bar_window)->height) > 0; |
&& WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window)) > 0; |
8148 |
#endif |
#endif |
8149 |
|
|
8150 |
if (do_update) |
if (do_update) |
8197 |
GCPRO1 (old_tool_bar); |
GCPRO1 (old_tool_bar); |
8198 |
|
|
8199 |
/* Build desired tool-bar items from keymaps. */ |
/* Build desired tool-bar items from keymaps. */ |
8200 |
|
BLOCK_INPUT; |
8201 |
f->tool_bar_items |
f->tool_bar_items |
8202 |
= tool_bar_items (f->tool_bar_items, &f->n_tool_bar_items); |
= tool_bar_items (f->tool_bar_items, &f->n_tool_bar_items); |
8203 |
|
UNBLOCK_INPUT; |
8204 |
|
|
8205 |
/* Redisplay the tool-bar if we changed it. */ |
/* Redisplay the tool-bar if we changed it. */ |
8206 |
if (! NILP (Fequal (old_tool_bar, f->tool_bar_items))) |
if (! NILP (Fequal (old_tool_bar, f->tool_bar_items))) |
8207 |
w->update_mode_line = Qt; |
w->update_mode_line = Qt; |
8208 |
|
|
8209 |
|
UNGCPRO; |
8210 |
|
|
8211 |
unbind_to (count, Qnil); |
unbind_to (count, Qnil); |
8212 |
set_buffer_internal_1 (prev); |
set_buffer_internal_1 (prev); |
8479 |
F->desired_tool_bar_string in the tool-bar window of frame F. */ |
F->desired_tool_bar_string in the tool-bar window of frame F. */ |
8480 |
init_iterator (&it, w, -1, -1, w->desired_matrix->rows, TOOL_BAR_FACE_ID); |
init_iterator (&it, w, -1, -1, w->desired_matrix->rows, TOOL_BAR_FACE_ID); |
8481 |
it.first_visible_x = 0; |
it.first_visible_x = 0; |
8482 |
it.last_visible_x = FRAME_WINDOW_WIDTH (f) * CANON_X_UNIT (f); |
it.last_visible_x = FRAME_TOTAL_COLS (f) * FRAME_COLUMN_WIDTH (f); |
8483 |
reseat_to_string (&it, NULL, f->desired_tool_bar_string, 0, 0, 0, -1); |
reseat_to_string (&it, NULL, f->desired_tool_bar_string, 0, 0, 0, -1); |
8484 |
|
|
8485 |
while (!ITERATOR_AT_END_P (&it)) |
while (!ITERATOR_AT_END_P (&it)) |
8489 |
display_tool_bar_line (&it); |
display_tool_bar_line (&it); |
8490 |
} |
} |
8491 |
|
|
8492 |
return (it.current_y + CANON_Y_UNIT (f) - 1) / CANON_Y_UNIT (f); |
return (it.current_y + FRAME_LINE_HEIGHT (f) - 1) / FRAME_LINE_HEIGHT (f); |
8493 |
} |
} |
8494 |
|
|
8495 |
|
|
8511 |
|
|
8512 |
if (WINDOWP (f->tool_bar_window) |
if (WINDOWP (f->tool_bar_window) |
8513 |
|| (w = XWINDOW (f->tool_bar_window), |
|| (w = XWINDOW (f->tool_bar_window), |
8514 |
XFASTINT (w->height) > 0)) |
WINDOW_TOTAL_LINES (w) > 0)) |
8515 |
{ |
{ |
8516 |
update_tool_bar (f, 1); |
update_tool_bar (f, 1); |
8517 |
if (f->n_tool_bar_items) |
if (f->n_tool_bar_items) |
8549 |
can turn off tool-bars by specifying tool-bar-lines zero. */ |
can turn off tool-bars by specifying tool-bar-lines zero. */ |
8550 |
if (!WINDOWP (f->tool_bar_window) |
if (!WINDOWP (f->tool_bar_window) |
8551 |
|| (w = XWINDOW (f->tool_bar_window), |
|| (w = XWINDOW (f->tool_bar_window), |
8552 |
XFASTINT (w->height) == 0)) |
WINDOW_TOTAL_LINES (w) == 0)) |
8553 |
return 0; |
return 0; |
8554 |
|
|
8555 |
/* Set up an iterator for the tool-bar window. */ |
/* Set up an iterator for the tool-bar window. */ |
8556 |
init_iterator (&it, w, -1, -1, w->desired_matrix->rows, TOOL_BAR_FACE_ID); |
init_iterator (&it, w, -1, -1, w->desired_matrix->rows, TOOL_BAR_FACE_ID); |
8557 |
it.first_visible_x = 0; |
it.first_visible_x = 0; |
8558 |
it.last_visible_x = FRAME_WINDOW_WIDTH (f) * CANON_X_UNIT (f); |
it.last_visible_x = FRAME_TOTAL_COLS (f) * FRAME_COLUMN_WIDTH (f); |
8559 |
row = it.glyph_row; |
row = it.glyph_row; |
8560 |
|
|
8561 |
/* Build a string that represents the contents of the tool-bar. */ |
/* Build a string that represents the contents of the tool-bar. */ |
8582 |
|
|
8583 |
/* If there are blank lines at the end, except for a partially |
/* If there are blank lines at the end, except for a partially |
8584 |
visible blank line at the end that is smaller than |
visible blank line at the end that is smaller than |
8585 |
CANON_Y_UNIT, change the tool-bar's height. */ |
FRAME_LINE_HEIGHT, change the tool-bar's height. */ |
8586 |
row = it.glyph_row - 1; |
row = it.glyph_row - 1; |
8587 |
if (!row->displays_text_p |
if (!row->displays_text_p |
8588 |
&& row->height >= CANON_Y_UNIT (f)) |
&& row->height >= FRAME_LINE_HEIGHT (f)) |
8589 |
change_height_p = 1; |
change_height_p = 1; |
8590 |
|
|
8591 |
/* If row displays tool-bar items, but is partially visible, |
/* If row displays tool-bar items, but is partially visible, |
8598 |
frame parameter. */ |
frame parameter. */ |
8599 |
if (change_height_p |
if (change_height_p |
8600 |
&& (nlines = tool_bar_lines_needed (f), |
&& (nlines = tool_bar_lines_needed (f), |
8601 |
nlines != XFASTINT (w->height))) |
nlines != WINDOW_TOTAL_LINES (w))) |
8602 |
{ |
{ |
8603 |
extern Lisp_Object Qtool_bar_lines; |
extern Lisp_Object Qtool_bar_lines; |
8604 |
Lisp_Object frame; |
Lisp_Object frame; |
8605 |
int old_height = XFASTINT (w->height); |
int old_height = WINDOW_TOTAL_LINES (w); |
8606 |
|
|
8607 |
XSETFRAME (frame, f); |
XSETFRAME (frame, f); |
8608 |
clear_glyph_matrix (w->desired_matrix); |
clear_glyph_matrix (w->desired_matrix); |
8610 |
Fcons (Fcons (Qtool_bar_lines, |
Fcons (Fcons (Qtool_bar_lines, |
8611 |
make_number (nlines)), |
make_number (nlines)), |
8612 |
Qnil)); |
Qnil)); |
8613 |
if (XFASTINT (w->height) != old_height) |
if (WINDOW_TOTAL_LINES (w) != old_height) |
8614 |
fonts_changed_p = 1; |
fonts_changed_p = 1; |
8615 |
} |
} |
8616 |
} |
} |
8742 |
{ |
{ |
8743 |
Lisp_Object key, frame; |
Lisp_Object key, frame; |
8744 |
struct input_event event; |
struct input_event event; |
8745 |
|
EVENT_INIT (event); |
8746 |
|
|
8747 |
/* Show item in released state. */ |
/* Show item in released state. */ |
8748 |
show_mouse_face (dpyinfo, DRAW_IMAGE_RAISED); |
show_mouse_face (dpyinfo, DRAW_IMAGE_RAISED); |
8824 |
if (!NILP (enabled_p)) |
if (!NILP (enabled_p)) |
8825 |
{ |
{ |
8826 |
/* Compute the x-position of the glyph. In front and past the |
/* Compute the x-position of the glyph. In front and past the |
8827 |
image is a space. We include this is the highlighted area. */ |
image is a space. We include this in the highlighted area. */ |
8828 |
row = MATRIX_ROW (w->current_matrix, vpos); |
row = MATRIX_ROW (w->current_matrix, vpos); |
8829 |
for (i = x = 0; i < hpos; ++i) |
for (i = x = 0; i < hpos; ++i) |
8830 |
x += row->glyphs[TEXT_AREA][i].pixel_width; |
x += row->glyphs[TEXT_AREA][i].pixel_width; |
8951 |
p.bx = -1; |
p.bx = -1; |
8952 |
if (left_p) |
if (left_p) |
8953 |
{ |
{ |
8954 |
if (p.wd > FRAME_X_LEFT_FRINGE_WIDTH (f)) |
int wd = WINDOW_LEFT_FRINGE_WIDTH (w); |
8955 |
p.wd = FRAME_X_LEFT_FRINGE_WIDTH (f); |
int x = window_box_left (w, (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) |
8956 |
p.x = (WINDOW_TO_FRAME_PIXEL_X (w, 0) |
? LEFT_MARGIN_AREA |
8957 |
- p.wd |
: TEXT_AREA)); |
8958 |
- (FRAME_X_LEFT_FRINGE_WIDTH (f) - p.wd) / 2); |
if (p.wd > wd) |
8959 |
if (p.wd < FRAME_X_LEFT_FRINGE_WIDTH (f) || row->height > p.h) |
p.wd = wd; |
8960 |
|
p.x = x - p.wd - (wd - p.wd) / 2; |
8961 |
|
|
8962 |
|
if (p.wd < wd || row->height > p.h) |
8963 |
{ |
{ |
8964 |
/* If W has a vertical border to its left, don't draw over it. */ |
/* If W has a vertical border to its left, don't draw over it. */ |
8965 |
int border = ((XFASTINT (w->left) > 0 |
wd -= ((!WINDOW_LEFTMOST_P (w) |
8966 |
&& !FRAME_HAS_VERTICAL_SCROLL_BARS (f)) |
&& !WINDOW_HAS_VERTICAL_SCROLL_BAR (w)) |
8967 |
? 1 : 0); |
? 1 : 0); |
8968 |
p.bx = (window_box_left (w, -1) |
p.bx = x - wd; |
8969 |
- FRAME_X_LEFT_FRINGE_WIDTH (f) |
p.nx = wd; |
|
+ border); |
|
|
p.nx = (FRAME_X_LEFT_FRINGE_WIDTH (f) - border); |
|
8970 |
} |
} |
8971 |
} |
} |
8972 |
else |
else |
8973 |
{ |
{ |
8974 |
if (p.wd > FRAME_X_RIGHT_FRINGE_WIDTH (f)) |
int x = window_box_right (w, |
8975 |
p.wd = FRAME_X_RIGHT_FRINGE_WIDTH (f); |
(WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) |
8976 |
p.x = (window_box_right (w, -1) |
? RIGHT_MARGIN_AREA |
8977 |
+ (FRAME_X_RIGHT_FRINGE_WIDTH (f) - p.wd) / 2); |
: TEXT_AREA)); |
8978 |
|
int wd = WINDOW_RIGHT_FRINGE_WIDTH (w); |
8979 |
|
if (p.wd > wd) |
8980 |
|
p.wd = wd; |
8981 |
|
p.x = x + (wd - p.wd) / 2; |
8982 |
/* Clear right fringe if no bitmap to draw of if bitmap doesn't fill |
/* Clear right fringe if no bitmap to draw of if bitmap doesn't fill |
8983 |
the fringe. */ |
the fringe. */ |
8984 |
if (p.wd < FRAME_X_RIGHT_FRINGE_WIDTH (f) || row->height > p.h) |
if (p.wd < wd || row->height > p.h) |
8985 |
{ |
{ |
8986 |
p.bx = window_box_right (w, -1); |
p.bx = x; |
8987 |
p.nx = FRAME_X_RIGHT_FRINGE_WIDTH (f); |
p.nx = wd; |
8988 |
} |
} |
8989 |
} |
} |
8990 |
|
|
8991 |
if (p.bx >= 0) |
if (p.bx >= 0) |
8992 |
{ |
{ |
8993 |
int header_line_height = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w); |
int header_line_height = WINDOW_HEADER_LINE_HEIGHT (w); |
8994 |
|
|
8995 |
p.by = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, row->y)); |
p.by = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, row->y)); |
8996 |
p.ny = row->visible_height; |
p.ny = row->visible_height; |
9010 |
struct window *w; |
struct window *w; |
9011 |
struct glyph_row *row; |
struct glyph_row *row; |
9012 |
{ |
{ |
|
struct frame *f = XFRAME (w->frame); |
|
9013 |
enum fringe_bitmap_type bitmap; |
enum fringe_bitmap_type bitmap; |
9014 |
|
|
9015 |
xassert (interrupt_input_blocked); |
xassert (interrupt_input_blocked); |
9019 |
if (row->visible_height <= 0) |
if (row->visible_height <= 0) |
9020 |
return; |
return; |
9021 |
|
|
9022 |
if (FRAME_X_LEFT_FRINGE_WIDTH (f) != 0) |
if (WINDOW_LEFT_FRINGE_WIDTH (w) != 0) |
9023 |
{ |
{ |
9024 |
/* Decide which bitmap to draw in the left fringe. */ |
/* Decide which bitmap to draw in the left fringe. */ |
9025 |
if (row->overlay_arrow_p) |
if (row->overlay_arrow_p) |
9036 |
draw_fringe_bitmap (w, row, bitmap, 1); |
draw_fringe_bitmap (w, row, bitmap, 1); |
9037 |
} |
} |
9038 |
|
|
9039 |
if (FRAME_X_RIGHT_FRINGE_WIDTH (f) != 0) |
if (WINDOW_RIGHT_FRINGE_WIDTH (w) != 0) |
9040 |
{ |
{ |
9041 |
/* Decide which bitmap to draw in the right fringe. */ |
/* Decide which bitmap to draw in the right fringe. */ |
9042 |
if (row->truncated_on_right_p) |
if (row->truncated_on_right_p) |
9043 |
bitmap = RIGHT_TRUNCATION_BITMAP; |
bitmap = RIGHT_TRUNCATION_BITMAP; |
9044 |
else if (row->continued_p) |
else if (row->continued_p) |
9045 |
bitmap = CONTINUED_LINE_BITMAP; |
bitmap = CONTINUED_LINE_BITMAP; |
9046 |
else if (row->indicate_empty_line_p && FRAME_X_LEFT_FRINGE_WIDTH (f) == 0) |
else if (row->indicate_empty_line_p && WINDOW_LEFT_FRINGE_WIDTH (w) == 0) |
9047 |
bitmap = ZV_LINE_BITMAP; |
bitmap = ZV_LINE_BITMAP; |
9048 |
else |
else |
9049 |
bitmap = NO_FRINGE_BITMAP; |
bitmap = NO_FRINGE_BITMAP; |
9053 |
} |
} |
9054 |
|
|
9055 |
|
|
9056 |
/* Compute actual fringe widths */ |
/* Compute actual fringe widths for frame F. |
9057 |
|
|
9058 |
|
If REDRAW is 1, redraw F if the fringe settings was actually |
9059 |
|
modified and F is visible. |
9060 |
|
|
9061 |
|
Since the combined left and right fringe must occupy an integral |
9062 |
|
number of columns, we may need to add some pixels to each fringe. |
9063 |
|
Typically, we add an equal amount (+/- 1 pixel) to each fringe, |
9064 |
|
but a negative width value is taken literally (after negating it). |
9065 |
|
|
9066 |
|
We never make the fringes narrower than specified. It is planned |
9067 |
|
to make fringe bitmaps customizable and expandable, and at that |
9068 |
|
time, the user will typically specify the minimum number of pixels |
9069 |
|
needed for his bitmaps, so we shouldn't select anything less than |
9070 |
|
what is specified. |
9071 |
|
*/ |
9072 |
|
|
9073 |
void |
void |
9074 |
compute_fringe_widths (f, redraw) |
compute_fringe_widths (f, redraw) |
9075 |
struct frame *f; |
struct frame *f; |
9076 |
int redraw; |
int redraw; |
9077 |
{ |
{ |
9078 |
int o_left = FRAME_X_LEFT_FRINGE_WIDTH (f); |
int o_left = FRAME_LEFT_FRINGE_WIDTH (f); |
9079 |
int o_right = FRAME_X_RIGHT_FRINGE_WIDTH (f); |
int o_right = FRAME_RIGHT_FRINGE_WIDTH (f); |
9080 |
int o_cols = FRAME_X_FRINGE_COLS (f); |
int o_cols = FRAME_FRINGE_COLS (f); |
9081 |
|
|
9082 |
Lisp_Object left_fringe = Fassq (Qleft_fringe, f->param_alist); |
Lisp_Object left_fringe = Fassq (Qleft_fringe, f->param_alist); |
9083 |
Lisp_Object right_fringe = Fassq (Qright_fringe, f->param_alist); |
Lisp_Object right_fringe = Fassq (Qright_fringe, f->param_alist); |
9098 |
int left_wid = left_fringe_width >= 0 ? left_fringe_width : -left_fringe_width; |
int left_wid = left_fringe_width >= 0 ? left_fringe_width : -left_fringe_width; |
9099 |
int right_wid = right_fringe_width >= 0 ? right_fringe_width : -right_fringe_width; |
int right_wid = right_fringe_width >= 0 ? right_fringe_width : -right_fringe_width; |
9100 |
int conf_wid = left_wid + right_wid; |
int conf_wid = left_wid + right_wid; |
9101 |
int font_wid = FONT_WIDTH (FRAME_FONT (f)); |
int font_wid = FRAME_COLUMN_WIDTH (f); |
9102 |
int cols = (left_wid + right_wid + font_wid-1) / font_wid; |
int cols = (left_wid + right_wid + font_wid-1) / font_wid; |
9103 |
int real_wid = cols * font_wid; |
int real_wid = cols * font_wid; |
9104 |
if (left_wid && right_wid) |
if (left_wid && right_wid) |
9106 |
if (left_fringe_width < 0) |
if (left_fringe_width < 0) |
9107 |
{ |
{ |
9108 |
/* Left fringe width is fixed, adjust right fringe if necessary */ |
/* Left fringe width is fixed, adjust right fringe if necessary */ |
9109 |
FRAME_X_LEFT_FRINGE_WIDTH (f) = left_wid; |
FRAME_LEFT_FRINGE_WIDTH (f) = left_wid; |
9110 |
FRAME_X_RIGHT_FRINGE_WIDTH (f) = real_wid - left_wid; |
FRAME_RIGHT_FRINGE_WIDTH (f) = real_wid - left_wid; |
9111 |
} |
} |
9112 |
else if (right_fringe_width < 0) |
else if (right_fringe_width < 0) |
9113 |
{ |
{ |
9114 |
/* Right fringe width is fixed, adjust left fringe if necessary */ |
/* Right fringe width is fixed, adjust left fringe if necessary */ |
9115 |
FRAME_X_LEFT_FRINGE_WIDTH (f) = real_wid - right_wid; |
FRAME_LEFT_FRINGE_WIDTH (f) = real_wid - right_wid; |
9116 |
FRAME_X_RIGHT_FRINGE_WIDTH (f) = right_wid; |
FRAME_RIGHT_FRINGE_WIDTH (f) = right_wid; |
9117 |
} |
} |
9118 |
else |
else |
9119 |
{ |
{ |
9121 |
Note that we are doing integer arithmetic here, so don't |
Note that we are doing integer arithmetic here, so don't |
9122 |
lose a pixel if the total width is an odd number. */ |
lose a pixel if the total width is an odd number. */ |
9123 |
int fill = real_wid - conf_wid; |
int fill = real_wid - conf_wid; |
9124 |
FRAME_X_LEFT_FRINGE_WIDTH (f) = left_wid + fill/2; |
FRAME_LEFT_FRINGE_WIDTH (f) = left_wid + fill/2; |
9125 |
FRAME_X_RIGHT_FRINGE_WIDTH (f) = right_wid + fill - fill/2; |
FRAME_RIGHT_FRINGE_WIDTH (f) = right_wid + fill - fill/2; |
9126 |
} |
} |
9127 |
} |
} |
9128 |
else if (left_fringe_width) |
else if (left_fringe_width) |
9129 |
{ |
{ |
9130 |
FRAME_X_LEFT_FRINGE_WIDTH (f) = real_wid; |
FRAME_LEFT_FRINGE_WIDTH (f) = real_wid; |
9131 |
FRAME_X_RIGHT_FRINGE_WIDTH (f) = 0; |
FRAME_RIGHT_FRINGE_WIDTH (f) = 0; |
9132 |
} |
} |
9133 |
else |
else |
9134 |
{ |
{ |
9135 |
FRAME_X_LEFT_FRINGE_WIDTH (f) = 0; |
FRAME_LEFT_FRINGE_WIDTH (f) = 0; |
9136 |
FRAME_X_RIGHT_FRINGE_WIDTH (f) = real_wid; |
FRAME_RIGHT_FRINGE_WIDTH (f) = real_wid; |
9137 |
} |
} |
9138 |
FRAME_X_FRINGE_COLS (f) = cols; |
FRAME_FRINGE_COLS (f) = cols; |
|
FRAME_X_FRINGE_WIDTH (f) = real_wid; |
|
9139 |
} |
} |
9140 |
else |
else |
9141 |
{ |
{ |
9142 |
FRAME_X_LEFT_FRINGE_WIDTH (f) = 0; |
FRAME_LEFT_FRINGE_WIDTH (f) = 0; |
9143 |
FRAME_X_RIGHT_FRINGE_WIDTH (f) = 0; |
FRAME_RIGHT_FRINGE_WIDTH (f) = 0; |
9144 |
FRAME_X_FRINGE_COLS (f) = 0; |
FRAME_FRINGE_COLS (f) = 0; |
|
FRAME_X_FRINGE_WIDTH (f) = 0; |
|
9145 |
} |
} |
9146 |
|
|
9147 |
if (redraw && FRAME_VISIBLE_P (f)) |
if (redraw && FRAME_VISIBLE_P (f)) |
9148 |
if (o_left != FRAME_X_LEFT_FRINGE_WIDTH (f) || |
if (o_left != FRAME_LEFT_FRINGE_WIDTH (f) || |
9149 |
o_right != FRAME_X_RIGHT_FRINGE_WIDTH (f) || |
o_right != FRAME_RIGHT_FRINGE_WIDTH (f) || |
9150 |
o_cols != FRAME_X_FRINGE_COLS (f)) |
o_cols != FRAME_FRINGE_COLS (f)) |
9151 |
redraw_frame (f); |
redraw_frame (f); |
9152 |
} |
} |
9153 |
|
|
9205 |
hscrolled_p |= hscroll_window_tree (w->vchild); |
hscrolled_p |= hscroll_window_tree (w->vchild); |
9206 |
else if (w->cursor.vpos >= 0) |
else if (w->cursor.vpos >= 0) |
9207 |
{ |
{ |
9208 |
int h_margin, text_area_x, text_area_y; |
int h_margin; |
9209 |
int text_area_width, text_area_height; |
int text_area_width; |
9210 |
struct glyph_row *current_cursor_row |
struct glyph_row *current_cursor_row |
9211 |
= MATRIX_ROW (w->current_matrix, w->cursor.vpos); |
= MATRIX_ROW (w->current_matrix, w->cursor.vpos); |
9212 |
struct glyph_row *desired_cursor_row |
struct glyph_row *desired_cursor_row |
9216 |
? desired_cursor_row |
? desired_cursor_row |
9217 |
: current_cursor_row); |
: current_cursor_row); |
9218 |
|
|
9219 |
window_box (w, TEXT_AREA, &text_area_x, &text_area_y, |
text_area_width = window_box_width (w, TEXT_AREA); |
|
&text_area_width, &text_area_height); |
|
9220 |
|
|
9221 |
/* Scroll when cursor is inside this scroll margin. */ |
/* Scroll when cursor is inside this scroll margin. */ |
9222 |
h_margin = hscroll_margin * CANON_X_UNIT (XFRAME (w->frame)); |
h_margin = hscroll_margin * WINDOW_FRAME_COLUMN_WIDTH (w); |
9223 |
|
|
9224 |
if ((XFASTINT (w->hscroll) |
if ((XFASTINT (w->hscroll) |
9225 |
&& w->cursor.x <= h_margin) |
&& w->cursor.x <= h_margin) |
9256 |
/* Position cursor in window. */ |
/* Position cursor in window. */ |
9257 |
if (!hscroll_relative_p && hscroll_step_abs == 0) |
if (!hscroll_relative_p && hscroll_step_abs == 0) |
9258 |
hscroll = max (0, it.current_x - text_area_width / 2) |
hscroll = max (0, it.current_x - text_area_width / 2) |
9259 |
/ CANON_X_UNIT (it.f); |
/ FRAME_COLUMN_WIDTH (it.f); |
9260 |
else if (w->cursor.x >= text_area_width - h_margin) |
else if (w->cursor.x >= text_area_width - h_margin) |
9261 |
{ |
{ |
9262 |
if (hscroll_relative_p) |
if (hscroll_relative_p) |
9264 |
- h_margin; |
- h_margin; |
9265 |
else |
else |
9266 |
wanted_x = text_area_width |
wanted_x = text_area_width |
9267 |
- hscroll_step_abs * CANON_X_UNIT (it.f) |
- hscroll_step_abs * FRAME_COLUMN_WIDTH (it.f) |
9268 |
- h_margin; |
- h_margin; |
9269 |
hscroll |
hscroll |
9270 |
= max (0, it.current_x - wanted_x) / CANON_X_UNIT (it.f); |
= max (0, it.current_x - wanted_x) / FRAME_COLUMN_WIDTH (it.f); |
9271 |
} |
} |
9272 |
else |
else |
9273 |
{ |
{ |
9275 |
wanted_x = text_area_width * hscroll_step_rel |
wanted_x = text_area_width * hscroll_step_rel |
9276 |
+ h_margin; |
+ h_margin; |
9277 |
else |
else |
9278 |
wanted_x = hscroll_step_abs * CANON_X_UNIT (it.f) |
wanted_x = hscroll_step_abs * FRAME_COLUMN_WIDTH (it.f) |
9279 |
+ h_margin; |
+ h_margin; |
9280 |
hscroll |
hscroll |
9281 |
= max (0, it.current_x - wanted_x) / CANON_X_UNIT (it.f); |
= max (0, it.current_x - wanted_x) / FRAME_COLUMN_WIDTH (it.f); |
9282 |
} |
} |
9283 |
hscroll = max (hscroll, XFASTINT (w->min_hscroll)); |
hscroll = max (hscroll, XFASTINT (w->min_hscroll)); |
9284 |
|
|
9927 |
/* Make sure the cursor was last displayed |
/* Make sure the cursor was last displayed |
9928 |
in this window. Otherwise we have to reposition it. */ |
in this window. Otherwise we have to reposition it. */ |
9929 |
&& 0 <= w->cursor.vpos |
&& 0 <= w->cursor.vpos |
9930 |
&& XINT (w->height) > w->cursor.vpos) |
&& WINDOW_TOTAL_LINES (w) > w->cursor.vpos) |
9931 |
{ |
{ |
9932 |
if (!must_finish) |
if (!must_finish) |
9933 |
{ |
{ |
10063 |
/* Update the display. */ |
/* Update the display. */ |
10064 |
set_window_update_flags (XWINDOW (f->root_window), 1); |
set_window_update_flags (XWINDOW (f->root_window), 1); |
10065 |
pause |= update_frame (f, 0, 0); |
pause |= update_frame (f, 0, 0); |
10066 |
|
#if 0 /* Exiting the loop can leave the wrong value for buffer_shared. */ |
10067 |
if (pause) |
if (pause) |
10068 |
break; |
break; |
10069 |
|
#endif |
10070 |
|
|
10071 |
if (n == size) |
if (n == size) |
10072 |
{ |
{ |
10081 |
} |
} |
10082 |
} |
} |
10083 |
|
|
10084 |
/* Do the mark_window_display_accurate after all windows have |
if (!pause) |
10085 |
been redisplayed because this call resets flags in buffers |
{ |
10086 |
which are needed for proper redisplay. */ |
/* Do the mark_window_display_accurate after all windows have |
10087 |
for (i = 0; i < n; ++i) |
been redisplayed because this call resets flags in buffers |
10088 |
{ |
which are needed for proper redisplay. */ |
10089 |
struct frame *f = updated[i]; |
for (i = 0; i < n; ++i) |
10090 |
mark_window_display_accurate (f->root_window, 1); |
{ |
10091 |
if (frame_up_to_date_hook) |
struct frame *f = updated[i]; |
10092 |
frame_up_to_date_hook (f); |
mark_window_display_accurate (f->root_window, 1); |
10093 |
|
if (frame_up_to_date_hook) |
10094 |
|
frame_up_to_date_hook (f); |
10095 |
|
} |
10096 |
} |
} |
10097 |
} |
} |
10098 |
else if (FRAME_VISIBLE_P (sf) && !FRAME_OBSCURED_P (sf)) |
else if (FRAME_VISIBLE_P (sf) && !FRAME_OBSCURED_P (sf)) |
10334 |
w->window_end_valid = w->buffer; |
w->window_end_valid = w->buffer; |
10335 |
#if 0 /* This is incorrect with variable-height lines. */ |
#if 0 /* This is incorrect with variable-height lines. */ |
10336 |
xassert (XINT (w->window_end_vpos) |
xassert (XINT (w->window_end_vpos) |
10337 |
< (XINT (w->height) |
< (WINDOW_TOTAL_LINES (w) |
10338 |
- (WINDOW_WANTS_MODELINE_P (w) ? 1 : 0))); |
- (WINDOW_WANTS_MODELINE_P (w) ? 1 : 0))); |
10339 |
#endif |
#endif |
10340 |
w->update_mode_line = Qnil; |
w->update_mode_line = Qnil; |
10797 |
within this distance from the top or bottom of the window. */ |
within this distance from the top or bottom of the window. */ |
10798 |
if (scroll_margin > 0) |
if (scroll_margin > 0) |
10799 |
{ |
{ |
10800 |
this_scroll_margin = min (scroll_margin, XINT (w->height) / 4); |
this_scroll_margin = min (scroll_margin, WINDOW_TOTAL_LINES (w) / 4); |
10801 |
this_scroll_margin *= CANON_Y_UNIT (f); |
this_scroll_margin *= FRAME_LINE_HEIGHT (f); |
10802 |
} |
} |
10803 |
else |
else |
10804 |
this_scroll_margin = 0; |
this_scroll_margin = 0; |
10816 |
scroll_max = 10; |
scroll_max = 10; |
10817 |
else |
else |
10818 |
scroll_max = 0; |
scroll_max = 0; |
10819 |
scroll_max *= CANON_Y_UNIT (f); |
scroll_max *= FRAME_LINE_HEIGHT (f); |
10820 |
|
|
10821 |
/* Decide whether we have to scroll down. Start at the window end |
/* Decide whether we have to scroll down. Start at the window end |
10822 |
and move this_scroll_margin up to find the position of the scroll |
and move this_scroll_margin up to find the position of the scroll |
10867 |
/* Set AMOUNT_TO_SCROLL to at least one line, |
/* Set AMOUNT_TO_SCROLL to at least one line, |
10868 |
and at most scroll_conservatively lines. */ |
and at most scroll_conservatively lines. */ |
10869 |
amount_to_scroll |
amount_to_scroll |
10870 |
= min (max (dy, CANON_Y_UNIT (f)), |
= min (max (dy, FRAME_LINE_HEIGHT (f)), |
10871 |
CANON_Y_UNIT (f) * scroll_conservatively); |
FRAME_LINE_HEIGHT (f) * scroll_conservatively); |
10872 |
else if (scroll_step || temp_scroll_step) |
else if (scroll_step || temp_scroll_step) |
10873 |
amount_to_scroll = scroll_max; |
amount_to_scroll = scroll_max; |
10874 |
else |
else |
10875 |
{ |
{ |
10876 |
aggressive = current_buffer->scroll_up_aggressively; |
aggressive = current_buffer->scroll_up_aggressively; |
10877 |
height = (WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE (w) |
height = WINDOW_BOX_TEXT_HEIGHT (w); |
|
- WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w)); |
|
10878 |
if (NUMBERP (aggressive)) |
if (NUMBERP (aggressive)) |
10879 |
amount_to_scroll = XFLOATINT (aggressive) * height; |
amount_to_scroll = XFLOATINT (aggressive) * height; |
10880 |
} |
} |
10926 |
|
|
10927 |
if (scroll_conservatively) |
if (scroll_conservatively) |
10928 |
amount_to_scroll = |
amount_to_scroll = |
10929 |
max (dy, CANON_Y_UNIT (f) * max (scroll_step, temp_scroll_step)); |
max (dy, FRAME_LINE_HEIGHT (f) * max (scroll_step, temp_scroll_step)); |
10930 |
else if (scroll_step || temp_scroll_step) |
else if (scroll_step || temp_scroll_step) |
10931 |
amount_to_scroll = scroll_max; |
amount_to_scroll = scroll_max; |
10932 |
else |
else |
10933 |
{ |
{ |
10934 |
aggressive = current_buffer->scroll_down_aggressively; |
aggressive = current_buffer->scroll_down_aggressively; |
10935 |
height = (WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE (w) |
height = WINDOW_BOX_TEXT_HEIGHT (w); |
|
- WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w)); |
|
10936 |
if (NUMBERP (aggressive)) |
if (NUMBERP (aggressive)) |
10937 |
amount_to_scroll = XFLOATINT (aggressive) * height; |
amount_to_scroll = XFLOATINT (aggressive) * height; |
10938 |
} |
} |
11022 |
/* If the line start is "too far" away from the window start, |
/* If the line start is "too far" away from the window start, |
11023 |
say it takes too much time to compute a new window start. */ |
say it takes too much time to compute a new window start. */ |
11024 |
if (CHARPOS (start_pos) - IT_CHARPOS (it) |
if (CHARPOS (start_pos) - IT_CHARPOS (it) |
11025 |
< XFASTINT (w->height) * XFASTINT (w->width)) |
< WINDOW_TOTAL_LINES (w) * WINDOW_TOTAL_COLS (w)) |
11026 |
{ |
{ |
11027 |
int min_distance, distance; |
int min_distance, distance; |
11028 |
|
|
11140 |
/* Scroll if point within this distance from the top or bottom |
/* Scroll if point within this distance from the top or bottom |
11141 |
of the window. This is a pixel value. */ |
of the window. This is a pixel value. */ |
11142 |
this_scroll_margin = max (0, scroll_margin); |
this_scroll_margin = max (0, scroll_margin); |
11143 |
this_scroll_margin = min (this_scroll_margin, XFASTINT (w->height) / 4); |
this_scroll_margin = min (this_scroll_margin, WINDOW_TOTAL_LINES (w) / 4); |
11144 |
this_scroll_margin *= CANON_Y_UNIT (f); |
this_scroll_margin *= FRAME_LINE_HEIGHT (f); |
11145 |
|
|
11146 |
/* Start with the row the cursor was displayed during the last |
/* Start with the row the cursor was displayed during the last |
11147 |
not paused redisplay. Give up if that row is not valid. */ |
not paused redisplay. Give up if that row is not valid. */ |
12001 |
; |
; |
12002 |
finish_scroll_bars: |
finish_scroll_bars: |
12003 |
|
|
12004 |
if (FRAME_HAS_VERTICAL_SCROLL_BARS (f)) |
if (WINDOW_HAS_VERTICAL_SCROLL_BAR (w)) |
12005 |
{ |
{ |
12006 |
/* Set the thumb's position and size. */ |
/* Set the thumb's position and size. */ |
12007 |
set_vertical_scroll_bar (w); |
set_vertical_scroll_bar (w); |
12075 |
} |
} |
12076 |
else |
else |
12077 |
{ |
{ |
12078 |
w->window_end_bytepos = 0; |
w->window_end_bytepos = Z_BYTE - ZV_BYTE; |
12079 |
w->window_end_pos = w->window_end_vpos = make_number (0); |
w->window_end_pos = make_number (Z - ZV); |
12080 |
|
w->window_end_vpos = make_number (0); |
12081 |
} |
} |
12082 |
|
|
12083 |
/* But that is not valid info until redisplay finishes. */ |
/* But that is not valid info until redisplay finishes. */ |
12236 |
(start_row + i)->enabled_p = 0; |
(start_row + i)->enabled_p = 0; |
12237 |
|
|
12238 |
/* Re-compute Y positions. */ |
/* Re-compute Y positions. */ |
12239 |
min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w); |
min_y = WINDOW_HEADER_LINE_HEIGHT (w); |
12240 |
max_y = it.last_visible_y; |
max_y = it.last_visible_y; |
12241 |
for (row = start_row + nrows_scrolled; |
for (row = start_row + nrows_scrolled; |
12242 |
row < bottom_row; |
row < bottom_row; |
12290 |
else |
else |
12291 |
{ |
{ |
12292 |
/* This window must be completely empty. */ |
/* This window must be completely empty. */ |
12293 |
w->window_end_bytepos = 0; |
w->window_end_bytepos = Z_BYTE - ZV_BYTE; |
12294 |
w->window_end_pos = w->window_end_vpos = make_number (0); |
w->window_end_pos = make_number (Z - ZV); |
12295 |
|
w->window_end_vpos = make_number (0); |
12296 |
} |
} |
12297 |
w->window_end_valid = Qnil; |
w->window_end_valid = Qnil; |
12298 |
|
|
12351 |
it.vpos = (MATRIX_ROW_VPOS (first_row_to_display, w->current_matrix) |
it.vpos = (MATRIX_ROW_VPOS (first_row_to_display, w->current_matrix) |
12352 |
- nrows_scrolled); |
- nrows_scrolled); |
12353 |
it.current_y = (first_row_to_display->y - first_reusable_row->y |
it.current_y = (first_row_to_display->y - first_reusable_row->y |
12354 |
+ WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w)); |
+ WINDOW_HEADER_LINE_HEIGHT (w)); |
12355 |
|
|
12356 |
/* Display lines beginning with first_row_to_display in the |
/* Display lines beginning with first_row_to_display in the |
12357 |
desired matrix. Set last_text_row to the last row displayed |
desired matrix. Set last_text_row to the last row displayed |
12382 |
|
|
12383 |
/* Scroll the display. */ |
/* Scroll the display. */ |
12384 |
run.current_y = first_reusable_row->y; |
run.current_y = first_reusable_row->y; |
12385 |
run.desired_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w); |
run.desired_y = WINDOW_HEADER_LINE_HEIGHT (w); |
12386 |
run.height = it.last_visible_y - run.current_y; |
run.height = it.last_visible_y - run.current_y; |
12387 |
dy = run.current_y - run.desired_y; |
dy = run.current_y - run.desired_y; |
12388 |
|
|
12399 |
|
|
12400 |
/* Adjust Y positions of reused rows. */ |
/* Adjust Y positions of reused rows. */ |
12401 |
bottom_row = MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w); |
bottom_row = MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w); |
12402 |
min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w); |
min_y = WINDOW_HEADER_LINE_HEIGHT (w); |
12403 |
max_y = it.last_visible_y; |
max_y = it.last_visible_y; |
12404 |
for (row = first_reusable_row; row < first_row_to_display; ++row) |
for (row = first_reusable_row; row < first_row_to_display; ++row) |
12405 |
{ |
{ |
12651 |
marginal areas (see build_frame_matrix). */ |
marginal areas (see build_frame_matrix). */ |
12652 |
window_row = w->current_matrix->rows; |
window_row = w->current_matrix->rows; |
12653 |
window_row_end = window_row + w->current_matrix->nrows; |
window_row_end = window_row + w->current_matrix->nrows; |
12654 |
frame_row = f->current_matrix->rows + XFASTINT (w->top); |
frame_row = f->current_matrix->rows + WINDOW_TOP_EDGE_LINE (w); |
12655 |
while (window_row < window_row_end) |
while (window_row < window_row_end) |
12656 |
{ |
{ |
12657 |
struct glyph *start = window_row->glyphs[LEFT_MARGIN_AREA]; |
struct glyph *start = window_row->glyphs[LEFT_MARGIN_AREA]; |
12907 |
the window end again, since its offset from Z hasn't changed. */ |
the window end again, since its offset from Z hasn't changed. */ |
12908 |
r0 = MATRIX_FIRST_TEXT_ROW (current_matrix); |
r0 = MATRIX_FIRST_TEXT_ROW (current_matrix); |
12909 |
if (CHARPOS (start) == MATRIX_ROW_START_CHARPOS (r0) + delta |
if (CHARPOS (start) == MATRIX_ROW_START_CHARPOS (r0) + delta |
12910 |
&& BYTEPOS (start) == MATRIX_ROW_START_BYTEPOS (r0) + delta_bytes) |
&& BYTEPOS (start) == MATRIX_ROW_START_BYTEPOS (r0) + delta_bytes |
12911 |
|
/* PT must not be in a partially visible line. */ |
12912 |
|
&& !(PT >= MATRIX_ROW_START_CHARPOS (row) + delta |
12913 |
|
&& MATRIX_ROW_BOTTOM_Y (row) > window_text_bottom_y (w))) |
12914 |
{ |
{ |
12915 |
/* Adjust positions in the glyph matrix. */ |
/* Adjust positions in the glyph matrix. */ |
12916 |
if (delta || delta_bytes) |
if (delta || delta_bytes) |
12955 |
as is, without changing glyph positions since no text has |
as is, without changing glyph positions since no text has |
12956 |
been added/removed in front of the window end. */ |
been added/removed in front of the window end. */ |
12957 |
r0 = MATRIX_FIRST_TEXT_ROW (current_matrix); |
r0 = MATRIX_FIRST_TEXT_ROW (current_matrix); |
12958 |
if (TEXT_POS_EQUAL_P (start, r0->start.pos)) |
if (TEXT_POS_EQUAL_P (start, r0->start.pos) |
12959 |
|
/* PT must not be in a partially visible line. */ |
12960 |
|
&& !(PT >= MATRIX_ROW_START_CHARPOS (row) |
12961 |
|
&& MATRIX_ROW_BOTTOM_Y (row) > window_text_bottom_y (w))) |
12962 |
{ |
{ |
12963 |
/* We have to compute the window end anew since text |
/* We have to compute the window end anew since text |
12964 |
can have been added/removed after it. */ |
can have been added/removed after it. */ |
13198 |
int this_scroll_margin, cursor_height; |
int this_scroll_margin, cursor_height; |
13199 |
|
|
13200 |
this_scroll_margin = max (0, scroll_margin); |
this_scroll_margin = max (0, scroll_margin); |
13201 |
this_scroll_margin = min (this_scroll_margin, |
this_scroll_margin = min (this_scroll_margin, WINDOW_TOTAL_LINES (w) / 4); |
13202 |
XFASTINT (w->height) / 4); |
this_scroll_margin *= FRAME_LINE_HEIGHT (it.f); |
|
this_scroll_margin *= CANON_Y_UNIT (it.f); |
|
13203 |
cursor_height = MATRIX_ROW (w->desired_matrix, w->cursor.vpos)->height; |
cursor_height = MATRIX_ROW (w->desired_matrix, w->cursor.vpos)->height; |
13204 |
|
|
13205 |
if ((w->cursor.y < this_scroll_margin |
if ((w->cursor.y < this_scroll_margin |
13234 |
lines to scroll by; dvpos < 0 means scroll up. */ |
lines to scroll by; dvpos < 0 means scroll up. */ |
13235 |
int first_unchanged_at_end_vpos |
int first_unchanged_at_end_vpos |
13236 |
= MATRIX_ROW_VPOS (first_unchanged_at_end_row, w->current_matrix); |
= MATRIX_ROW_VPOS (first_unchanged_at_end_row, w->current_matrix); |
13237 |
int from = XFASTINT (w->top) + first_unchanged_at_end_vpos; |
int from = WINDOW_TOP_EDGE_LINE (w) + first_unchanged_at_end_vpos; |
13238 |
int end = (XFASTINT (w->top) |
int end = (WINDOW_TOP_EDGE_LINE (w) |
13239 |
+ (WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0) |
+ (WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0) |
13240 |
+ window_internal_height (w)); |
+ window_internal_height (w)); |
13241 |
|
|
13925 |
if (row->height == 0) |
if (row->height == 0) |
13926 |
{ |
{ |
13927 |
if (it->max_ascent + it->max_descent == 0) |
if (it->max_ascent + it->max_descent == 0) |
13928 |
it->max_descent = it->max_phys_descent = CANON_Y_UNIT (it->f); |
it->max_descent = it->max_phys_descent = FRAME_LINE_HEIGHT (it->f); |
13929 |
row->ascent = it->max_ascent; |
row->ascent = it->max_ascent; |
13930 |
row->height = it->max_ascent + it->max_descent; |
row->height = it->max_ascent + it->max_descent; |
13931 |
row->phys_ascent = it->max_phys_ascent; |
row->phys_ascent = it->max_phys_ascent; |
13956 |
/* Compute how much of the line is visible. */ |
/* Compute how much of the line is visible. */ |
13957 |
row->visible_height = row->height; |
row->visible_height = row->height; |
13958 |
|
|
13959 |
min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (it->w); |
min_y = WINDOW_HEADER_LINE_HEIGHT (it->w); |
13960 |
max_y = WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE (it->w); |
max_y = WINDOW_BOX_HEIGHT_NO_MODE_LINE (it->w); |
13961 |
|
|
13962 |
if (row->y < min_y) |
if (row->y < min_y) |
13963 |
row->visible_height -= min_y - row->y; |
row->visible_height -= min_y - row->y; |
14713 |
xassert (!FRAME_WINDOW_P (f)); |
xassert (!FRAME_WINDOW_P (f)); |
14714 |
init_iterator (&it, w, -1, -1, f->desired_matrix->rows, MENU_FACE_ID); |
init_iterator (&it, w, -1, -1, f->desired_matrix->rows, MENU_FACE_ID); |
14715 |
it.first_visible_x = 0; |
it.first_visible_x = 0; |
14716 |
it.last_visible_x = FRAME_WINDOW_WIDTH (f) * CANON_X_UNIT (f); |
it.last_visible_x = FRAME_TOTAL_COLS (f) * FRAME_COLUMN_WIDTH (f); |
14717 |
#else /* not USE_X_TOOLKIT */ |
#else /* not USE_X_TOOLKIT */ |
14718 |
if (FRAME_WINDOW_P (f)) |
if (FRAME_WINDOW_P (f)) |
14719 |
{ |
{ |
14725 |
init_iterator (&it, menu_w, -1, -1, menu_w->desired_matrix->rows, |
init_iterator (&it, menu_w, -1, -1, menu_w->desired_matrix->rows, |
14726 |
MENU_FACE_ID); |
MENU_FACE_ID); |
14727 |
it.first_visible_x = 0; |
it.first_visible_x = 0; |
14728 |
it.last_visible_x = FRAME_WINDOW_WIDTH (f) * CANON_X_UNIT (f); |
it.last_visible_x = FRAME_TOTAL_COLS (f) * FRAME_COLUMN_WIDTH (f); |
14729 |
} |
} |
14730 |
else |
else |
14731 |
{ |
{ |
14734 |
init_iterator (&it, w, -1, -1, f->desired_matrix->rows, |
init_iterator (&it, w, -1, -1, f->desired_matrix->rows, |
14735 |
MENU_FACE_ID); |
MENU_FACE_ID); |
14736 |
it.first_visible_x = 0; |
it.first_visible_x = 0; |
14737 |
it.last_visible_x = FRAME_WIDTH (f); |
it.last_visible_x = FRAME_COLS (f); |
14738 |
} |
} |
14739 |
#endif /* not USE_X_TOOLKIT */ |
#endif /* not USE_X_TOOLKIT */ |
14740 |
|
|
14991 |
int literal = 0; |
int literal = 0; |
14992 |
|
|
14993 |
tail_recurse: |
tail_recurse: |
14994 |
if (depth > 10) |
if (depth > 100) |
14995 |
goto invalid; |
elt = build_string ("*too-deep*"); |
14996 |
|
|
14997 |
depth++; |
depth++; |
14998 |
|
|
15347 |
|
|
15348 |
default: |
default: |
15349 |
invalid: |
invalid: |
15350 |
if (frame_title_ptr) |
elt = build_string ("*invalid*"); |
15351 |
n += store_frame_title ("*invalid*", 0, precision - n); |
goto tail_recurse; |
|
else if (!NILP (mode_line_string_list)) |
|
|
n += store_mode_line_string ("*invalid*", Qnil, 0, 0, precision - n, Qnil); |
|
|
else |
|
|
n += display_string ("*invalid*", Qnil, Qnil, 0, 0, it, 0, |
|
|
precision - n, 0, 0); |
|
|
return n; |
|
15352 |
} |
} |
15353 |
|
|
15354 |
/* Pad to FIELD_WIDTH. */ |
/* Pad to FIELD_WIDTH. */ |
15598 |
} |
} |
15599 |
} |
} |
15600 |
|
|
15601 |
|
/* Write a null-terminated, right justified decimal and "human |
15602 |
|
readable" representation of the nonnegative integer D to BUF using |
15603 |
|
a minimal field width WIDTH. D should be smaller than 999.5e24. */ |
15604 |
|
|
15605 |
|
static const char power_letter[] = |
15606 |
|
{ |
15607 |
|
0, /* not used */ |
15608 |
|
'k', /* kilo */ |
15609 |
|
'M', /* mega */ |
15610 |
|
'G', /* giga */ |
15611 |
|
'T', /* tera */ |
15612 |
|
'P', /* peta */ |
15613 |
|
'E', /* exa */ |
15614 |
|
'Z', /* zetta */ |
15615 |
|
'Y' /* yotta */ |
15616 |
|
}; |
15617 |
|
|
15618 |
|
static void |
15619 |
|
pint2hrstr (buf, width, d) |
15620 |
|
char *buf; |
15621 |
|
int width; |
15622 |
|
int d; |
15623 |
|
{ |
15624 |
|
/* We aim to represent the nonnegative integer D as |
15625 |
|
QUOTIENT.TENTHS * 10 ^ (3 * EXPONENT). */ |
15626 |
|
int quotient = d; |
15627 |
|
int remainder = 0; |
15628 |
|
/* -1 means: do not use TENTHS. */ |
15629 |
|
int tenths = -1; |
15630 |
|
int exponent = 0; |
15631 |
|
|
15632 |
|
/* Length of QUOTIENT.TENTHS as a string. */ |
15633 |
|
int length; |
15634 |
|
|
15635 |
|
char * psuffix; |
15636 |
|
char * p; |
15637 |
|
|
15638 |
|
if (1000 <= quotient) |
15639 |
|
{ |
15640 |
|
/* Scale to the appropriate EXPONENT. */ |
15641 |
|
do |
15642 |
|
{ |
15643 |
|
remainder = quotient % 1000; |
15644 |
|
quotient /= 1000; |
15645 |
|
exponent++; |
15646 |
|
} |
15647 |
|
while (1000 <= quotient); |
15648 |
|
|
15649 |
|
/* Round to nearest and decide whether to use TENTHS or not. */ |
15650 |
|
if (quotient <= 9) |
15651 |
|
{ |
15652 |
|
tenths = remainder / 100; |
15653 |
|
if (50 <= remainder % 100) |
15654 |
|
if (tenths < 9) |
15655 |
|
tenths++; |
15656 |
|
else |
15657 |
|
{ |
15658 |
|
quotient++; |
15659 |
|
if (quotient == 10) |
15660 |
|
tenths = -1; |
15661 |
|
else |
15662 |
|
tenths = 0; |
15663 |
|
} |
15664 |
|
} |
15665 |
|
else |
15666 |
|
if (500 <= remainder) |
15667 |
|
if (quotient < 999) |
15668 |
|
quotient++; |
15669 |
|
else |
15670 |
|
{ |
15671 |
|
quotient = 1; |
15672 |
|
exponent++; |
15673 |
|
tenths = 0; |
15674 |
|
} |
15675 |
|
} |
15676 |
|
|
15677 |
|
/* Calculate the LENGTH of QUOTIENT.TENTHS as a string. */ |
15678 |
|
if (tenths == -1 && quotient <= 99) |
15679 |
|
if (quotient <= 9) |
15680 |
|
length = 1; |
15681 |
|
else |
15682 |
|
length = 2; |
15683 |
|
else |
15684 |
|
length = 3; |
15685 |
|
p = psuffix = buf + max (width, length); |
15686 |
|
|
15687 |
|
/* Print EXPONENT. */ |
15688 |
|
if (exponent) |
15689 |
|
*psuffix++ = power_letter[exponent]; |
15690 |
|
*psuffix = '\0'; |
15691 |
|
|
15692 |
|
/* Print TENTHS. */ |
15693 |
|
if (tenths >= 0) |
15694 |
|
{ |
15695 |
|
*--p = '0' + tenths; |
15696 |
|
*--p = '.'; |
15697 |
|
} |
15698 |
|
|
15699 |
|
/* Print QUOTIENT. */ |
15700 |
|
do |
15701 |
|
{ |
15702 |
|
int digit = quotient % 10; |
15703 |
|
*--p = '0' + digit; |
15704 |
|
} |
15705 |
|
while ((quotient /= 10) != 0); |
15706 |
|
|
15707 |
|
/* Print leading spaces. */ |
15708 |
|
while (buf < p) |
15709 |
|
*--p = ' '; |
15710 |
|
} |
15711 |
|
|
15712 |
/* Set a mnemonic character for coding_system (Lisp symbol) in BUF. |
/* Set a mnemonic character for coding_system (Lisp symbol) in BUF. |
15713 |
If EOL_FLAG is 1, set also a mnemonic character for end-of-line |
If EOL_FLAG is 1, set also a mnemonic character for end-of-line |
15714 |
type of CODING_SYSTEM. Return updated pointer into BUF. */ |
type of CODING_SYSTEM. Return updated pointer into BUF. */ |
15911 |
obj = b->filename; |
obj = b->filename; |
15912 |
break; |
break; |
15913 |
|
|
15914 |
|
case 'i': |
15915 |
|
{ |
15916 |
|
int size = ZV - BEGV; |
15917 |
|
pint2str (decode_mode_spec_buf, field_width, size); |
15918 |
|
return decode_mode_spec_buf; |
15919 |
|
} |
15920 |
|
|
15921 |
|
case 'I': |
15922 |
|
{ |
15923 |
|
int size = ZV - BEGV; |
15924 |
|
pint2hrstr (decode_mode_spec_buf, field_width, size); |
15925 |
|
return decode_mode_spec_buf; |
15926 |
|
} |
15927 |
|
|
15928 |
case 'l': |
case 'l': |
15929 |
{ |
{ |
15930 |
int startpos = XMARKER (w->start)->charpos; |
int startpos = XMARKER (w->start)->charpos; |
15931 |
int startpos_byte = marker_byte_position (w->start); |
int startpos_byte = marker_byte_position (w->start); |
15932 |
int line, linepos, linepos_byte, topline; |
int line, linepos, linepos_byte, topline; |
15933 |
int nlines, junk; |
int nlines, junk; |
15934 |
int height = XFASTINT (w->height); |
int height = WINDOW_TOTAL_LINES (w); |
15935 |
|
|
15936 |
/* If we decided that this buffer isn't suitable for line numbers, |
/* If we decided that this buffer isn't suitable for line numbers, |
15937 |
don't forget that too fast. */ |
don't forget that too fast. */ |
17457 |
{ |
{ |
17458 |
/* X is relative to the left edge of W, without scroll bars |
/* X is relative to the left edge of W, without scroll bars |
17459 |
or fringes. */ |
or fringes. */ |
17460 |
int window_left_x = WINDOW_LEFT_MARGIN (w) * CANON_X_UNIT (f); |
x += WINDOW_LEFT_EDGE_X (w); |
17461 |
|
last_x = WINDOW_LEFT_EDGE_X (w) + WINDOW_TOTAL_WIDTH (w); |
|
x += window_left_x; |
|
|
area_width = XFASTINT (w->width) * CANON_X_UNIT (f); |
|
|
last_x = window_left_x + area_width; |
|
|
|
|
|
if (FRAME_HAS_VERTICAL_SCROLL_BARS (f)) |
|
|
{ |
|
|
int width = FRAME_SCROLL_BAR_WIDTH (f) * CANON_X_UNIT (f); |
|
|
if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f)) |
|
|
last_x += width; |
|
|
else |
|
|
x -= width; |
|
|
} |
|
|
|
|
|
x += FRAME_INTERNAL_BORDER_WIDTH (f); |
|
|
/* ++KFS: W32 and MAC versions had -= in next line (bug??) */ |
|
|
last_x += FRAME_INTERNAL_BORDER_WIDTH (f); |
|
17462 |
} |
} |
17463 |
else |
else |
17464 |
{ |
{ |
17465 |
x = WINDOW_AREA_TO_FRAME_PIXEL_X (w, area, x); |
int area_left = window_box_left (w, area); |
17466 |
|
x += area_left; |
17467 |
area_width = window_box_width (w, area); |
area_width = window_box_width (w, area); |
17468 |
last_x = WINDOW_AREA_TO_FRAME_PIXEL_X (w, area, area_width); |
last_x = area_left + area_width; |
17469 |
} |
} |
17470 |
|
|
17471 |
/* Build a doubly-linked list of glyph_string structures between |
/* Build a doubly-linked list of glyph_string structures between |
17570 |
int x0 = head ? head->x : x; |
int x0 = head ? head->x : x; |
17571 |
int x1 = tail ? tail->x + tail->background_width : x; |
int x1 = tail ? tail->x + tail->background_width : x; |
17572 |
|
|
17573 |
x0 = FRAME_TO_WINDOW_PIXEL_X (w, x0); |
int text_left = window_box_left (w, TEXT_AREA); |
17574 |
x1 = FRAME_TO_WINDOW_PIXEL_X (w, x1); |
x0 -= text_left; |
17575 |
|
x1 -= text_left; |
|
/* ++KFS: W32 and MAC versions had following test here: |
|
|
if (!row->full_width_p && XFASTINT (w->left_margin_width) != 0) |
|
|
*/ |
|
|
|
|
|
if (XFASTINT (w->left_margin_width) != 0) |
|
|
{ |
|
|
int left_area_width = window_box_width (w, LEFT_MARGIN_AREA); |
|
|
x0 -= left_area_width; |
|
|
x1 -= left_area_width; |
|
|
} |
|
17576 |
|
|
17577 |
notice_overwritten_cursor (w, area, x0, x1, |
notice_overwritten_cursor (w, TEXT_AREA, x0, x1, |
17578 |
row->y, MATRIX_ROW_BOTTOM_Y (row)); |
row->y, MATRIX_ROW_BOTTOM_Y (row)); |
17579 |
} |
} |
17580 |
|
|
17581 |
/* Value is the x-position up to which drawn, relative to AREA of W. |
/* Value is the x-position up to which drawn, relative to AREA of W. |
17582 |
This doesn't include parts drawn because of overhangs. */ |
This doesn't include parts drawn because of overhangs. */ |
17583 |
x_reached = FRAME_TO_WINDOW_PIXEL_X (w, x_reached); |
if (row->full_width_p) |
17584 |
if (!row->full_width_p) |
x_reached = FRAME_TO_WINDOW_PIXEL_X (w, x_reached); |
17585 |
{ |
else |
17586 |
/* ++KFS: W32 and MAC versions only had this test here: |
x_reached -= window_box_left (w, area); |
|
if (area > LEFT_MARGIN_AREA) |
|
|
*/ |
|
|
|
|
|
if (area > LEFT_MARGIN_AREA && XFASTINT (w->left_margin_width) != 0) |
|
|
x_reached -= window_box_width (w, LEFT_MARGIN_AREA); |
|
|
if (area > TEXT_AREA) |
|
|
x_reached -= window_box_width (w, TEXT_AREA); |
|
|
} |
|
17587 |
|
|
17588 |
RELEASE_HDC (hdc, f); |
RELEASE_HDC (hdc, f); |
17589 |
|
|
17851 |
if (prop = Fplist_get (plist, QCwidth), |
if (prop = Fplist_get (plist, QCwidth), |
17852 |
NUMVAL (prop) > 0) |
NUMVAL (prop) > 0) |
17853 |
/* Absolute width `:width WIDTH' specified and valid. */ |
/* Absolute width `:width WIDTH' specified and valid. */ |
17854 |
width = NUMVAL (prop) * CANON_X_UNIT (it->f); |
width = NUMVAL (prop) * FRAME_COLUMN_WIDTH (it->f); |
17855 |
else if (prop = Fplist_get (plist, QCrelative_width), |
else if (prop = Fplist_get (plist, QCrelative_width), |
17856 |
NUMVAL (prop) > 0) |
NUMVAL (prop) > 0) |
17857 |
{ |
{ |
17878 |
} |
} |
17879 |
else if (prop = Fplist_get (plist, QCalign_to), |
else if (prop = Fplist_get (plist, QCalign_to), |
17880 |
NUMVAL (prop) > 0) |
NUMVAL (prop) > 0) |
17881 |
width = NUMVAL (prop) * CANON_X_UNIT (it->f) - it->current_x; |
width = NUMVAL (prop) * FRAME_COLUMN_WIDTH (it->f) - it->current_x; |
17882 |
else |
else |
17883 |
/* Nothing specified -> width defaults to canonical char width. */ |
/* Nothing specified -> width defaults to canonical char width. */ |
17884 |
width = CANON_X_UNIT (it->f); |
width = FRAME_COLUMN_WIDTH (it->f); |
17885 |
|
|
17886 |
/* Compute height. */ |
/* Compute height. */ |
17887 |
if (prop = Fplist_get (plist, QCheight), |
if (prop = Fplist_get (plist, QCheight), |
17888 |
NUMVAL (prop) > 0) |
NUMVAL (prop) > 0) |
17889 |
height = NUMVAL (prop) * CANON_Y_UNIT (it->f); |
height = NUMVAL (prop) * FRAME_LINE_HEIGHT (it->f); |
17890 |
else if (prop = Fplist_get (plist, QCrelative_height), |
else if (prop = Fplist_get (plist, QCrelative_height), |
17891 |
NUMVAL (prop) > 0) |
NUMVAL (prop) > 0) |
17892 |
height = FONT_HEIGHT (font) * NUMVAL (prop); |
height = FONT_HEIGHT (font) * NUMVAL (prop); |
18113 |
} |
} |
18114 |
else if (it->char_to_display == '\t') |
else if (it->char_to_display == '\t') |
18115 |
{ |
{ |
18116 |
int tab_width = it->tab_width * CANON_X_UNIT (it->f); |
int tab_width = it->tab_width * FRAME_COLUMN_WIDTH (it->f); |
18117 |
int x = it->current_x + it->continuation_lines_width; |
int x = it->current_x + it->continuation_lines_width; |
18118 |
int next_tab_x = ((1 + x + tab_width - 1) / tab_width) * tab_width; |
int next_tab_x = ((1 + x + tab_width - 1) / tab_width) * tab_width; |
18119 |
|
|
18120 |
/* If the distance from the current position to the next tab |
/* If the distance from the current position to the next tab |
18121 |
stop is less than a canonical character width, use the |
stop is less than a canonical character width, use the |
18122 |
tab stop after that. */ |
tab stop after that. */ |
18123 |
if (next_tab_x - x < CANON_X_UNIT (it->f)) |
if (next_tab_x - x < FRAME_COLUMN_WIDTH (it->f)) |
18124 |
next_tab_x += tab_width; |
next_tab_x += tab_width; |
18125 |
|
|
18126 |
it->pixel_width = next_tab_x - x; |
it->pixel_width = next_tab_x - x; |
18155 |
int charset = CHAR_CHARSET (it->char_to_display); |
int charset = CHAR_CHARSET (it->char_to_display); |
18156 |
|
|
18157 |
it->glyph_not_available_p = 1; |
it->glyph_not_available_p = 1; |
18158 |
it->pixel_width = (FONT_WIDTH (FRAME_FONT (it->f)) |
it->pixel_width = (FRAME_COLUMN_WIDTH (it->f) |
18159 |
* CHARSET_WIDTH (charset)); |
* CHARSET_WIDTH (charset)); |
18160 |
it->phys_ascent = FONT_BASE (font) + boff; |
it->phys_ascent = FONT_BASE (font) + boff; |
18161 |
it->phys_descent = FONT_DESCENT (font) - boff; |
it->phys_descent = FONT_DESCENT (font) - boff; |
18611 |
f = XFRAME (w->frame); |
f = XFRAME (w->frame); |
18612 |
|
|
18613 |
if (updated_row->full_width_p) |
if (updated_row->full_width_p) |
18614 |
{ |
max_x = WINDOW_TOTAL_WIDTH (w); |
|
max_x = XFASTINT (w->width) * CANON_X_UNIT (f); |
|
|
if (FRAME_HAS_VERTICAL_SCROLL_BARS (f) |
|
|
&& !w->pseudo_window_p) |
|
|
max_x += FRAME_SCROLL_BAR_WIDTH (f) * CANON_X_UNIT (f); |
|
|
} |
|
18615 |
else |
else |
18616 |
max_x = window_box_width (w, updated_area); |
max_x = window_box_width (w, updated_area); |
18617 |
max_y = window_text_bottom_y (w); |
max_y = window_text_bottom_y (w); |
18644 |
} |
} |
18645 |
else |
else |
18646 |
{ |
{ |
18647 |
from_x = WINDOW_AREA_TO_FRAME_PIXEL_X (w, updated_area, from_x); |
int area_left = window_box_left (w, updated_area); |
18648 |
to_x = WINDOW_AREA_TO_FRAME_PIXEL_X (w, updated_area, to_x); |
from_x += area_left; |
18649 |
|
to_x += area_left; |
18650 |
} |
} |
18651 |
|
|
18652 |
min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w); |
min_y = WINDOW_HEADER_LINE_HEIGHT (w); |
18653 |
from_y = WINDOW_TO_FRAME_PIXEL_Y (w, max (min_y, output_cursor.y)); |
from_y = WINDOW_TO_FRAME_PIXEL_Y (w, max (min_y, output_cursor.y)); |
18654 |
to_y = WINDOW_TO_FRAME_PIXEL_Y (w, to_y); |
to_y = WINDOW_TO_FRAME_PIXEL_Y (w, to_y); |
18655 |
|
|
18847 |
return FRAME_BLINK_OFF_CURSOR (f); |
return FRAME_BLINK_OFF_CURSOR (f); |
18848 |
} |
} |
18849 |
|
|
18850 |
|
#if 0 |
18851 |
|
/* Some people liked having a permanently visible blinking cursor, |
18852 |
|
while others had very strong opinions against it. So it was |
18853 |
|
decided to remove it. KFS 2003-09-03 */ |
18854 |
|
|
18855 |
/* Finally perform built-in cursor blinking: |
/* Finally perform built-in cursor blinking: |
18856 |
filled box <-> hollow box |
filled box <-> hollow box |
18857 |
wide [h]bar <-> narrow [h]bar |
wide [h]bar <-> narrow [h]bar |
18866 |
*width = 1; |
*width = 1; |
18867 |
return cursor_type; |
return cursor_type; |
18868 |
} |
} |
18869 |
|
#endif |
18870 |
|
|
18871 |
return NO_CURSOR; |
return NO_CURSOR; |
18872 |
} |
} |
18941 |
|
|
18942 |
BLOCK_INPUT; |
BLOCK_INPUT; |
18943 |
|
|
18944 |
if (area == LEFT_MARGIN_AREA) |
x = 0; |
|
x = 0; |
|
|
else if (area == TEXT_AREA) |
|
|
x = row->x + window_box_width (w, LEFT_MARGIN_AREA); |
|
|
else |
|
|
x = (window_box_width (w, LEFT_MARGIN_AREA) |
|
|
+ window_box_width (w, TEXT_AREA)); |
|
|
|
|
18945 |
for (i = 0; i < row->used[area];) |
for (i = 0; i < row->used[area];) |
18946 |
{ |
{ |
18947 |
if (row->glyphs[area][i].overlaps_vertically_p) |
if (row->glyphs[area][i].overlaps_vertically_p) |
19079 |
if (w->phys_cursor_type == HOLLOW_BOX_CURSOR) |
if (w->phys_cursor_type == HOLLOW_BOX_CURSOR) |
19080 |
{ |
{ |
19081 |
int x, y; |
int x, y; |
19082 |
int header_line_height = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w); |
int header_line_height = WINDOW_HEADER_LINE_HEIGHT (w); |
19083 |
|
|
19084 |
cursor_glyph = get_phys_cursor_glyph (w); |
cursor_glyph = get_phys_cursor_glyph (w); |
19085 |
if (cursor_glyph == NULL) |
if (cursor_glyph == NULL) |
19402 |
of last line in W. In the row containing CHARPOS, stop before glyphs |
of last line in W. In the row containing CHARPOS, stop before glyphs |
19403 |
having STOP as object. */ |
having STOP as object. */ |
19404 |
|
|
19405 |
#if 0 /* This is a version of fast_find_position that's more correct |
#if 1 /* This is a version of fast_find_position that's more correct |
19406 |
in the presence of hscrolling, for example. I didn't install |
in the presence of hscrolling, for example. I didn't install |
19407 |
it right away because the problem fixed is minor, it failed |
it right away because the problem fixed is minor, it failed |
19408 |
in 20.x as well, and I think it's too risky to install |
in 20.x as well, and I think it's too risky to install |
19417 |
{ |
{ |
19418 |
struct glyph_row *row, *first; |
struct glyph_row *row, *first; |
19419 |
struct glyph *glyph, *end; |
struct glyph *glyph, *end; |
19420 |
int i, past_end = 0; |
int past_end = 0; |
19421 |
|
|
19422 |
first = MATRIX_FIRST_TEXT_ROW (w->current_matrix); |
first = MATRIX_FIRST_TEXT_ROW (w->current_matrix); |
19423 |
row = row_containing_pos (w, charpos, first, NULL, 0); |
row = row_containing_pos (w, charpos, first, NULL, 0); |
19469 |
return past_end; |
return past_end; |
19470 |
} |
} |
19471 |
|
|
19472 |
#else /* not 0 */ |
#else /* not 1 */ |
19473 |
|
|
19474 |
static int |
static int |
19475 |
fast_find_position (w, pos, hpos, vpos, x, y, stop) |
fast_find_position (w, pos, hpos, vpos, x, y, stop) |
19567 |
return 0; |
return 0; |
19568 |
} |
} |
19569 |
|
|
19570 |
#endif /* not 0 */ |
#endif /* not 1 */ |
19571 |
|
|
19572 |
|
|
19573 |
/* Find the position of the glyph for position POS in OBJECT in |
/* Find the position of the glyph for position POS in OBJECT in |
19745 |
} |
} |
19746 |
|
|
19747 |
/* Which window is that in? */ |
/* Which window is that in? */ |
19748 |
window = window_from_coordinates (f, x, y, &part, 1); |
window = window_from_coordinates (f, x, y, &part, 0, 0, 1); |
19749 |
|
|
19750 |
/* If we were displaying active text in another window, clear that. */ |
/* If we were displaying active text in another window, clear that. */ |
19751 |
if (! EQ (window, dpyinfo->mouse_face_window)) |
if (! EQ (window, dpyinfo->mouse_face_window)) |
20229 |
/* Set START_X to the window-relative start position for drawing glyphs of |
/* Set START_X to the window-relative start position for drawing glyphs of |
20230 |
AREA. The first glyph of the text area can be partially visible. |
AREA. The first glyph of the text area can be partially visible. |
20231 |
The first glyphs of other areas cannot. */ |
The first glyphs of other areas cannot. */ |
20232 |
if (area == LEFT_MARGIN_AREA) |
start_x = window_box_left_offset (w, area); |
20233 |
start_x = 0; |
if (area == TEXT_AREA) |
20234 |
else if (area == TEXT_AREA) |
start_x += row->x; |
|
start_x = row->x + window_box_width (w, LEFT_MARGIN_AREA); |
|
|
else |
|
|
start_x = (window_box_width (w, LEFT_MARGIN_AREA) |
|
|
+ window_box_width (w, TEXT_AREA)); |
|
20235 |
x = start_x; |
x = start_x; |
20236 |
|
|
20237 |
/* Find the first glyph that must be redrawn. */ |
/* Find the first glyph that must be redrawn. */ |
20338 |
cursor_glyph = get_phys_cursor_glyph (w); |
cursor_glyph = get_phys_cursor_glyph (w); |
20339 |
if (cursor_glyph) |
if (cursor_glyph) |
20340 |
{ |
{ |
20341 |
cr.x = w->phys_cursor.x; |
/* r is relative to W's box, but w->phys_cursor.x is relative |
20342 |
|
to left edge of W's TEXT area. Adjust it. */ |
20343 |
|
cr.x = window_box_left_offset (w, TEXT_AREA) + w->phys_cursor.x; |
20344 |
cr.y = w->phys_cursor.y; |
cr.y = w->phys_cursor.y; |
20345 |
cr.width = cursor_glyph->pixel_width; |
cr.width = cursor_glyph->pixel_width; |
20346 |
cr.height = w->phys_cursor_height; |
cr.height = w->phys_cursor_height; |
20361 |
x_draw_vertical_border (w) |
x_draw_vertical_border (w) |
20362 |
struct window *w; |
struct window *w; |
20363 |
{ |
{ |
20364 |
struct frame *f = XFRAME (WINDOW_FRAME (w)); |
/* We could do better, if we knew what type of scroll-bar the adjacent |
20365 |
|
windows (on either side) have... But we don't :-( |
20366 |
|
However, I think this works ok. ++KFS 2003-04-25 */ |
20367 |
|
|
20368 |
/* Redraw borders between horizontally adjacent windows. Don't |
/* Redraw borders between horizontally adjacent windows. Don't |
20369 |
do it for frames with vertical scroll bars because either the |
do it for frames with vertical scroll bars because either the |
20370 |
right scroll bar of a window, or the left scroll bar of its |
right scroll bar of a window, or the left scroll bar of its |
20371 |
neighbor will suffice as a border. */ |
neighbor will suffice as a border. */ |
20372 |
if (!WINDOW_RIGHTMOST_P (w) |
if (!WINDOW_RIGHTMOST_P (w) |
20373 |
&& !FRAME_HAS_VERTICAL_SCROLL_BARS (f)) |
&& !WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w)) |
20374 |
{ |
{ |
20375 |
int x0, x1, y0, y1; |
int x0, x1, y0, y1; |
20376 |
|
|
20377 |
window_box_edges (w, -1, &x0, &y0, &x1, &y1); |
window_box_edges (w, -1, &x0, &y0, &x1, &y1); |
|
x1 += FRAME_X_RIGHT_FRINGE_WIDTH (f); |
|
20378 |
y1 -= 1; |
y1 -= 1; |
20379 |
|
|
20380 |
rif->draw_vertical_window_border (w, x1, y0, y1); |
rif->draw_vertical_window_border (w, x1, y0, y1); |
20381 |
} |
} |
20382 |
|
else if (!WINDOW_LEFTMOST_P (w) |
20383 |
|
&& !WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w)) |
20384 |
|
{ |
20385 |
|
int x0, x1, y0, y1; |
20386 |
|
|
20387 |
|
window_box_edges (w, -1, &x0, &y0, &x1, &y1); |
20388 |
|
y1 -= 1; |
20389 |
|
|
20390 |
|
rif->draw_vertical_window_border (w, x0, y0, y1); |
20391 |
|
} |
20392 |
} |
} |
20393 |
|
|
20394 |
|
|
20423 |
} |
} |
20424 |
|
|
20425 |
/* Frame-relative pixel rectangle of W. */ |
/* Frame-relative pixel rectangle of W. */ |
20426 |
wr.x = XFASTINT (w->left) * CANON_X_UNIT (f); |
wr.x = WINDOW_LEFT_EDGE_X (w); |
20427 |
wr.y = XFASTINT (w->top) * CANON_Y_UNIT (f); |
wr.y = WINDOW_TOP_EDGE_Y (w); |
20428 |
wr.width = XFASTINT (w->width) * CANON_X_UNIT (f); |
wr.width = WINDOW_TOTAL_WIDTH (w); |
20429 |
wr.height = XFASTINT (w->height) * CANON_Y_UNIT (f); |
wr.height = WINDOW_TOTAL_HEIGHT (w); |
20430 |
|
|
20431 |
if (x_intersect_rectangles (fr, &wr, &r)) |
if (x_intersect_rectangles (fr, &wr, &r)) |
20432 |
{ |
{ |
20439 |
r.x, r.y, r.width, r.height)); |
r.x, r.y, r.width, r.height)); |
20440 |
|
|
20441 |
/* Convert to window coordinates. */ |
/* Convert to window coordinates. */ |
20442 |
r.x = FRAME_TO_WINDOW_PIXEL_X (w, r.x); |
r.x -= WINDOW_LEFT_EDGE_X (w); |
20443 |
r.y = FRAME_TO_WINDOW_PIXEL_Y (w, r.y); |
r.y -= WINDOW_TOP_EDGE_Y (w); |
20444 |
|
|
20445 |
/* Turn off the cursor. */ |
/* Turn off the cursor. */ |
20446 |
if (!w->pseudo_window_p |
if (!w->pseudo_window_p |
20601 |
if (w == 0 || h == 0) |
if (w == 0 || h == 0) |
20602 |
{ |
{ |
20603 |
r.x = r.y = 0; |
r.x = r.y = 0; |
20604 |
r.width = CANON_X_UNIT (f) * f->width; |
r.width = FRAME_COLUMN_WIDTH (f) * FRAME_COLS (f); |
20605 |
r.height = CANON_Y_UNIT (f) * f->height; |
r.height = FRAME_LINE_HEIGHT (f) * FRAME_LINES (f); |
20606 |
} |
} |
20607 |
else |
else |
20608 |
{ |
{ |
21167 |
struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (root_window))); |
struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (root_window))); |
21168 |
int i; |
int i; |
21169 |
|
|
21170 |
XWINDOW (root_window)->top = make_number (FRAME_TOP_MARGIN (f)); |
XWINDOW (root_window)->top_line = make_number (FRAME_TOP_MARGIN (f)); |
21171 |
set_window_height (root_window, |
set_window_height (root_window, |
21172 |
FRAME_HEIGHT (f) - 1 - FRAME_TOP_MARGIN (f), |
FRAME_LINES (f) - 1 - FRAME_TOP_MARGIN (f), |
21173 |
0); |
0); |
21174 |
mini_w->top = make_number (FRAME_HEIGHT (f) - 1); |
mini_w->top_line = make_number (FRAME_LINES (f) - 1); |
21175 |
set_window_height (minibuf_window, 1, 0); |
set_window_height (minibuf_window, 1, 0); |
21176 |
|
|
21177 |
XWINDOW (root_window)->width = make_number (FRAME_WIDTH (f)); |
XWINDOW (root_window)->total_cols = make_number (FRAME_COLS (f)); |
21178 |
mini_w->width = make_number (FRAME_WIDTH (f)); |
mini_w->total_cols = make_number (FRAME_COLS (f)); |
21179 |
|
|
21180 |
scratch_glyph_row.glyphs[TEXT_AREA] = scratch_glyphs; |
scratch_glyph_row.glyphs[TEXT_AREA] = scratch_glyphs; |
21181 |
scratch_glyph_row.glyphs[TEXT_AREA + 1] |
scratch_glyph_row.glyphs[TEXT_AREA + 1] |
21199 |
} |
} |
21200 |
|
|
21201 |
|
|
21202 |
|
/* arch-tag: eacc864d-bb6a-4b74-894a-1a4399a1358b |
21203 |
|
(do not change this comment) */ |