--- rxvt-unicode/src/xpm.C 2006/08/18 23:03:31 1.35 +++ rxvt-unicode/src/xpm.C 2007/06/08 20:04:12 1.38 @@ -85,7 +85,20 @@ strncpy (str, geom, n); str[n] = '\0'; - flags = XParseGeometry (str, &x, &y, &w, &h); + if (strcmp(str, "auto") == 0) + { + if (!bgpixmap->auto_resize) + changed++; + bgpixmap->auto_resize = True ; + w = szHint.width ; + h = szHint.height ; + flags = WidthValue|HeightValue ; + } + else + { + bgpixmap->auto_resize = False ; + flags = XParseGeometry (str, &x, &y, &w, &h); + } if (!flags) { @@ -171,13 +184,18 @@ GC gc; if (pixmap != None) - XFreePixmap (dpy, pixmap); + { + XFreePixmap (dpy, pixmap); + pixmap = None ; + } if (bgPixmap.pixmap == None) { /* So be it: I'm not using pixmaps */ pixmap = None; - if (!OPTION (Opt_transparent) || !am_transparent) +#ifdef TRANSPARENT + if (!option (Opt_transparent) || !am_transparent) +#endif XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); return; @@ -193,6 +211,11 @@ unsigned int xpmh = xpmAttr.height, xpmw = xpmAttr.width; + if (bgPixmap.auto_resize) + { + w = szHint.width ; + h = szHint.height ; + } /* * don't zoom pixmap too much nor expand really small pixmaps */ @@ -213,6 +236,20 @@ XCopyArea (dpy, bgPixmap.pixmap, pixmap, gc, 0, 0, x, y, xpmw - x, xpmh - y); } else +#ifdef HAVE_AFTERIMAGE +#ifdef TRANSPARENT + if (!option(Opt_transparent) || !am_transparent) + /* will do that in check_our_parents otherwise */ +#endif + { + ASImage *scaled_im = scale_asimage( display->asv, original_asim, w, h, ASA_XImage, 0, ASIMAGE_QUALITY_DEFAULT ); + if (scaled_im) + { + pixmap = asimage2pixmap( display->asv, display->root, scaled_im, gc, True ); + destroy_asimage( &scaled_im ); + } + } +#else /* HAVE_AFTERIMAGE */ { float incr, p; Pixmap tmp; @@ -257,12 +294,15 @@ XFreePixmap (dpy, tmp); } +#endif /* HAVE_AFTERIMAGE */ } XSetWindowBackgroundPixmap (dpy, vt, pixmap); XFreeGC (dpy, gc); +#ifdef TRANSPARENT am_transparent = 0; +#endif } /* @@ -365,6 +405,24 @@ */ /* XGetWindowAttributes (dpy, vt, &attr); */ +#ifdef HAVE_AFTERIMAGE + if (asimman == NULL) + asimman = create_generic_imageman(rs[Rs_path]); + if ((f = strchr (file, ';')) == NULL) + original_asim = get_asimage( asimman, file, 0xFFFFFFFF, 100 ); + else + { + f = strndup( file, f - file ); + original_asim = get_asimage( asimman, f, 0xFFFFFFFF, 100 ); + free( f ); + } + if (original_asim) + { + bgPixmap.pixmap = asimage2pixmap( display->asv, display->root, original_asim, NULL, True ); + xpmAttr.width = original_asim->width ; + xpmAttr.height = original_asim->height ; + } +#else /* HAVE_AFTERIMAGE */ xpmAttr.closeness = 30000; xpmAttr.colormap = cmap; xpmAttr.visual = visual; @@ -387,8 +445,8 @@ rxvt_warn ("couldn't load XPM file \"%.*s\", ignoring.\n", (p - file), file); } - free (f); +#endif /* HAVE_AFTERIMAGE */ } resize_pixmap ();