From b039941079b90fad7bad94eccb2b3c015b58e706 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 18 Feb 2006 15:24:39 +0000 Subject: [PATCH] *** empty log message *** --- Changes | 5 +++++ src/init.C | 2 +- src/rxvtfont.C | 30 ++++++++++++++++++++++++++---- src/screen.C | 45 ++++++++++++++++++++++++--------------------- src/xpm.C | 6 ------ 5 files changed, 56 insertions(+), 32 deletions(-) diff --git a/Changes b/Changes index 2c6b01d7..816f63d6 100644 --- a/Changes +++ b/Changes @@ -13,8 +13,13 @@ WISH: anyevent mouse notification / manage MotionMask better. WISH: http://www120.pair.com/mccarthy/nextstep/intro.htmld/Workspace.html is the correct nextstep look. DUMB: support tex fonts + - use double-buffered drawing for xft fonts only. On many driver/hardware + combination this actually increases xft drawing speed, at the expense + of more network bandwidth and slight nausea on the side of the author. - readline perl extension now requires shift-click instead of a normal click. + - disabled graphics-exposures on the main drawing GC, report any + refresh bugs please. - improve property handling for -pe tabbed: avoid unnecessary property changes (for kde's benefit) at the expense of extra round-trips, improve size hint setting. diff --git a/src/init.C b/src/init.C index c4ff9a7f..45693336 100644 --- a/src/init.C +++ b/src/init.C @@ -1054,7 +1054,7 @@ rxvt_term::create_windows (int argc, const char *const *argv) /* graphics context for the vt window */ gcvalue.foreground = pix_colors[Color_fg]; gcvalue.background = pix_colors[Color_bg]; - gcvalue.graphics_exposures = 1; + gcvalue.graphics_exposures = 0; gc = XCreateGC (dpy, vt, GCForeground | GCBackground | GCGraphicsExposures, diff --git a/src/rxvtfont.C b/src/rxvtfont.C index 75fc571d..0551463d 100644 --- a/src/rxvtfont.C +++ b/src/rxvtfont.C @@ -234,9 +234,9 @@ rxvt_font::clear_rect (rxvt_drawable &d, int x, int y, int w, int h, int color) dTermDisplay; dTermGC; - if (color == Color_bg) + if (color < 0 || color == Color_bg) XClearArea (disp, d, x, y, w, h, false); - else if (color >= 0) + else { #if XFT XftDrawRect (d, &term->pix_colors[color].c, x, y, w, h); @@ -1276,7 +1276,9 @@ rxvt_font_xft::draw (rxvt_drawable &d, int x, int y, int w = term->fwidth * len; int h = term->fheight; - bool buffered = false; + bool buffered = !term->am_transparent // we aren't transparent + || term->am_pixmap_trans // we have a pixmap + || bg >= 0; // we don't use a transparent bg // cut trailing spaces while (len && text [len - 1] == ' ') @@ -1317,7 +1319,27 @@ rxvt_font_xft::draw (rxvt_drawable &d, int x, int y, { rxvt_drawable &d2 = d.screen->scratch_drawable (w, h); - XftDrawRect (d2, &term->pix_colors[bg].c, 0, 0, w, h); + if (bg < 0 && term->am_pixmap_trans) + XCopyArea (disp, term->pixmap, d2, gc, x, y, w, h, 0, 0); + else if (bg < 0 && term->bgPixmap.pixmap) + { + XGCValues gcv; + + gcv.fill_style = FillTiled; + gcv.tile = term->pixmap; + gcv.ts_x_origin = -x; + gcv.ts_y_origin = -y; + + GC gc2 = XCreateGC (disp, d2, + GCTile | GCTileStipXOrigin | GCTileStipYOrigin | GCFillStyle, + &gcv); + + XFillRectangle (disp, d2, gc2, 0, 0, w, h); + + XFreeGC (disp, gc2); + } + else + XftDrawRect (d2, &term->pix_colors[bg].c, 0, 0, w, h); XftDrawGlyphSpec (d2, &term->pix_colors[fg].c, f, enc, ep - enc); XCopyArea (disp, d2, d, gc, 0, 0, w, h, x, y); diff --git a/src/screen.C b/src/screen.C index 89c8da42..66fc25c7 100644 --- a/src/screen.C +++ b/src/screen.C @@ -1971,7 +1971,7 @@ rxvt_term::scr_printscreen (int fullhist) NOTHROW void rxvt_term::scr_refresh () NOTHROW { - unsigned char must_clear, /* use draw_string not draw_image_string */ + unsigned char have_bg, showcursor; /* show the cursor */ int16_t col, row, /* column/row we're processing */ ocrow; /* old cursor row */ @@ -1989,14 +1989,14 @@ rxvt_term::scr_refresh () NOTHROW /* * A: set up vars */ - must_clear = 0; + have_bg = 0; refresh_count = 0; #if XPM_BACKGROUND - must_clear |= bgPixmap.pixmap != None; + have_bg |= bgPixmap.pixmap != None; #endif #if TRANSPARENT - must_clear |= OPTION (Opt_transparent) && am_transparent; + have_bg |= OPTION (Opt_transparent) && am_transparent; #endif ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ @@ -2105,7 +2105,7 @@ rxvt_term::scr_refresh () NOTHROW */ if (!display->is_local && refresh_type == FAST_REFRESH && num_scr_allow && num_scr - && abs (num_scr) < nrow && !must_clear) + && abs (num_scr) < nrow && !have_bg) { int16_t nits; int j; @@ -2151,11 +2151,16 @@ rxvt_term::scr_refresh () NOTHROW if (wlen < len) ::swap (wlen, len); + XGCValues gcv; + + gcv.graphics_exposures = 1; XChangeGC (dpy, gc, GCGraphicsExposures, &gcv); XCopyArea (dpy, vt, vt, gc, 0, Row2Pixel (len + i), (unsigned int)this->width, (unsigned int)Height2Pixel (wlen - len + 1), 0, Row2Pixel (len)); + gcv.graphics_exposures = 0; XChangeGC (dpy, gc, GCGraphicsExposures, &gcv); + len = -1; } } @@ -2221,14 +2226,14 @@ rxvt_term::scr_refresh () NOTHROW if (stp[col] != dtp[col] || !RS_SAME (srp[col], drp[col])) { - if (must_clear && (i++ > count / 2)) + if (have_bg && (i++ > count / 2)) break; dtp[col] = stp[col]; drp[col] = rend; i = 0; } - else if (must_clear || (stp[col] != ' ' && ++i >= 16)) + else if (have_bg || (stp[col] != ' ' && ++i >= 16)) break; } @@ -2332,21 +2337,19 @@ rxvt_term::scr_refresh () NOTHROW if (back == fore) font->clear_rect (*drawable, xpixel, ypixel, fwidth * count, fheight, back); - else if (back == Color_bg) + else if (back == Color_bg && have_bg) { - if (must_clear) - { - CLEAR_CHARS (xpixel, ypixel, count); - - for (i = 0; i < count; i++) /* don't draw empty strings */ - if (text[i] != ' ') - { - font->draw (*drawable, xpixel, ypixel, text, count, fore, -1); - break; - } - } - else - font->draw (*drawable, xpixel, ypixel, text, count, fore, Color_bg); + // this is very ugly, maybe push it into ->draw? + + for (i = 0; i < count; i++) /* don't draw empty strings */ + if (text[i] != ' ') + { + font->draw (*drawable, xpixel, ypixel, text, count, fore, -1); + goto did_clear; + } + + CLEAR_CHARS (xpixel, ypixel, count); + did_clear: ; } else font->draw (*drawable, xpixel, ypixel, text, count, fore, back); diff --git a/src/xpm.C b/src/xpm.C index 4366467c..43236c1f 100644 --- a/src/xpm.C +++ b/src/xpm.C @@ -260,12 +260,6 @@ rxvt_term::resize_pixmap () XSetWindowBackgroundPixmap (dpy, vt, pixmap); - if (pixmap != None) - { - XFreePixmap (dpy, pixmap); - pixmap = None; - } - XFreeGC (dpy, gc); am_transparent = 0; } -- 2.34.1