1 | /*--------------------------------*-C-*--------------------------------------* |
1 | /*--------------------------------*-C-*--------------------------------------* |
2 | * File: screen.c |
2 | * File: screen.c |
3 | *---------------------------------------------------------------------------* |
3 | *---------------------------------------------------------------------------* |
4 | * $Id: screen.C,v 1.11 2003/12/18 13:33:03 pcg Exp $ |
4 | * $Id: screen.C,v 1.12 2003/12/18 14:11:47 pcg Exp $ |
5 | * |
5 | * |
6 | * Copyright (c) 1997-2001 Geoff Wing <gcw@pobox.com> |
6 | * Copyright (c) 1997-2001 Geoff Wing <gcw@pobox.com> |
7 | * |
7 | * |
8 | * This program is free software; you can redistribute it and/or modify |
8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by |
9 | * it under the terms of the GNU General Public License as published by |
… | |
… | |
1901 | rend_t cc1; /* store colours at cursor position(s) */ |
1901 | rend_t cc1; /* store colours at cursor position(s) */ |
1902 | rend_t cc2; /* store colours at cursor position(s) */ |
1902 | rend_t cc2; /* store colours at cursor position(s) */ |
1903 | #endif |
1903 | #endif |
1904 | rend_t *drp, *srp; /* drawn-rend-pointer, screen-rend-pointer */ |
1904 | rend_t *drp, *srp; /* drawn-rend-pointer, screen-rend-pointer */ |
1905 | text_t *dtp, *stp; /* drawn-text-pointer, screen-text-pointer */ |
1905 | text_t *dtp, *stp; /* drawn-text-pointer, screen-text-pointer */ |
1906 | char *buffer; /* local copy of buffer */ |
|
|
1907 | |
1906 | |
1908 | if (refresh_type == NO_REFRESH || !TermWin.mapped) |
1907 | if (refresh_type == NO_REFRESH || !TermWin.mapped) |
1909 | return; |
1908 | return; |
1910 | |
1909 | |
1911 | /* |
1910 | /* |
… | |
… | |
1921 | currmaxcol = TermWin.ncol; |
1920 | currmaxcol = TermWin.ncol; |
1922 | buffer = (char *)rxvt_realloc (buffer, |
1921 | buffer = (char *)rxvt_realloc (buffer, |
1923 | sizeof(char) * (currmaxcol + 1) * MB_CUR_MAX); |
1922 | sizeof(char) * (currmaxcol + 1) * MB_CUR_MAX); |
1924 | } |
1923 | } |
1925 | |
1924 | |
1926 | buffer = buffer; |
|
|
1927 | refresh_count = 0; |
1925 | refresh_count = 0; |
1928 | |
1926 | |
1929 | row_offset = TermWin.saveLines - TermWin.view_start; |
1927 | row_offset = TermWin.saveLines - TermWin.view_start; |
1930 | |
1928 | |
1931 | if ((refresh_type & REFRESH_BOUNDS)) |
1929 | if ((refresh_type & REFRESH_BOUNDS)) |
… | |
… | |
1940 | #if defined(TRANSPARENT) |
1938 | #if defined(TRANSPARENT) |
1941 | must_clear |= ((Options & Opt_transparent) && am_transparent); |
1939 | must_clear |= ((Options & Opt_transparent) && am_transparent); |
1942 | #endif |
1940 | #endif |
1943 | ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ |
1941 | ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ |
1944 | |
1942 | |
1945 | /* |
1943 | /* |
1946 | * B: reverse any characters which are selected |
1944 | * B: reverse any characters which are selected |
1947 | */ |
1945 | */ |
1948 | rxvt_scr_reverse_selection (this); |
1946 | rxvt_scr_reverse_selection (this); |
1949 | |
1947 | |
1950 | /* |
1948 | /* |
1951 | * C: set the cursor character(s) |
1949 | * C: set the cursor character(s) |
1952 | */ |
1950 | */ |
1953 | { |
1951 | { |
1954 | unsigned char setoldcursor; |
1952 | unsigned char setoldcursor; |
1955 | rend_t ccol1, /* Cursor colour */ |
1953 | rend_t ccol1, /* Cursor colour */ |
1956 | ccol2; /* Cursor colour2 */ |
1954 | ccol2; /* Cursor colour2 */ |
1957 | |
1955 | |
… | |
… | |
2026 | } |
2024 | } |
2027 | } |
2025 | } |
2028 | } |
2026 | } |
2029 | |
2027 | |
2030 | #ifndef NO_SLOW_LINK_SUPPORT |
2028 | #ifndef NO_SLOW_LINK_SUPPORT |
2031 | /* |
2029 | /* |
2032 | * D: CopyArea pass - very useful for slower links |
2030 | * D: CopyArea pass - very useful for slower links |
2033 | * This has been deliberately kept simple. |
2031 | * This has been deliberately kept simple. |
2034 | */ |
2032 | */ |
2035 | i = num_scr; |
2033 | i = num_scr; |
2036 | if (refresh_type == FAST_REFRESH && num_scr_allow && i |
2034 | if (refresh_type == FAST_REFRESH && num_scr_allow && i |
2037 | && abs(i) < TermWin.nrow && !must_clear) |
2035 | && abs(i) < TermWin.nrow && !must_clear) |
2038 | { |
2036 | { |
2039 | int16_t nits; |
2037 | int16_t nits; |
… | |
… | |
2094 | } |
2092 | } |
2095 | } |
2093 | } |
2096 | } |
2094 | } |
2097 | #endif |
2095 | #endif |
2098 | |
2096 | |
2099 | /* |
2097 | /* |
2100 | * E: main pass across every character |
2098 | * E: main pass across every character |
2101 | */ |
2099 | */ |
2102 | for (row = 0; row < TermWin.nrow; row++) |
2100 | for (row = 0; row < TermWin.nrow; row++) |
2103 | { |
2101 | { |
2104 | stp = screen.text[row + row_offset]; |
2102 | stp = screen.text[row + row_offset]; |
2105 | srp = screen.rend[row + row_offset]; |
2103 | srp = screen.rend[row + row_offset]; |
2106 | dtp = drawn_text[row]; |
2104 | dtp = drawn_text[row]; |
2107 | drp = drawn_rend[row]; |
2105 | drp = drawn_rend[row]; |
2108 | |
2106 | |
2109 | /* |
2107 | /* |
2110 | * E2: OK, now the real pass |
2108 | * E2: OK, now the real pass |
2111 | */ |
2109 | */ |
2112 | int ypixel = (int)Row2Pixel(row); |
2110 | int ypixel = (int)Row2Pixel(row); |
2113 | |
2111 | |
2114 | for (col = 0; col < TermWin.ncol; col++) |
2112 | for (col = 0; col < TermWin.ncol; col++) |
2115 | { |
2113 | { |
2116 | /* compare new text with old - if exactly the same then continue */ |
2114 | /* compare new text with old - if exactly the same then continue */ |
… | |
… | |
2171 | } |
2169 | } |
2172 | |
2170 | |
2173 | col--; /* went one too far. move back */ |
2171 | col--; /* went one too far. move back */ |
2174 | count -= i; /* dump any matching trailing chars */ |
2172 | count -= i; /* dump any matching trailing chars */ |
2175 | |
2173 | |
2176 | /* |
2174 | /* |
2177 | * Determine the attributes for the string |
2175 | * Determine the attributes for the string |
2178 | */ |
2176 | */ |
2179 | int fid = GET_FONT(rend); |
2177 | int fid = GET_FONT(rend); |
2180 | fore = GET_FGCOLOR(rend); |
2178 | fore = GET_FGCOLOR(rend); |
2181 | back = GET_BGCOLOR(rend); |
2179 | back = GET_BGCOLOR(rend); |
2182 | rend = GET_ATTR(rend); |
2180 | rend = GET_ATTR(rend); |
2183 | |
2181 | |
… | |
… | |
2223 | rend &= ~RS_Uline; /* we've taken care of it */ |
2221 | rend &= ~RS_Uline; /* we've taken care of it */ |
2224 | } |
2222 | } |
2225 | } |
2223 | } |
2226 | #endif |
2224 | #endif |
2227 | |
2225 | |
2228 | /* |
2226 | /* |
2229 | * Actually do the drawing of the string here |
2227 | * Actually do the drawing of the string here |
2230 | */ |
2228 | */ |
2231 | rxvt_font *font = (*TermWin.fontset)[fid]; |
2229 | rxvt_font *font = (*TermWin.fontset)[fid]; |
2232 | |
2230 | |
2233 | if (back == Color_bg) |
2231 | if (back == Color_bg) |
2234 | { |
2232 | { |
2235 | if (must_clear) |
2233 | if (must_clear) |
… | |
… | |
2255 | xpixel, ypixel + font->ascent + 1, |
2253 | xpixel, ypixel + font->ascent + 1, |
2256 | xpixel + Width2Pixel(count) - 1, ypixel + font->ascent + 1); |
2254 | xpixel + Width2Pixel(count) - 1, ypixel + font->ascent + 1); |
2257 | } /* for (col....) */ |
2255 | } /* for (col....) */ |
2258 | } /* for (row....) */ |
2256 | } /* for (row....) */ |
2259 | |
2257 | |
2260 | /* |
2258 | /* |
2261 | * G: cleanup cursor and display outline cursor if necessary |
2259 | * G: cleanup cursor and display outline cursor if necessary |
2262 | */ |
2260 | */ |
2263 | if (showcursor) { |
2261 | if (showcursor) { |
2264 | if (TermWin.focus) { |
2262 | if (TermWin.focus) { |
2265 | srp = &(screen.rend[screen.cur.row + TermWin.saveLines] |
2263 | srp = &(screen.rend[screen.cur.row + TermWin.saveLines] |
2266 | [screen.cur.col]); |
2264 | [screen.cur.col]); |
2267 | *srp ^= RS_RVid; |
2265 | *srp ^= RS_RVid; |
… | |
… | |
2280 | Row2Pixel(oldcursor.row), |
2278 | Row2Pixel(oldcursor.row), |
2281 | (unsigned int)(Width2Pixel(cursorwidth) - 1), |
2279 | (unsigned int)(Width2Pixel(cursorwidth) - 1), |
2282 | (unsigned int)(Height2Pixel(1) - TermWin.lineSpace - 1)); |
2280 | (unsigned int)(Height2Pixel(1) - TermWin.lineSpace - 1)); |
2283 | } |
2281 | } |
2284 | } |
2282 | } |
2285 | /* |
2283 | |
|
|
2284 | /* |
2286 | * H: cleanup selection |
2285 | * H: cleanup selection |
2287 | */ |
2286 | */ |
2288 | rxvt_scr_reverse_selection (this); |
2287 | rxvt_scr_reverse_selection (this); |
2289 | |
2288 | |
2290 | /* |
2289 | /* |
2291 | * I: other general cleanup |
2290 | * I: other general cleanup |
2292 | */ |
2291 | */ |
2293 | if (clearfirst && TermWin.int_bwidth) |
2292 | if (clearfirst && TermWin.int_bwidth) |
2294 | /* |
2293 | /* |
2295 | * clear the whole screen height, note that width == 0 is treated |
2294 | * clear the whole screen height, note that width == 0 is treated |
2296 | * specially by XClearArea |
2295 | * specially by XClearArea |
2297 | */ |
2296 | */ |