--- rxvt-unicode/src/background.C 2010/10/04 20:46:20 1.66 +++ rxvt-unicode/src/background.C 2010/10/05 20:22:25 1.70 @@ -460,6 +460,9 @@ h = v_scale * target_height / 100; } + if (!w) w = image_width; + if (!h) h = image_height; + if (flags & rootAlign) { target->get_window_origin (x, y); @@ -468,14 +471,14 @@ } else { - x = make_align_position (h_align, target_width, w > 0 ? w : image_width); - y = make_align_position (v_align, target_height, h > 0 ? h : image_height); + x = make_align_position (h_align, target_width, w); + y = make_align_position (v_align, target_height, h); } flags &= ~sizeSensitive; if (h_scale != 0 || v_scale != 0 || h_align != 0 || v_align != 0 - || image_width > target_width || image_height > target_height) + || w > target_width || h > target_height) flags |= sizeSensitive; } @@ -541,10 +544,11 @@ get_image_geometry (original_asim->width, original_asim->height, w, h, x, y); if (!original_asim - || x >= target_width - || y >= target_height - || (w > 0 && x + w <= 0) - || (h > 0 && y + h <= 0)) + || (!(flags & rootAlign) + && (x >= target_width + || y >= target_height + || (x + w <= 0) + || (y + h <= 0)))) { if (background) { @@ -568,12 +572,11 @@ { result = original_asim; - if ((w > 0 && w != original_asim->width) - || (h > 0 && h != original_asim->height)) + if ((w != original_asim->width) + || (h != original_asim->height)) { result = scale_asimage (target->asv, original_asim, - w > 0 ? w : original_asim->width, - h > 0 ? h : original_asim->height, + w, h, background ? ASA_ASImage : ASA_XImage, 100, ASIMAGE_QUALITY_DEFAULT); } @@ -761,20 +764,20 @@ get_image_geometry (image_width, image_height, w, h, x, y); - if (x >= target_width - || y >= target_height - || (w > 0 && x + w <= 0) - || (h > 0 && y + h <= 0)) + if (!(flags & rootAlign) + && (x >= target_width + || y >= target_height + || (x + w <= 0) + || (y + h <= 0))) return false; result = pixbuf; - if ((w > 0 && w != image_width) - || (h > 0 && h != image_height)) + if ((w != image_width) + || (h != image_height)) { result = gdk_pixbuf_scale_simple (pixbuf, - w > 0 ? w : image_width, - h > 0 ? h : image_height, + w, h, GDK_INTERP_BILINEAR); } @@ -1047,12 +1050,9 @@ } bool -bgPixmap_t::tint_pixmap (Pixmap pixmap) +bgPixmap_t::tint_pixmap (Pixmap pixmap, Window root, int width, int height) { - Window root = target->display->root; Display *dpy = target->dpy; - int window_width = target->szHint.width; - int window_height = target->szHint.height; bool ret = false; if (flags & tintWholesome) @@ -1069,7 +1069,7 @@ gc = XCreateGC (dpy, root, GCFillStyle | GCForeground | GCFunction, &gcv); if (gc) { - XFillRectangle (dpy, pixmap, gc, 0, 0, window_width, window_height); + XFillRectangle (dpy, pixmap, gc, 0, 0, width, height); ret = true; XFreeGC (dpy, gc); } @@ -1141,7 +1141,7 @@ mask_c.green = 0xffff - c.g; mask_c.blue = 0xffff - c.b; XRenderFillRectangle (dpy, PictOpSrc, mask_pic, &mask_c, 0, 0, 1, 1); - XRenderComposite (dpy, PictOpOver, overlay_pic, mask_pic, back_pic, 0, 0, 0, 0, 0, 0, window_width, window_height); + XRenderComposite (dpy, PictOpOver, overlay_pic, mask_pic, back_pic, 0, 0, 0, 0, 0, 0, width, height); ret = true; } @@ -1294,7 +1294,7 @@ { if ((flags & tintNeeded)) { - if (tint_pixmap (tiled_root_pmap)) + if (tint_pixmap (tiled_root_pmap, root, window_width, window_height)) result |= transpPmapTinted; } } /* server side rendering completed */