… | |
… | |
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; |
… | |
… | |
2169 | * Actually do the drawing of the string here |
2162 | * Actually do the drawing of the string here |
2170 | */ |
2163 | */ |
2171 | rxvt_font *font = (*TermWin.fontset)[fid]; |
2164 | rxvt_font *font = (*TermWin.fontset)[fid]; |
2172 | |
2165 | |
2173 | if (back == fore) |
2166 | if (back == fore) |
2174 | font->clear_rect (xpixel, ypixel, |
2167 | font->clear_rect (*TermWin.drawable, xpixel, ypixel, |
2175 | TermWin.fwidth * count, TermWin.fheight, |
2168 | TermWin.fwidth * count, TermWin.fheight, |
2176 | back); |
2169 | back); |
2177 | else if (back == Color_bg) |
2170 | else if (back == Color_bg) |
2178 | { |
2171 | { |
2179 | if (must_clear) |
2172 | if (must_clear) |
… | |
… | |
2181 | CLEAR_CHARS (xpixel, ypixel, count); |
2174 | CLEAR_CHARS (xpixel, ypixel, count); |
2182 | |
2175 | |
2183 | for (i = 0; i < count; i++) /* don't draw empty strings */ |
2176 | for (i = 0; i < count; i++) /* don't draw empty strings */ |
2184 | if (text[i] != ' ') |
2177 | if (text[i] != ' ') |
2185 | { |
2178 | { |
2186 | font->draw (xpixel, ypixel, text, count, fore, -1); |
2179 | font->draw (*TermWin.drawable, xpixel, ypixel, text, count, fore, -1); |
2187 | break; |
2180 | break; |
2188 | } |
2181 | } |
2189 | } |
2182 | } |
2190 | else |
2183 | else |
2191 | font->draw (xpixel, ypixel, text, count, fore, Color_bg); |
2184 | font->draw (*TermWin.drawable, xpixel, ypixel, text, count, fore, Color_bg); |
2192 | } |
2185 | } |
2193 | else |
2186 | else |
2194 | font->draw (xpixel, ypixel, text, count, fore, back); |
2187 | font->draw (*TermWin.drawable, xpixel, ypixel, text, count, fore, back); |
2195 | |
2188 | |
2196 | if ((rend & RS_Uline) && (font->descent > 1)) |
2189 | if ((rend & RS_Uline) && (font->descent > 1)) |
2197 | XDrawLine (display->display, drawBuffer, TermWin.gc, |
2190 | XDrawLine (display->display, drawBuffer, TermWin.gc, |
2198 | xpixel, ypixel + font->ascent + 1, |
2191 | xpixel, ypixel + font->ascent + 1, |
2199 | xpixel + Width2Pixel (count) - 1, ypixel + font->ascent + 1); |
2192 | xpixel + Width2Pixel (count) - 1, ypixel + font->ascent + 1); |
… | |
… | |
2211 | [screen.cur.col]); |
2204 | [screen.cur.col]); |
2212 | *srp ^= RS_RVid; |
2205 | *srp ^= RS_RVid; |
2213 | #ifndef NO_CURSORCOLOR |
2206 | #ifndef NO_CURSORCOLOR |
2214 | *srp = (*srp & ~ (RS_fgMask | RS_bgMask)) | cc1; |
2207 | *srp = (*srp & ~ (RS_fgMask | RS_bgMask)) | cc1; |
2215 | #endif |
2208 | #endif |
2216 | |
|
|
2217 | } |
2209 | } |
2218 | else if (oldcursor.row >= 0) |
2210 | else if (oldcursor.row >= 0) |
2219 | { |
2211 | { |
2220 | #ifndef NO_CURSORCOLOR |
2212 | #ifndef NO_CURSORCOLOR |
2221 | if (ISSET_PIXCOLOR (Color_cursor)) |
2213 | if (ISSET_PIXCOLOR (Color_cursor)) |
2222 | XSetForeground (display->display, TermWin.gc, PixColors[Color_cursor]); |
2214 | XSetForeground (display->display, TermWin.gc, PixColors[Color_cursor]); |
2223 | #endif |
2215 | #endif |
|
|
2216 | int cursorwidth = 1; |
|
|
2217 | while (oldcursor.col + cursorwidth < TermWin.ncol |
|
|
2218 | && drawn_text[oldcursor.row][oldcursor.col + cursorwidth] == NOCHAR) |
|
|
2219 | cursorwidth++; |
|
|
2220 | |
2224 | XDrawRectangle (display->display, drawBuffer, TermWin.gc, |
2221 | XDrawRectangle (display->display, drawBuffer, TermWin.gc, |
2225 | Col2Pixel (oldcursor.col), |
2222 | Col2Pixel (oldcursor.col), |
2226 | Row2Pixel (oldcursor.row), |
2223 | Row2Pixel (oldcursor.row), |
2227 | (unsigned int) (Width2Pixel (cursorwidth) - 1), |
2224 | (unsigned int) (Width2Pixel (cursorwidth) - 1), |
2228 | (unsigned int) (Height2Pixel (1) - TermWin.lineSpace - 1)); |
2225 | (unsigned int) (Height2Pixel (1) - TermWin.lineSpace - 1)); |
… | |
… | |
2260 | num_scr = 0; |
2257 | num_scr = 0; |
2261 | num_scr_allow = 1; |
2258 | num_scr_allow = 1; |
2262 | want_refresh = 0; /* screen is current */ |
2259 | want_refresh = 0; /* screen is current */ |
2263 | } |
2260 | } |
2264 | |
2261 | |
|
|
2262 | void |
|
|
2263 | rxvt_term::scr_remap_chars (text_t *tp, rend_t *rp) |
|
|
2264 | { |
|
|
2265 | if (!rp || !tp) |
|
|
2266 | return; |
|
|
2267 | |
|
|
2268 | for (int i = TermWin.ncol; i; i--, rp++, tp++) |
|
|
2269 | *rp = SET_FONT (*rp, TermWin.fontset->find_font (*tp)); |
|
|
2270 | } |
|
|
2271 | |
|
|
2272 | void |
|
|
2273 | rxvt_term::scr_remap_chars () |
|
|
2274 | { |
|
|
2275 | for (int i = TermWin.nrow + TermWin.saveLines; i--; ) |
|
|
2276 | scr_remap_chars (screen.text[i], screen.rend[i]); |
|
|
2277 | |
|
|
2278 | for (int i = TermWin.nrow; i--; ) |
|
|
2279 | { |
|
|
2280 | scr_remap_chars (drawn_text[i], drawn_rend[i]); |
|
|
2281 | scr_remap_chars (swap.text[i], swap.rend[i]); |
|
|
2282 | } |
|
|
2283 | } |
|
|
2284 | |
2265 | /* ------------------------------------------------------------------------- */ |
2285 | /* ------------------------------------------------------------------------- */ |
2266 | void |
2286 | void |
2267 | rxvt_term::scr_clear () |
2287 | rxvt_term::scr_clear () |
2268 | { |
2288 | { |
2269 | if (!TermWin.mapped) |
2289 | if (!TermWin.mapped) |
… | |
… | |
2667 | rxvt_term::selection_clear () |
2687 | rxvt_term::selection_clear () |
2668 | { |
2688 | { |
2669 | D_SELECT ((stderr, "rxvt_selection_clear ()")); |
2689 | D_SELECT ((stderr, "rxvt_selection_clear ()")); |
2670 | |
2690 | |
2671 | want_refresh = 1; |
2691 | want_refresh = 1; |
2672 | if (selection.text) |
|
|
2673 | free (selection.text); |
2692 | free (selection.text); |
2674 | selection.text = NULL; |
2693 | selection.text = NULL; |
2675 | selection.len = 0; |
2694 | selection.len = 0; |
2676 | CLEAR_SELECTION (); |
2695 | CLEAR_SELECTION (); |
2677 | } |
2696 | } |
2678 | |
2697 | |