… | |
… | |
1969 | * screen.text/screen.rend contain what the screen will change to. |
1969 | * screen.text/screen.rend contain what the screen will change to. |
1970 | */ |
1970 | */ |
1971 | void |
1971 | void |
1972 | rxvt_term::scr_refresh () NOTHROW |
1972 | rxvt_term::scr_refresh () NOTHROW |
1973 | { |
1973 | { |
1974 | unsigned char must_clear, /* use draw_string not draw_image_string */ |
1974 | unsigned char have_bg, |
1975 | showcursor; /* show the cursor */ |
1975 | showcursor; /* show the cursor */ |
1976 | int16_t col, row, /* column/row we're processing */ |
1976 | int16_t col, row, /* column/row we're processing */ |
1977 | ocrow; /* old cursor row */ |
1977 | ocrow; /* old cursor row */ |
1978 | int i; /* tmp */ |
1978 | int i; /* tmp */ |
1979 | #ifndef NO_CURSORCOLOR |
1979 | #ifndef NO_CURSORCOLOR |
… | |
… | |
1987 | return; |
1987 | return; |
1988 | |
1988 | |
1989 | /* |
1989 | /* |
1990 | * A: set up vars |
1990 | * A: set up vars |
1991 | */ |
1991 | */ |
1992 | must_clear = 0; |
1992 | have_bg = 0; |
1993 | refresh_count = 0; |
1993 | refresh_count = 0; |
1994 | |
1994 | |
1995 | #if XPM_BACKGROUND |
1995 | #if XPM_BACKGROUND |
1996 | must_clear |= bgPixmap.pixmap != None; |
1996 | have_bg |= bgPixmap.pixmap != None; |
1997 | #endif |
1997 | #endif |
1998 | #if TRANSPARENT |
1998 | #if TRANSPARENT |
1999 | must_clear |= OPTION (Opt_transparent) && am_transparent; |
1999 | have_bg |= OPTION (Opt_transparent) && am_transparent; |
2000 | #endif |
2000 | #endif |
2001 | ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ |
2001 | ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ |
2002 | |
2002 | |
2003 | /* |
2003 | /* |
2004 | * B: reverse any characters which are selected |
2004 | * B: reverse any characters which are selected |
… | |
… | |
2103 | * D: CopyArea pass - very useful for slower links |
2103 | * D: CopyArea pass - very useful for slower links |
2104 | * This has been deliberately kept simple. |
2104 | * This has been deliberately kept simple. |
2105 | */ |
2105 | */ |
2106 | if (!display->is_local |
2106 | if (!display->is_local |
2107 | && refresh_type == FAST_REFRESH && num_scr_allow && num_scr |
2107 | && refresh_type == FAST_REFRESH && num_scr_allow && num_scr |
2108 | && abs (num_scr) < nrow && !must_clear) |
2108 | && abs (num_scr) < nrow && !have_bg) |
2109 | { |
2109 | { |
2110 | int16_t nits; |
2110 | int16_t nits; |
2111 | int j; |
2111 | int j; |
2112 | int len, wlen; |
2112 | int len, wlen; |
2113 | dLocal (int, num_scr); |
2113 | dLocal (int, num_scr); |
… | |
… | |
2149 | { |
2149 | { |
2150 | /* also comes here at end if needed because of >= above */ |
2150 | /* also comes here at end if needed because of >= above */ |
2151 | if (wlen < len) |
2151 | if (wlen < len) |
2152 | ::swap (wlen, len); |
2152 | ::swap (wlen, len); |
2153 | |
2153 | |
|
|
2154 | XGCValues gcv; |
|
|
2155 | |
|
|
2156 | gcv.graphics_exposures = 1; XChangeGC (dpy, gc, GCGraphicsExposures, &gcv); |
2154 | XCopyArea (dpy, vt, vt, |
2157 | XCopyArea (dpy, vt, vt, |
2155 | gc, 0, Row2Pixel (len + i), |
2158 | gc, 0, Row2Pixel (len + i), |
2156 | (unsigned int)this->width, |
2159 | (unsigned int)this->width, |
2157 | (unsigned int)Height2Pixel (wlen - len + 1), |
2160 | (unsigned int)Height2Pixel (wlen - len + 1), |
2158 | 0, Row2Pixel (len)); |
2161 | 0, Row2Pixel (len)); |
|
|
2162 | gcv.graphics_exposures = 0; XChangeGC (dpy, gc, GCGraphicsExposures, &gcv); |
|
|
2163 | |
2159 | len = -1; |
2164 | len = -1; |
2160 | } |
2165 | } |
2161 | } |
2166 | } |
2162 | } |
2167 | } |
2163 | #endif |
2168 | #endif |
… | |
… | |
2219 | count++; |
2224 | count++; |
2220 | |
2225 | |
2221 | if (stp[col] != dtp[col] |
2226 | if (stp[col] != dtp[col] |
2222 | || !RS_SAME (srp[col], drp[col])) |
2227 | || !RS_SAME (srp[col], drp[col])) |
2223 | { |
2228 | { |
2224 | if (must_clear && (i++ > count / 2)) |
2229 | if (have_bg && (i++ > count / 2)) |
2225 | break; |
2230 | break; |
2226 | |
2231 | |
2227 | dtp[col] = stp[col]; |
2232 | dtp[col] = stp[col]; |
2228 | drp[col] = rend; |
2233 | drp[col] = rend; |
2229 | i = 0; |
2234 | i = 0; |
2230 | } |
2235 | } |
2231 | else if (must_clear || (stp[col] != ' ' && ++i >= 16)) |
2236 | else if (have_bg || (stp[col] != ' ' && ++i >= 16)) |
2232 | break; |
2237 | break; |
2233 | } |
2238 | } |
2234 | |
2239 | |
2235 | col--; /* went one too far. move back */ |
2240 | col--; /* went one too far. move back */ |
2236 | count -= i; /* dump any matching trailing chars */ |
2241 | count -= i; /* dump any matching trailing chars */ |
… | |
… | |
2330 | */ |
2335 | */ |
2331 | rxvt_font *font = (*fontset[GET_STYLE (rend)])[GET_FONT (rend)]; |
2336 | rxvt_font *font = (*fontset[GET_STYLE (rend)])[GET_FONT (rend)]; |
2332 | |
2337 | |
2333 | if (back == fore) |
2338 | if (back == fore) |
2334 | font->clear_rect (*drawable, xpixel, ypixel, fwidth * count, fheight, back); |
2339 | font->clear_rect (*drawable, xpixel, ypixel, fwidth * count, fheight, back); |
2335 | else if (back == Color_bg) |
2340 | else if (back == Color_bg && have_bg) |
2336 | { |
2341 | { |
2337 | if (must_clear) |
2342 | // this is very ugly, maybe push it into ->draw? |
2338 | { |
|
|
2339 | CLEAR_CHARS (xpixel, ypixel, count); |
|
|
2340 | |
2343 | |
2341 | for (i = 0; i < count; i++) /* don't draw empty strings */ |
2344 | for (i = 0; i < count; i++) /* don't draw empty strings */ |
2342 | if (text[i] != ' ') |
2345 | if (text[i] != ' ') |
2343 | { |
2346 | { |
2344 | font->draw (*drawable, xpixel, ypixel, text, count, fore, -1); |
2347 | font->draw (*drawable, xpixel, ypixel, text, count, fore, -1); |
2345 | break; |
2348 | goto did_clear; |
2346 | } |
|
|
2347 | } |
2349 | } |
2348 | else |
2350 | |
2349 | font->draw (*drawable, xpixel, ypixel, text, count, fore, Color_bg); |
2351 | CLEAR_CHARS (xpixel, ypixel, count); |
|
|
2352 | did_clear: ; |
2350 | } |
2353 | } |
2351 | else |
2354 | else |
2352 | font->draw (*drawable, xpixel, ypixel, text, count, fore, back); |
2355 | font->draw (*drawable, xpixel, ypixel, text, count, fore, back); |
2353 | |
2356 | |
2354 | if (rend & RS_Uline && font->descent > 1 && fore != back) |
2357 | if (rend & RS_Uline && font->descent > 1 && fore != back) |