Mercurial > emacs
comparison src/xdisp.c @ 83384:08b4dd6a6e87
Merged from miles@gnu.org--gnu-2005 (patch 578-592)
Patches applied:
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-578
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-579
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-580
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-581
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-582
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-583
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-584
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-585
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-586
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-587
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-588
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-589
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-590
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-591
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-592
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-424
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Wed, 12 Oct 2005 16:14:04 +0000 |
parents | 2a679c81f552 1b9ba63aad7e |
children | 1cd4072747c6 |
comparison
equal
deleted
inserted
replaced
83383:2a679c81f552 | 83384:08b4dd6a6e87 |
---|---|
1753 *y = FRAME_TO_WINDOW_PIXEL_Y (w, *y); | 1753 *y = FRAME_TO_WINDOW_PIXEL_Y (w, *y); |
1754 } | 1754 } |
1755 } | 1755 } |
1756 | 1756 |
1757 /* EXPORT: | 1757 /* EXPORT: |
1758 Return in *R the clipping rectangle for glyph string S. */ | 1758 Return in RECTS[] at most N clipping rectangles for glyph string S. |
1759 | 1759 Return the number of stored rectangles. */ |
1760 void | 1760 |
1761 get_glyph_string_clip_rect (s, nr) | 1761 int |
1762 get_glyph_string_clip_rects (s, rects, n) | |
1762 struct glyph_string *s; | 1763 struct glyph_string *s; |
1763 NativeRectangle *nr; | 1764 NativeRectangle *rects; |
1765 int n; | |
1764 { | 1766 { |
1765 XRectangle r; | 1767 XRectangle r; |
1768 | |
1769 if (n <= 0) | |
1770 return 0; | |
1766 | 1771 |
1767 if (s->row->full_width_p) | 1772 if (s->row->full_width_p) |
1768 { | 1773 { |
1769 /* Draw full-width. X coordinates are relative to S->w->left_col. */ | 1774 /* Draw full-width. X coordinates are relative to S->w->left_col. */ |
1770 r.x = WINDOW_LEFT_EDGE_X (s->w); | 1775 r.x = WINDOW_LEFT_EDGE_X (s->w); |
1804 } | 1809 } |
1805 | 1810 |
1806 /* If S draws overlapping rows, it's sufficient to use the top and | 1811 /* If S draws overlapping rows, it's sufficient to use the top and |
1807 bottom of the window for clipping because this glyph string | 1812 bottom of the window for clipping because this glyph string |
1808 intentionally draws over other lines. */ | 1813 intentionally draws over other lines. */ |
1809 if (s->for_overlaps_p) | 1814 if (s->for_overlaps) |
1810 { | 1815 { |
1811 r.y = WINDOW_HEADER_LINE_HEIGHT (s->w); | 1816 r.y = WINDOW_HEADER_LINE_HEIGHT (s->w); |
1812 r.height = window_text_bottom_y (s->w) - r.y; | 1817 r.height = window_text_bottom_y (s->w) - r.y; |
1818 | |
1819 /* Alas, the above simple strategy does not work for the | |
1820 environments with anti-aliased text: if the same text is | |
1821 drawn onto the same place multiple times, it gets thicker. | |
1822 If the overlap we are processing is for the erased cursor, we | |
1823 take the intersection with the rectagle of the cursor. */ | |
1824 if (s->for_overlaps & OVERLAPS_ERASED_CURSOR) | |
1825 { | |
1826 XRectangle rc, r_save = r; | |
1827 | |
1828 rc.x = WINDOW_TEXT_TO_FRAME_PIXEL_X (s->w, s->w->phys_cursor.x); | |
1829 rc.y = s->w->phys_cursor.y; | |
1830 rc.width = s->w->phys_cursor_width; | |
1831 rc.height = s->w->phys_cursor_height; | |
1832 | |
1833 x_intersect_rectangles (&r_save, &rc, &r); | |
1834 } | |
1813 } | 1835 } |
1814 else | 1836 else |
1815 { | 1837 { |
1816 /* Don't use S->y for clipping because it doesn't take partially | 1838 /* Don't use S->y for clipping because it doesn't take partially |
1817 visible lines into account. For example, it can be negative for | 1839 visible lines into account. For example, it can be negative for |
1866 r.height = min (max_y - r.y, height); | 1888 r.height = min (max_y - r.y, height); |
1867 } | 1889 } |
1868 } | 1890 } |
1869 } | 1891 } |
1870 | 1892 |
1893 if ((s->for_overlaps & OVERLAPS_BOTH) == 0 | |
1894 || (s->for_overlaps & OVERLAPS_BOTH) == OVERLAPS_BOTH && n == 1) | |
1895 { | |
1871 #ifdef CONVERT_FROM_XRECT | 1896 #ifdef CONVERT_FROM_XRECT |
1872 CONVERT_FROM_XRECT (r, *nr); | 1897 CONVERT_FROM_XRECT (r, *rects); |
1873 #else | 1898 #else |
1874 *nr = r; | 1899 *rects = r; |
1875 #endif | 1900 #endif |
1901 return 1; | |
1902 } | |
1903 else | |
1904 { | |
1905 /* If we are processing overlapping and allowed to return | |
1906 multiple clipping rectangles, we exclude the row of the glyph | |
1907 string from the clipping rectangle. This is to avoid drawing | |
1908 the same text on the environment with anti-aliasing. */ | |
1909 #ifdef CONVERT_FROM_XRECT | |
1910 XRectangle rs[2]; | |
1911 #else | |
1912 XRectangle *rs = rects; | |
1913 #endif | |
1914 int i = 0, row_y = WINDOW_TO_FRAME_PIXEL_Y (s->w, s->row->y); | |
1915 | |
1916 if (s->for_overlaps & OVERLAPS_PRED) | |
1917 { | |
1918 rs[i] = r; | |
1919 if (r.y + r.height > row_y) | |
1920 if (r.y < row_y) | |
1921 rs[i].height = row_y - r.y; | |
1922 else | |
1923 rs[i].height = 0; | |
1924 i++; | |
1925 } | |
1926 if (s->for_overlaps & OVERLAPS_SUCC) | |
1927 { | |
1928 rs[i] = r; | |
1929 if (r.y < row_y + s->row->visible_height) | |
1930 if (r.y + r.height > row_y + s->row->visible_height) | |
1931 { | |
1932 rs[i].y = row_y + s->row->visible_height; | |
1933 rs[i].height = r.y + r.height - rs[i].y; | |
1934 } | |
1935 else | |
1936 rs[i].height = 0; | |
1937 i++; | |
1938 } | |
1939 | |
1940 n = i; | |
1941 #ifdef CONVERT_FROM_XRECT | |
1942 for (i = 0; i < n; i++) | |
1943 CONVERT_FROM_XRECT (rs[i], rects[i]); | |
1944 #endif | |
1945 return n; | |
1946 } | |
1947 } | |
1948 | |
1949 /* EXPORT: | |
1950 Return in *NR the clipping rectangle for glyph string S. */ | |
1951 | |
1952 void | |
1953 get_glyph_string_clip_rect (s, nr) | |
1954 struct glyph_string *s; | |
1955 NativeRectangle *nr; | |
1956 { | |
1957 get_glyph_string_clip_rects (s, nr, 1); | |
1876 } | 1958 } |
1877 | 1959 |
1878 | 1960 |
1879 /* EXPORT: | 1961 /* EXPORT: |
1880 Return the position and height of the phys cursor in window W. | 1962 Return the position and height of the phys cursor in window W. |
1928 } | 2010 } |
1929 } | 2011 } |
1930 | 2012 |
1931 *heightp = h - 1; | 2013 *heightp = h - 1; |
1932 return WINDOW_TO_FRAME_PIXEL_Y (w, y); | 2014 return WINDOW_TO_FRAME_PIXEL_Y (w, y); |
2015 } | |
2016 | |
2017 /* | |
2018 * Remember which glyph the mouse is over. | |
2019 */ | |
2020 | |
2021 void | |
2022 remember_mouse_glyph (f, gx, gy, rect) | |
2023 struct frame *f; | |
2024 int gx, gy; | |
2025 NativeRectangle *rect; | |
2026 { | |
2027 Lisp_Object window; | |
2028 struct window *w; | |
2029 struct glyph_row *r, *gr, *end_row; | |
2030 enum window_part part; | |
2031 enum glyph_row_area area; | |
2032 int x, y, width, height; | |
2033 | |
2034 /* Try to determine frame pixel position and size of the glyph under | |
2035 frame pixel coordinates X/Y on frame F. */ | |
2036 | |
2037 window = window_from_coordinates (f, gx, gy, &part, &x, &y, 0); | |
2038 if (NILP (window)) | |
2039 { | |
2040 width = FRAME_SMALLEST_CHAR_WIDTH (f); | |
2041 height = FRAME_SMALLEST_FONT_HEIGHT (f); | |
2042 goto virtual_glyph; | |
2043 } | |
2044 | |
2045 w = XWINDOW (window); | |
2046 width = WINDOW_FRAME_COLUMN_WIDTH (w); | |
2047 height = WINDOW_FRAME_LINE_HEIGHT (w); | |
2048 | |
2049 r = MATRIX_FIRST_TEXT_ROW (w->current_matrix); | |
2050 end_row = r + w->current_matrix->nrows - 1; | |
2051 | |
2052 if (w->pseudo_window_p) | |
2053 { | |
2054 area = TEXT_AREA; | |
2055 part = ON_MODE_LINE; /* Don't adjust margin. */ | |
2056 goto text_glyph; | |
2057 } | |
2058 | |
2059 switch (part) | |
2060 { | |
2061 case ON_LEFT_MARGIN: | |
2062 area = LEFT_MARGIN_AREA; | |
2063 goto text_glyph; | |
2064 | |
2065 case ON_RIGHT_MARGIN: | |
2066 area = RIGHT_MARGIN_AREA; | |
2067 goto text_glyph; | |
2068 | |
2069 case ON_TEXT: | |
2070 case ON_MODE_LINE: | |
2071 case ON_HEADER_LINE: | |
2072 area = TEXT_AREA; | |
2073 | |
2074 text_glyph: | |
2075 gr = 0; gy = 0; | |
2076 for (; r < end_row && r->enabled_p; ++r) | |
2077 if (r->y + r->height > y) | |
2078 { | |
2079 gr = r; gy = r->y; | |
2080 break; | |
2081 } | |
2082 | |
2083 if (gr && gy <= y) | |
2084 { | |
2085 struct glyph *g = gr->glyphs[area]; | |
2086 struct glyph *end = g + gr->used[area]; | |
2087 | |
2088 height = gr->height; | |
2089 for (gx = gr->x; g < end; gx += g->pixel_width, ++g) | |
2090 if (gx + g->pixel_width > x) | |
2091 break; | |
2092 | |
2093 if (g < end) | |
2094 width = g->pixel_width; | |
2095 else | |
2096 { | |
2097 /* Use nominal char spacing at end of line. */ | |
2098 x -= gx; | |
2099 gx += (x / width) * width; | |
2100 } | |
2101 | |
2102 if (part != ON_MODE_LINE && part != ON_HEADER_LINE) | |
2103 gx += window_box_left_offset (w, area); | |
2104 } | |
2105 else | |
2106 { | |
2107 /* Use nominal line height at end of window. */ | |
2108 gx = (x / width) * width; | |
2109 y -= gy; | |
2110 gy += (y / height) * height; | |
2111 } | |
2112 break; | |
2113 | |
2114 case ON_LEFT_FRINGE: | |
2115 gx = (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) | |
2116 ? WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (w) | |
2117 : window_box_right_offset (w, LEFT_MARGIN_AREA)); | |
2118 width = WINDOW_LEFT_FRINGE_WIDTH (w); | |
2119 goto row_glyph; | |
2120 | |
2121 case ON_RIGHT_FRINGE: | |
2122 gx = (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) | |
2123 ? window_box_right_offset (w, RIGHT_MARGIN_AREA) | |
2124 : window_box_right_offset (w, TEXT_AREA)); | |
2125 width = WINDOW_RIGHT_FRINGE_WIDTH (w); | |
2126 goto row_glyph; | |
2127 | |
2128 case ON_SCROLL_BAR: | |
2129 gx = (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) | |
2130 ? 0 | |
2131 : (window_box_right_offset (w, RIGHT_MARGIN_AREA) | |
2132 + (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) | |
2133 ? WINDOW_RIGHT_FRINGE_WIDTH (w) | |
2134 : 0))); | |
2135 width = WINDOW_SCROLL_BAR_AREA_WIDTH (w); | |
2136 | |
2137 row_glyph: | |
2138 gr = 0, gy = 0; | |
2139 for (; r < end_row && r->enabled_p; ++r) | |
2140 if (r->y + r->height > y) | |
2141 { | |
2142 gr = r; gy = r->y; | |
2143 break; | |
2144 } | |
2145 | |
2146 if (gr && gy <= y) | |
2147 height = gr->height; | |
2148 else | |
2149 { | |
2150 /* Use nominal line height at end of window. */ | |
2151 y -= gy; | |
2152 gy += (y / height) * height; | |
2153 } | |
2154 break; | |
2155 | |
2156 default: | |
2157 ; | |
2158 virtual_glyph: | |
2159 /* If there is no glyph under the mouse, then we divide the screen | |
2160 into a grid of the smallest glyph in the frame, and use that | |
2161 as our "glyph". */ | |
2162 | |
2163 /* Arrange for the division in FRAME_PIXEL_X_TO_COL etc. to | |
2164 round down even for negative values. */ | |
2165 if (gx < 0) | |
2166 gx -= width - 1; | |
2167 if (gy < 0) | |
2168 gy -= height - 1; | |
2169 | |
2170 gx = (gx / width) * width; | |
2171 gy = (gy / height) * height; | |
2172 | |
2173 goto store_rect; | |
2174 } | |
2175 | |
2176 gx += WINDOW_LEFT_EDGE_X (w); | |
2177 gy += WINDOW_TOP_EDGE_Y (w); | |
2178 | |
2179 store_rect: | |
2180 STORE_NATIVE_RECT (*rect, gx, gy, width, height); | |
2181 | |
2182 /* Visible feedback for debugging. */ | |
2183 #if 0 | |
2184 #if HAVE_X_WINDOWS | |
2185 XDrawRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | |
2186 f->output_data.x->normal_gc, | |
2187 gx, gy, width, height); | |
2188 #endif | |
2189 #endif | |
1933 } | 2190 } |
1934 | 2191 |
1935 | 2192 |
1936 #endif /* HAVE_WINDOW_SYSTEM */ | 2193 #endif /* HAVE_WINDOW_SYSTEM */ |
1937 | 2194 |
18033 | 18290 |
18034 /* Fill glyph string S with composition components specified by S->cmp. | 18291 /* Fill glyph string S with composition components specified by S->cmp. |
18035 | 18292 |
18036 FACES is an array of faces for all components of this composition. | 18293 FACES is an array of faces for all components of this composition. |
18037 S->gidx is the index of the first component for S. | 18294 S->gidx is the index of the first component for S. |
18038 OVERLAPS_P non-zero means S should draw the foreground only, and | 18295 |
18039 use its physical height for clipping. | 18296 OVERLAPS non-zero means S should draw the foreground only, and use |
18297 its physical height for clipping. See also draw_glyphs. | |
18040 | 18298 |
18041 Value is the index of a component not in S. */ | 18299 Value is the index of a component not in S. */ |
18042 | 18300 |
18043 static int | 18301 static int |
18044 fill_composite_glyph_string (s, faces, overlaps_p) | 18302 fill_composite_glyph_string (s, faces, overlaps) |
18045 struct glyph_string *s; | 18303 struct glyph_string *s; |
18046 struct face **faces; | 18304 struct face **faces; |
18047 int overlaps_p; | 18305 int overlaps; |
18048 { | 18306 { |
18049 int i; | 18307 int i; |
18050 | 18308 |
18051 xassert (s); | 18309 xassert (s); |
18052 | 18310 |
18053 s->for_overlaps_p = overlaps_p; | 18311 s->for_overlaps = overlaps; |
18054 | 18312 |
18055 s->face = faces[s->gidx]; | 18313 s->face = faces[s->gidx]; |
18056 s->font = s->face->font; | 18314 s->font = s->face->font; |
18057 s->font_info = FONT_INFO_FROM_ID (s->f, s->face->font_info_id); | 18315 s->font_info = FONT_INFO_FROM_ID (s->f, s->face->font_info_id); |
18058 | 18316 |
18092 | 18350 |
18093 /* Fill glyph string S from a sequence of character glyphs. | 18351 /* Fill glyph string S from a sequence of character glyphs. |
18094 | 18352 |
18095 FACE_ID is the face id of the string. START is the index of the | 18353 FACE_ID is the face id of the string. START is the index of the |
18096 first glyph to consider, END is the index of the last + 1. | 18354 first glyph to consider, END is the index of the last + 1. |
18097 OVERLAPS_P non-zero means S should draw the foreground only, and | 18355 OVERLAPS non-zero means S should draw the foreground only, and use |
18098 use its physical height for clipping. | 18356 its physical height for clipping. See also draw_glyphs. |
18099 | 18357 |
18100 Value is the index of the first glyph not in S. */ | 18358 Value is the index of the first glyph not in S. */ |
18101 | 18359 |
18102 static int | 18360 static int |
18103 fill_glyph_string (s, face_id, start, end, overlaps_p) | 18361 fill_glyph_string (s, face_id, start, end, overlaps) |
18104 struct glyph_string *s; | 18362 struct glyph_string *s; |
18105 int face_id; | 18363 int face_id; |
18106 int start, end, overlaps_p; | 18364 int start, end, overlaps; |
18107 { | 18365 { |
18108 struct glyph *glyph, *last; | 18366 struct glyph *glyph, *last; |
18109 int voffset; | 18367 int voffset; |
18110 int glyph_not_available_p; | 18368 int glyph_not_available_p; |
18111 | 18369 |
18112 xassert (s->f == XFRAME (s->w->frame)); | 18370 xassert (s->f == XFRAME (s->w->frame)); |
18113 xassert (s->nchars == 0); | 18371 xassert (s->nchars == 0); |
18114 xassert (start >= 0 && end > start); | 18372 xassert (start >= 0 && end > start); |
18115 | 18373 |
18116 s->for_overlaps_p = overlaps_p, | 18374 s->for_overlaps = overlaps, |
18117 glyph = s->row->glyphs[s->area] + start; | 18375 glyph = s->row->glyphs[s->area] + start; |
18118 last = s->row->glyphs[s->area] + end; | 18376 last = s->row->glyphs[s->area] + end; |
18119 voffset = glyph->voffset; | 18377 voffset = glyph->voffset; |
18120 | 18378 |
18121 glyph_not_available_p = glyph->glyph_not_available_p; | 18379 glyph_not_available_p = glyph->glyph_not_available_p; |
18588 s = (struct glyph_string *) alloca (sizeof *s); \ | 18846 s = (struct glyph_string *) alloca (sizeof *s); \ |
18589 char2b = (XChar2b *) alloca ((END - START) * sizeof *char2b); \ | 18847 char2b = (XChar2b *) alloca ((END - START) * sizeof *char2b); \ |
18590 INIT_GLYPH_STRING (s, char2b, w, row, area, START, HL); \ | 18848 INIT_GLYPH_STRING (s, char2b, w, row, area, START, HL); \ |
18591 append_glyph_string (&HEAD, &TAIL, s); \ | 18849 append_glyph_string (&HEAD, &TAIL, s); \ |
18592 s->x = (X); \ | 18850 s->x = (X); \ |
18593 START = fill_glyph_string (s, face_id, START, END, overlaps_p); \ | 18851 START = fill_glyph_string (s, face_id, START, END, overlaps); \ |
18594 } \ | 18852 } \ |
18595 while (0) | 18853 while (0) |
18596 | 18854 |
18597 | 18855 |
18598 /* Add a glyph string for a composite sequence to the list of strings | 18856 /* Add a glyph string for a composite sequence to the list of strings |
18641 s->x = (X); \ | 18899 s->x = (X); \ |
18642 \ | 18900 \ |
18643 if (n == 0) \ | 18901 if (n == 0) \ |
18644 first_s = s; \ | 18902 first_s = s; \ |
18645 \ | 18903 \ |
18646 n = fill_composite_glyph_string (s, faces, overlaps_p); \ | 18904 n = fill_composite_glyph_string (s, faces, overlaps); \ |
18647 } \ | 18905 } \ |
18648 \ | 18906 \ |
18649 ++START; \ | 18907 ++START; \ |
18650 s = first_s; \ | 18908 s = first_s; \ |
18651 } while (0) | 18909 } while (0) |
18710 DRAW_MOUSE_FACE draw in mouse face. | 18968 DRAW_MOUSE_FACE draw in mouse face. |
18711 DRAW_INVERSE_VIDEO draw in mode line face | 18969 DRAW_INVERSE_VIDEO draw in mode line face |
18712 DRAW_IMAGE_SUNKEN draw an image with a sunken relief around it | 18970 DRAW_IMAGE_SUNKEN draw an image with a sunken relief around it |
18713 DRAW_IMAGE_RAISED draw an image with a raised relief around it | 18971 DRAW_IMAGE_RAISED draw an image with a raised relief around it |
18714 | 18972 |
18715 If OVERLAPS_P is non-zero, draw only the foreground of characters | 18973 If OVERLAPS is non-zero, draw only the foreground of characters and |
18716 and clip to the physical height of ROW. | 18974 clip to the physical height of ROW. Non-zero value also defines |
18975 the overlapping part to be drawn: | |
18976 | |
18977 OVERLAPS_PRED overlap with preceding rows | |
18978 OVERLAPS_SUCC overlap with succeeding rows | |
18979 OVERLAPS_BOTH overlap with both preceding/succeeding rows | |
18980 OVERLAPS_ERASED_CURSOR overlap with erased cursor area | |
18717 | 18981 |
18718 Value is the x-position reached, relative to AREA of W. */ | 18982 Value is the x-position reached, relative to AREA of W. */ |
18719 | 18983 |
18720 static int | 18984 static int |
18721 draw_glyphs (w, x, row, area, start, end, hl, overlaps_p) | 18985 draw_glyphs (w, x, row, area, start, end, hl, overlaps) |
18722 struct window *w; | 18986 struct window *w; |
18723 int x; | 18987 int x; |
18724 struct glyph_row *row; | 18988 struct glyph_row *row; |
18725 enum glyph_row_area area; | 18989 enum glyph_row_area area; |
18726 int start, end; | 18990 int start, end; |
18727 enum draw_glyphs_face hl; | 18991 enum draw_glyphs_face hl; |
18728 int overlaps_p; | 18992 int overlaps; |
18729 { | 18993 { |
18730 struct glyph_string *head, *tail; | 18994 struct glyph_string *head, *tail; |
18731 struct glyph_string *s; | 18995 struct glyph_string *s; |
18732 struct glyph_string *clip_head = NULL, *clip_tail = NULL; | 18996 struct glyph_string *clip_head = NULL, *clip_tail = NULL; |
18733 int last_x, area_width; | 18997 int last_x, area_width; |
18772 x_reached = x; | 19036 x_reached = x; |
18773 | 19037 |
18774 /* If there are any glyphs with lbearing < 0 or rbearing > width in | 19038 /* If there are any glyphs with lbearing < 0 or rbearing > width in |
18775 the row, redraw some glyphs in front or following the glyph | 19039 the row, redraw some glyphs in front or following the glyph |
18776 strings built above. */ | 19040 strings built above. */ |
18777 if (head && !overlaps_p && row->contains_overlapping_glyphs_p) | 19041 if (head && !overlaps && row->contains_overlapping_glyphs_p) |
18778 { | 19042 { |
18779 int dummy_x = 0; | 19043 int dummy_x = 0; |
18780 struct glyph_string *h, *t; | 19044 struct glyph_string *h, *t; |
18781 | 19045 |
18782 /* Compute overhangs for all glyph strings. */ | 19046 /* Compute overhangs for all glyph strings. */ |
18865 if (area == TEXT_AREA | 19129 if (area == TEXT_AREA |
18866 && !row->full_width_p | 19130 && !row->full_width_p |
18867 /* When drawing overlapping rows, only the glyph strings' | 19131 /* When drawing overlapping rows, only the glyph strings' |
18868 foreground is drawn, which doesn't erase a cursor | 19132 foreground is drawn, which doesn't erase a cursor |
18869 completely. */ | 19133 completely. */ |
18870 && !overlaps_p) | 19134 && !overlaps) |
18871 { | 19135 { |
18872 int x0 = clip_head ? clip_head->x : (head ? head->x : x); | 19136 int x0 = clip_head ? clip_head->x : (head ? head->x : x); |
18873 int x1 = (clip_tail ? clip_tail->x + clip_tail->background_width | 19137 int x1 = (clip_tail ? clip_tail->x + clip_tail->background_width |
18874 : (tail ? tail->x + tail->background_width : x)); | 19138 : (tail ? tail->x + tail->background_width : x)); |
18875 | 19139 |
20598 ************************************************************************/ | 20862 ************************************************************************/ |
20599 | 20863 |
20600 #ifdef HAVE_WINDOW_SYSTEM | 20864 #ifdef HAVE_WINDOW_SYSTEM |
20601 | 20865 |
20602 /* EXPORT for RIF: | 20866 /* EXPORT for RIF: |
20603 Fix the display of area AREA of overlapping row ROW in window W. */ | 20867 Fix the display of area AREA of overlapping row ROW in window W |
20868 with respect to the overlapping part OVERLAPS. */ | |
20604 | 20869 |
20605 void | 20870 void |
20606 x_fix_overlapping_area (w, row, area) | 20871 x_fix_overlapping_area (w, row, area, overlaps) |
20607 struct window *w; | 20872 struct window *w; |
20608 struct glyph_row *row; | 20873 struct glyph_row *row; |
20609 enum glyph_row_area area; | 20874 enum glyph_row_area area; |
20875 int overlaps; | |
20610 { | 20876 { |
20611 int i, x; | 20877 int i, x; |
20612 | 20878 |
20613 BLOCK_INPUT; | 20879 BLOCK_INPUT; |
20614 | 20880 |
20627 while (i < row->used[area] | 20893 while (i < row->used[area] |
20628 && row->glyphs[area][i].overlaps_vertically_p); | 20894 && row->glyphs[area][i].overlaps_vertically_p); |
20629 | 20895 |
20630 draw_glyphs (w, start_x, row, area, | 20896 draw_glyphs (w, start_x, row, area, |
20631 start, i, | 20897 start, i, |
20632 DRAW_NORMAL_TEXT, 1); | 20898 DRAW_NORMAL_TEXT, overlaps); |
20633 } | 20899 } |
20634 else | 20900 else |
20635 { | 20901 { |
20636 x += row->glyphs[area][i].pixel_width; | 20902 x += row->glyphs[area][i].pixel_width; |
20637 ++i; | 20903 ++i; |
20669 /* When we erase the cursor, and ROW is overlapped by other | 20935 /* When we erase the cursor, and ROW is overlapped by other |
20670 rows, make sure that these overlapping parts of other rows | 20936 rows, make sure that these overlapping parts of other rows |
20671 are redrawn. */ | 20937 are redrawn. */ |
20672 else if (hl == DRAW_NORMAL_TEXT && row->overlapped_p) | 20938 else if (hl == DRAW_NORMAL_TEXT && row->overlapped_p) |
20673 { | 20939 { |
20940 w->phys_cursor_width = x1 - w->phys_cursor.x; | |
20941 | |
20674 if (row > w->current_matrix->rows | 20942 if (row > w->current_matrix->rows |
20675 && MATRIX_ROW_OVERLAPS_SUCC_P (row - 1)) | 20943 && MATRIX_ROW_OVERLAPS_SUCC_P (row - 1)) |
20676 x_fix_overlapping_area (w, row - 1, TEXT_AREA); | 20944 x_fix_overlapping_area (w, row - 1, TEXT_AREA, |
20945 OVERLAPS_ERASED_CURSOR); | |
20677 | 20946 |
20678 if (MATRIX_ROW_BOTTOM_Y (row) < window_text_bottom_y (w) | 20947 if (MATRIX_ROW_BOTTOM_Y (row) < window_text_bottom_y (w) |
20679 && MATRIX_ROW_OVERLAPS_PRED_P (row + 1)) | 20948 && MATRIX_ROW_OVERLAPS_PRED_P (row + 1)) |
20680 x_fix_overlapping_area (w, row + 1, TEXT_AREA); | 20949 x_fix_overlapping_area (w, row + 1, TEXT_AREA, |
20950 OVERLAPS_ERASED_CURSOR); | |
20681 } | 20951 } |
20682 } | 20952 } |
20683 } | 20953 } |
20684 | 20954 |
20685 | 20955 |
22465 if (row->overlapping_p) | 22735 if (row->overlapping_p) |
22466 { | 22736 { |
22467 xassert (row->enabled_p && !row->mode_line_p); | 22737 xassert (row->enabled_p && !row->mode_line_p); |
22468 | 22738 |
22469 if (row->used[LEFT_MARGIN_AREA]) | 22739 if (row->used[LEFT_MARGIN_AREA]) |
22470 x_fix_overlapping_area (w, row, LEFT_MARGIN_AREA); | 22740 x_fix_overlapping_area (w, row, LEFT_MARGIN_AREA, OVERLAPS_BOTH); |
22471 | 22741 |
22472 if (row->used[TEXT_AREA]) | 22742 if (row->used[TEXT_AREA]) |
22473 x_fix_overlapping_area (w, row, TEXT_AREA); | 22743 x_fix_overlapping_area (w, row, TEXT_AREA, OVERLAPS_BOTH); |
22474 | 22744 |
22475 if (row->used[RIGHT_MARGIN_AREA]) | 22745 if (row->used[RIGHT_MARGIN_AREA]) |
22476 x_fix_overlapping_area (w, row, RIGHT_MARGIN_AREA); | 22746 x_fix_overlapping_area (w, row, RIGHT_MARGIN_AREA, OVERLAPS_BOTH); |
22477 } | 22747 } |
22478 } | 22748 } |
22479 | 22749 |
22480 | 22750 |
22481 /* Return non-zero if W's cursor intersects rectangle R. */ | 22751 /* Return non-zero if W's cursor intersects rectangle R. */ |