From 2c81568ab54c41263f808b4be4d28c6843b737fb Mon Sep 17 00:00:00 2001 From: sasha Date: Mon, 20 Aug 2007 20:13:35 +0000 Subject: [PATCH] Fixed bug in xft_font::draw introduced earlier where background color #0 would not be rendered properly; Fixed bug where background pixmap would not get rendered on initial map if used without transparency --- src/main.C | 11 +++----- src/rxvtfont.C | 69 ++++++++++++++++++++++++++------------------------ 2 files changed, 39 insertions(+), 41 deletions(-) diff --git a/src/main.C b/src/main.C index 8393b6c2..a97851a7 100644 --- a/src/main.C +++ b/src/main.C @@ -542,14 +542,10 @@ rxvt_term::init (int argc, const char *const *argv, stringvec *envv) else bgPixmap.set_defaultGeometry (); - bgPixmap.set_file (rs[Rs_backgroundPixmap]); + if (bgPixmap.set_file (rs[Rs_backgroundPixmap])) + if (!option (Opt_transparent)) + update_background (); } - /* do not want to render Pixmap yet if we are size/position dependant - - * wait for ConfigureNotify at least - * TODO: this does not work for some reason when transparency is disabled !!!! - */ - if (!bgPixmap.window_size_sensitive ()) - update_background (); #endif } #endif @@ -1151,7 +1147,6 @@ rxvt_term::resize_all_windows (unsigned int newwidth, unsigned int newheight, in width, height); #ifdef XPM_BACKGROUND - /* TODO: replace with update_pixmap() that should unify transparency and bg image handling ! */ if (bgPixmap.window_size_sensitive ()) update_background (); #endif diff --git a/src/rxvtfont.C b/src/rxvtfont.C index 223a5f17..89877662 100644 --- a/src/rxvtfont.C +++ b/src/rxvtfont.C @@ -1324,54 +1324,57 @@ rxvt_font_xft::draw (rxvt_drawable &d, int x, int y, bool back_rendered = false; #ifdef HAVE_BG_PIXMAP - if (term->bgPixmap.pixmap && (bg < 0 || term->pix_colors[bg].c.color.alpha < 0x0ff00)) + if (term->bgPixmap.pixmap) { - if (term->bgPixmap.pmap_width >= x + term->window_vt_x+w - && term->bgPixmap.pmap_height >= y + term->window_vt_y+h) + Picture dst = 0; + if (bg >= 0 && term->pix_colors[bg].c.color.alpha < 0x0ff00) + dst = XftDrawPicture(d2); + + if (bg < 0 || dst != 0) { - XCopyArea (disp, term->bgPixmap.pixmap, d2, gc, - x + term->window_vt_x, y + term->window_vt_y, - w, h, 0, 0); - } - else - { - XGCValues gcv; + if (term->bgPixmap.pmap_width >= x + term->window_vt_x+w + && term->bgPixmap.pmap_height >= y + term->window_vt_y+h) + { + XCopyArea (disp, term->bgPixmap.pixmap, d2, gc, + x + term->window_vt_x, y + term->window_vt_y, + w, h, 0, 0); + } + else + { + XGCValues gcv; - gcv.fill_style = FillTiled; - gcv.tile = term->bgPixmap.pixmap; - gcv.ts_x_origin = -x; - gcv.ts_y_origin = -y; + gcv.fill_style = FillTiled; + gcv.tile = term->bgPixmap.pixmap; + gcv.ts_x_origin = -x; + gcv.ts_y_origin = -y; -#if 0 - GC gc2 = XCreateGC (disp, d2, - GCTile | GCTileStipXOrigin | GCTileStipYOrigin | GCFillStyle, - &gcv); -#endif - XChangeGC (disp, gc, - GCTile | GCTileStipXOrigin | GCTileStipYOrigin | GCFillStyle, - &gcv); + #if 0 + GC gc2 = XCreateGC (disp, d2, + GCTile | GCTileStipXOrigin | GCTileStipYOrigin | GCFillStyle, + &gcv); + #endif + XChangeGC (disp, gc, + GCTile | GCTileStipXOrigin | GCTileStipYOrigin | GCFillStyle, + &gcv); - XFillRectangle (disp, d2, gc/*gc2*/, 0, 0, w, h); + XFillRectangle (disp, d2, gc/*gc2*/, 0, 0, w, h); - gcv.fill_style = FillSolid; - XChangeGC (disp, gc, GCFillStyle, &gcv); - /* XFreeGC (disp, gc2); */ + gcv.fill_style = FillSolid; + XChangeGC (disp, gc, GCFillStyle, &gcv); + /* XFreeGC (disp, gc2); */ - } - if (bg > 0) - { - Picture dst = XftDrawPicture(d2); - if (dst != 0) + } + if (bg >= 0) { Picture solid_color_pict = XftDrawSrcPicture (d2, &term->pix_colors[bg].c); XRenderComposite (disp, PictOpOver, solid_color_pict, None, dst, 0, 0, 0, 0, 0, 0, w, h); } + back_rendered = true; } - back_rendered = true; } #endif - if(bg > 0 && !back_rendered) + if(bg >= 0 && !back_rendered) XftDrawRect (d2, &term->pix_colors[bg].c, 0, 0, w, h); XftDrawGlyphSpec (d2, &term->pix_colors[fg].c, f, enc, ep - enc); -- 2.34.1