Fixed libAfterImage support when multiple displays are used. Added documentation...
authorsasha <sasha>
Thu, 12 Jul 2007 22:33:16 +0000 (22:33 +0000)
committersasha <sasha>
Thu, 12 Jul 2007 22:33:16 +0000 (22:33 +0000)
doc/rxvt.7.pod
src/init.C
src/rxvt.h
src/rxvttoolkit.C
src/rxvttoolkit.h
src/xpm.C

index bc8598af03d462b941cd661361145df4b5da14a9..e74c8c9571b1cd9e059ebe7062c13b85dea3bfbe 100644 (file)
@@ -2331,6 +2331,20 @@ F<lastlogin>) at start of rxvt execution.  This option requires
 
 Add support for XPM background pixmaps.
 
+=item --enable-afterimage (default: on)
+
+Add support for libAfterImage to be used for transparency and
+background pixmaps from many file formats.
+Supported formats include JPG, PNG, GIF, XPM, BMP, ICO, XCF,
+TGA and AfterStep image XML.
+It relies on external libraries for reading images in TIFF
+and SVG formats. This option also adds such eye candy as
+blending pixmap over root background, scaling and bluring of
+background pixmaps. Beware that with tis option enabled rxvt's
+memory footprint will increase by anywhere between 750KBytes to 3 MB.
+Memory footprint may somewhat be lowered if libAfterImage is
+configured without support for SVG.
+
 =item --enable-transparency (default: on)
 
 Add support for inheriting parent backgrounds thus giving a fake
@@ -2473,6 +2487,10 @@ in, perl will I<not> be initialised when all extensions have been disabled
 C<-pe "" --perl-ext-common "">, so it should be safe to enable from a
 resource standpoint.
 
+=item --with-afterimage-config=DIR
+
+Look for the libAfterImage config script in DIR.
+
 =item --with-name=NAME (default: urxvt)
 
 Set the basename for the installed binaries, resulting
index cda0bd7ec63d0b3b9a7ad2e94cceeb155b864195..454e90d2afe35cbb95ed64d04fc0c4c87b1d5a76 100644 (file)
@@ -318,6 +318,10 @@ rxvt_term::init_resources (int argc, const char *const *argv)
     select_visual (strtol (rs[Rs_depth], 0, 0));
 #endif
 
+#ifdef HAVE_AFTERIMAGE
+  ::dpy = NULL ; /* init global var from libAfter... */
+  asv = AFTERIMAGE_DPY_OP(create_asvisual_for_id (dpy, display->screen, depth, XVisualIDFromVisual (visual), cmap, NULL));
+#endif
   free (r_argv);
 
   for (int i = NUM_RESOURCES; i--; )
index 90d6fd2d67e3daaa0b93f44cdda1b159b1857ede..8289e04bb3455bf4fd8c3a63569379f4d921e175 100644 (file)
@@ -1022,6 +1022,10 @@ struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen {
 #ifdef XPM_BACKGROUND
   bgPixmap_t      bgPixmap;
 #ifdef HAVE_AFTERIMAGE  
+  struct ASVisual  *asv;
+  /* to get libAfterImage to work with multiple displays we use that hack :  */
+  /* should not need that with libAfterImage  version >= 1.15 */
+#define AFTERIMAGE_DPY_OP(_op)  ({::dpy = dpy; _op;})
   ASImageManager *asimman;
   ASImage        *original_asim;
   struct { unsigned int width, height; } xpmAttr; /* all we need is width/height */
index 16ec56fabbc9d66bce7f0341ea6269c916fc7d76..3e9965b5ddd4df37b88661c6057008368c2a962f 100644 (file)
@@ -445,12 +445,6 @@ bool rxvt_display::ref_init ()
   screen = DefaultScreen     (dpy);
   root   = DefaultRootWindow (dpy);
 
-#ifdef HAVE_AFTERIMAGE
-  ::dpy = dpy; /* init global var from libAfter... */
-  asv = create_asvisual_for_id (dpy, screen, DefaultDepth (dpy,screen),
-                                XVisualIDFromVisual (DefaultVisual (dpy, screen)), None, NULL);
-#endif
-
   assert (sizeof (xa_names) / sizeof (char *) == NUM_XA);
   XInternAtoms (dpy, (char **)xa_names, NUM_XA, False, xa);
 
index bca0a1345a44850d31db54057e85edacc9503e71..c7bae0f038827d6504d4137d5339ebb7b381bf0e 100644 (file)
@@ -189,10 +189,6 @@ struct rxvt_screen {
   void clear ();
 };
 
-#ifdef HAVE_AFTERIMAGE  
-struct ASVisual;
-#endif
-
 struct rxvt_display : refcounted {
   io_manager_vec<xevent_watcher> xw;
 
@@ -210,9 +206,6 @@ struct rxvt_display : refcounted {
   Display   *dpy;
   int       screen;
   Window    root;
-#ifdef HAVE_AFTERIMAGE  
-  struct ASVisual  *asv;
-#endif
   rxvt_term *selection_owner;
   Atom      xa[NUM_XA];
   bool      is_local;
index 025ce5f57eb3a8a869f78f1f1532c280f03830bf..f2eaf1fccb6ef446d6d7457766398288ceadb04d 100644 (file)
--- a/src/xpm.C
+++ b/src/xpm.C
@@ -390,10 +390,10 @@ rxvt_term::resize_pixmap ()
       /* 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 );
+          ASImage *scaled_im = scale_asimage( asv, original_asim, w, h, ASA_XImage, 0, ASIMAGE_QUALITY_DEFAULT );
           if (scaled_im) 
             {
-              pixmap = asimage2pixmap( display->asv, display->root, scaled_im, gc, True );
+              pixmap = AFTERIMAGE_DPY_OP(asimage2pixmap( asv, display->root, scaled_im, gc, True ));
               destroy_asimage( &scaled_im );
             }
         }
@@ -493,7 +493,7 @@ rxvt_term::set_bgPixmap (const char *file)
         }
       if (original_asim)
         {
-          bgPixmap.pixmap = asimage2pixmap( display->asv, display->root, original_asim, NULL, True );
+          bgPixmap.pixmap = AFTERIMAGE_DPY_OP(asimage2pixmap( asv, display->root, original_asim, NULL, True ));
           xpmAttr.width = original_asim->width ; 
           xpmAttr.height = original_asim->height ; 
         }
@@ -903,7 +903,7 @@ rxvt_term::check_our_parents_cb (time_watcher &w)
                 MAKE_ROOTPMAP_GEOM(x,w,width);
                 MAKE_ROOTPMAP_GEOM(y,h,height);
 
-                layers[0].im = pixmap2asimage (display->asv, rootpixmap, back_x, back_y, back_w, back_h, AllPlanes, ASA_ASImage, 100);
+                layers[0].im = AFTERIMAGE_DPY_OP(pixmap2asimage (asv, rootpixmap, back_x, back_y, back_w, back_h, AllPlanes, ASA_ASImage, 100));
                 layers[0].clip_x = (back_w == pmap_w)?root_x:0;
                 layers[0].clip_y = (back_h == pmap_h)?root_y:0;
                 layers[0].clip_width = szHint.width;
@@ -912,7 +912,7 @@ rxvt_term::check_our_parents_cb (time_watcher &w)
                 if (rs[Rs_blurradius] && layers[0].im)
                   {
                     double r = atof(rs[Rs_blurradius]);
-                    ASImage* tmp = blur_asimage_gauss(display->asv, layers[0].im, r, r, 0xFFFFFFFF, ASA_ASImage, 100, ASIMAGE_QUALITY_DEFAULT );
+                    ASImage* tmp = blur_asimage_gauss(asv, layers[0].im, r, r, 0xFFFFFFFF, ASA_ASImage, 100, ASIMAGE_QUALITY_DEFAULT );
                     if( tmp )
                       {
                         destroy_asimage( &layers[0].im );
@@ -936,7 +936,7 @@ rxvt_term::check_our_parents_cb (time_watcher &w)
                     if (fore_w != original_asim->width
                         || fore_h != original_asim->height)
                       {
-                        layers[1].im = scale_asimage( display->asv,
+                        layers[1].im = scale_asimage( asv,
                                                       original_asim,
                                                       fore_w, fore_h,
                                                       ASA_ASImage, 100,
@@ -953,7 +953,7 @@ rxvt_term::check_our_parents_cb (time_watcher &w)
                           layers[1].merge_scanlines = alphablend_scanlines;
                       }
                   }                    
-                merged_im = merge_layers( display->asv, layers, layers[1].im?2:1,
+                merged_im = merge_layers( asv, layers, layers[1].im?2:1,
                                           szHint.width, szHint.height,
                                           ASA_XImage, 0, ASIMAGE_QUALITY_DEFAULT );
                 if (layers[1].im != original_asim)
@@ -961,7 +961,7 @@ rxvt_term::check_our_parents_cb (time_watcher &w)
                 destroy_asimage( &(layers[0].im) );
                 if (merged_im != NULL)
                   {
-                    tmp_pmap = asimage2pixmap( display->asv, DefaultRootWindow(dpy), merged_im, gc, True );
+                    tmp_pmap = AFTERIMAGE_DPY_OP(asimage2pixmap( asv, DefaultRootWindow(dpy), merged_im, gc, True ));
                     destroy_asimage( &merged_im );
                   }
                 free( layers );