Fixed bug in xft_font::draw introduced earlier where background color #0 would not...
authorsasha <sasha>
Mon, 20 Aug 2007 20:13:35 +0000 (20:13 +0000)
committersasha <sasha>
Mon, 20 Aug 2007 20:13:35 +0000 (20:13 +0000)
src/main.C
src/rxvtfont.C

index 8393b6c255a4e726c0f1fa7969dadceeb308eea8..a97851a753212d58d10227c052668525b82cdaa2 100644 (file)
@@ -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
index 223a5f17bae67514ef995711fe4203eea081c686..898776629ea4c5a4413700a57030969942c09c2c 100644 (file)
@@ -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);