… | |
… | |
1835 | ((Y) >= (X)->min_char_or_byte2 && (Y) <= (X)->max_char_or_byte2) |
1835 | ((Y) >= (X)->min_char_or_byte2 && (Y) <= (X)->max_char_or_byte2) |
1836 | |
1836 | |
1837 | void |
1837 | void |
1838 | rxvt_term::scr_refresh (unsigned char refresh_type) |
1838 | rxvt_term::scr_refresh (unsigned char refresh_type) |
1839 | { |
1839 | { |
1840 | unsigned char clearfirst, /* first character writes before cell */ |
1840 | unsigned char clearfirst, /* first character writes before cell */ |
1841 | clearlast, /* last character writes beyond cell */ |
1841 | clearlast, /* last character writes beyond cell */ |
1842 | must_clear, /* use draw_string not draw_image_string */ |
1842 | must_clear, /* use draw_string not draw_image_string */ |
1843 | rvid, /* reverse video this position */ |
1843 | rvid, /* reverse video this position */ |
1844 | showcursor; /* show the cursor */ |
1844 | showcursor; /* show the cursor */ |
1845 | int16_t col, row, /* column/row we're processing */ |
1845 | int16_t col, row, /* column/row we're processing */ |
1846 | ocrow; /* old cursor row */ |
1846 | ocrow; /* old cursor row */ |
1847 | int cursorwidth; |
|
|
1848 | int i, /* tmp */ |
1847 | int i, /* tmp */ |
1849 | row_offset; /* basic offset in screen structure */ |
1848 | row_offset; /* basic offset in screen structure */ |
1850 | #ifndef NO_CURSORCOLOR |
1849 | #ifndef NO_CURSORCOLOR |
1851 | rend_t cc1; /* store colours at cursor position (s) */ |
1850 | rend_t cc1; /* store colours at cursor position (s) */ |
1852 | #endif |
1851 | #endif |
1853 | rend_t *drp, *srp; /* drawn-rend-pointer, screen-rend-pointer */ |
1852 | rend_t *drp, *srp; /* drawn-rend-pointer, screen-rend-pointer */ |
1854 | text_t *dtp, *stp; /* drawn-text-pointer, screen-text-pointer */ |
1853 | text_t *dtp, *stp; /* drawn-text-pointer, screen-text-pointer */ |
1855 | |
1854 | |
1856 | if (refresh_type == NO_REFRESH || !TermWin.mapped) |
1855 | if (refresh_type == NO_REFRESH || !TermWin.mapped) |
1857 | return; |
1856 | return; |
1858 | |
1857 | |
1859 | /* |
1858 | /* |
… | |
… | |
1891 | unsigned char setoldcursor; |
1890 | unsigned char setoldcursor; |
1892 | rend_t ccol1, /* Cursor colour */ |
1891 | rend_t ccol1, /* Cursor colour */ |
1893 | ccol2; /* Cursor colour2 */ |
1892 | ccol2; /* Cursor colour2 */ |
1894 | |
1893 | |
1895 | showcursor = (screen.flags & Screen_VisibleCursor); |
1894 | showcursor = (screen.flags & Screen_VisibleCursor); |
1896 | cursorwidth = 0; |
|
|
1897 | #ifdef CURSOR_BLINK |
1895 | #ifdef CURSOR_BLINK |
1898 | if (hidden_cursor) |
1896 | if (hidden_cursor) |
1899 | showcursor = 0; |
1897 | showcursor = 0; |
1900 | #endif |
1898 | #endif |
1901 | |
1899 | |
1902 | cursorwidth = 0; |
|
|
1903 | |
|
|
1904 | if (showcursor) |
1900 | if (showcursor) |
1905 | { |
1901 | { |
1906 | cursorwidth++; |
|
|
1907 | |
|
|
1908 | srp = & (screen.rend[screen.cur.row + TermWin.saveLines] |
1902 | srp = & (screen.rend[screen.cur.row + TermWin.saveLines] |
1909 | [screen.cur.col]); |
1903 | [screen.cur.col]); |
1910 | |
1904 | |
1911 | if (showcursor && TermWin.focus) |
1905 | if (showcursor && TermWin.focus) |
1912 | { |
1906 | { |
… | |
… | |
1930 | ccol2 = Color_bg; |
1924 | ccol2 = Color_bg; |
1931 | #endif |
1925 | #endif |
1932 | *srp = SET_FGCOLOR (*srp, ccol1); |
1926 | *srp = SET_FGCOLOR (*srp, ccol1); |
1933 | *srp = SET_BGCOLOR (*srp, ccol2); |
1927 | *srp = SET_BGCOLOR (*srp, ccol2); |
1934 | #endif |
1928 | #endif |
1935 | |
|
|
1936 | } |
1929 | } |
1937 | } |
1930 | } |
1938 | |
1931 | |
1939 | /* make sure no outline cursor is left around */ |
1932 | /* make sure no outline cursor is left around */ |
1940 | setoldcursor = 0; |
1933 | setoldcursor = 0; |
… | |
… | |
2121 | int fore = GET_FGCOLOR (rend); // desired foreground |
2114 | int fore = GET_FGCOLOR (rend); // desired foreground |
2122 | int back = GET_BGCOLOR (rend); // desired background |
2115 | int back = GET_BGCOLOR (rend); // desired background |
2123 | |
2116 | |
2124 | rend = GET_ATTR (rend); |
2117 | rend = GET_ATTR (rend); |
2125 | |
2118 | |
2126 | rvid = !! (rend & RS_RVid); |
2119 | rvid = !!(rend & RS_RVid); |
2127 | if (rvid) |
|
|
2128 | { |
|
|
2129 | SWAP_IT (fore, back, int); |
|
|
2130 | |
2120 | |
2131 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
|
|
2132 | if (ISSET_PIXCOLOR (Color_RV) |
|
|
2133 | # ifndef NO_CURSORCOLOR |
|
|
2134 | && !ISSET_PIXCOLOR (Color_cursor) |
|
|
2135 | # endif |
|
|
2136 | ) |
|
|
2137 | back = Color_RV; |
|
|
2138 | #endif |
|
|
2139 | |
|
|
2140 | } |
|
|
2141 | #ifdef TEXT_BLINK |
2121 | #ifdef TEXT_BLINK |
2142 | if (rend & RS_Blink) |
2122 | if (rend & RS_Blink) |
2143 | { |
2123 | { |
2144 | if (!text_blink_ev.active) |
2124 | if (!text_blink_ev.active) |
2145 | { |
2125 | { |
… | |
… | |
2148 | } |
2128 | } |
2149 | else if (hidden_text) |
2129 | else if (hidden_text) |
2150 | fore = back; |
2130 | fore = back; |
2151 | } |
2131 | } |
2152 | #endif |
2132 | #endif |
|
|
2133 | |
2153 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
2134 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
2154 | else if (rend & RS_Bold) |
2135 | if (rend & RS_Bold && fore == Color_fg) |
2155 | { |
2136 | { |
2156 | if (ISSET_PIXCOLOR (Color_BD)) |
2137 | if (ISSET_PIXCOLOR (Color_BD)) |
2157 | fore = Color_BD; |
2138 | fore = Color_BD; |
2158 | else if (fore == Color_fg) |
2139 | else |
2159 | fore = Color_White; |
2140 | rvid = !rvid; |
2160 | } |
2141 | } |
|
|
2142 | |
2161 | else if (rend & RS_Uline) |
2143 | if (rend & RS_Uline) |
2162 | { |
2144 | { |
2163 | if (ISSET_PIXCOLOR (Color_UL)) |
2145 | if (ISSET_PIXCOLOR (Color_UL)) |
2164 | fore = Color_UL; |
2146 | fore = Color_UL; |
2165 | } |
2147 | } |
2166 | #endif |
2148 | #endif |
2167 | |
2149 | |
|
|
2150 | if (rvid) |
|
|
2151 | { |
|
|
2152 | SWAP_IT (fore, back, int); |
|
|
2153 | |
|
|
2154 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
|
|
2155 | if (ISSET_PIXCOLOR (Color_RV) |
|
|
2156 | # ifndef NO_CURSORCOLOR |
|
|
2157 | && !ISSET_PIXCOLOR (Color_cursor) |
|
|
2158 | # endif |
|
|
2159 | ) |
|
|
2160 | back = Color_RV; |
|
|
2161 | #endif |
|
|
2162 | } |
|
|
2163 | |
2168 | /* |
2164 | /* |
2169 | * Actually do the drawing of the string here |
2165 | * Actually do the drawing of the string here |
2170 | */ |
2166 | */ |
2171 | rxvt_font *font = (*TermWin.fontset)[fid]; |
2167 | rxvt_font *font = (*TermWin.fontset)[fid]; |
2172 | |
2168 | |
2173 | if (back == fore) |
2169 | if (back == fore) |
2174 | font->clear_rect (xpixel, ypixel, |
2170 | font->clear_rect (*TermWin.drawable, xpixel, ypixel, |
2175 | TermWin.fwidth * count, TermWin.fheight, |
2171 | TermWin.fwidth * count, TermWin.fheight, |
2176 | back); |
2172 | back); |
2177 | else if (back == Color_bg) |
2173 | else if (back == Color_bg) |
2178 | { |
2174 | { |
2179 | if (must_clear) |
2175 | if (must_clear) |
… | |
… | |
2181 | CLEAR_CHARS (xpixel, ypixel, count); |
2177 | CLEAR_CHARS (xpixel, ypixel, count); |
2182 | |
2178 | |
2183 | for (i = 0; i < count; i++) /* don't draw empty strings */ |
2179 | for (i = 0; i < count; i++) /* don't draw empty strings */ |
2184 | if (text[i] != ' ') |
2180 | if (text[i] != ' ') |
2185 | { |
2181 | { |
2186 | font->draw (xpixel, ypixel, text, count, fore, -1); |
2182 | font->draw (*TermWin.drawable, xpixel, ypixel, text, count, fore, -1); |
2187 | break; |
2183 | break; |
2188 | } |
2184 | } |
2189 | } |
2185 | } |
2190 | else |
2186 | else |
2191 | font->draw (xpixel, ypixel, text, count, fore, Color_bg); |
2187 | font->draw (*TermWin.drawable, xpixel, ypixel, text, count, fore, Color_bg); |
2192 | } |
2188 | } |
2193 | else |
2189 | else |
2194 | font->draw (xpixel, ypixel, text, count, fore, back); |
2190 | font->draw (*TermWin.drawable, xpixel, ypixel, text, count, fore, back); |
2195 | |
2191 | |
2196 | if ((rend & RS_Uline) && (font->descent > 1)) |
2192 | if ((rend & RS_Uline) && (font->descent > 1)) |
2197 | XDrawLine (display->display, drawBuffer, TermWin.gc, |
2193 | XDrawLine (display->display, drawBuffer, TermWin.gc, |
2198 | xpixel, ypixel + font->ascent + 1, |
2194 | xpixel, ypixel + font->ascent + 1, |
2199 | xpixel + Width2Pixel (count) - 1, ypixel + font->ascent + 1); |
2195 | xpixel + Width2Pixel (count) - 1, ypixel + font->ascent + 1); |
… | |
… | |
2211 | [screen.cur.col]); |
2207 | [screen.cur.col]); |
2212 | *srp ^= RS_RVid; |
2208 | *srp ^= RS_RVid; |
2213 | #ifndef NO_CURSORCOLOR |
2209 | #ifndef NO_CURSORCOLOR |
2214 | *srp = (*srp & ~ (RS_fgMask | RS_bgMask)) | cc1; |
2210 | *srp = (*srp & ~ (RS_fgMask | RS_bgMask)) | cc1; |
2215 | #endif |
2211 | #endif |
2216 | |
|
|
2217 | } |
2212 | } |
2218 | else if (oldcursor.row >= 0) |
2213 | else if (oldcursor.row >= 0) |
2219 | { |
2214 | { |
2220 | #ifndef NO_CURSORCOLOR |
2215 | #ifndef NO_CURSORCOLOR |
2221 | if (ISSET_PIXCOLOR (Color_cursor)) |
2216 | if (ISSET_PIXCOLOR (Color_cursor)) |
2222 | XSetForeground (display->display, TermWin.gc, PixColors[Color_cursor]); |
2217 | XSetForeground (display->display, TermWin.gc, PixColors[Color_cursor]); |
2223 | #endif |
2218 | #endif |
|
|
2219 | int cursorwidth = 1; |
|
|
2220 | while (oldcursor.col + cursorwidth < TermWin.ncol |
|
|
2221 | && drawn_text[oldcursor.row][oldcursor.col + cursorwidth] == NOCHAR) |
|
|
2222 | cursorwidth++; |
|
|
2223 | |
2224 | XDrawRectangle (display->display, drawBuffer, TermWin.gc, |
2224 | XDrawRectangle (display->display, drawBuffer, TermWin.gc, |
2225 | Col2Pixel (oldcursor.col), |
2225 | Col2Pixel (oldcursor.col), |
2226 | Row2Pixel (oldcursor.row), |
2226 | Row2Pixel (oldcursor.row), |
2227 | (unsigned int) (Width2Pixel (cursorwidth) - 1), |
2227 | (unsigned int) (Width2Pixel (cursorwidth) - 1), |
2228 | (unsigned int) (Height2Pixel (1) - TermWin.lineSpace - 1)); |
2228 | (unsigned int) (Height2Pixel (1) - TermWin.lineSpace - 1)); |