*** empty log message ***
authorroot <root>
Tue, 4 Nov 2008 13:20:40 +0000 (13:20 +0000)
committerroot <root>
Tue, 4 Nov 2008 13:20:40 +0000 (13:20 +0000)
Changes
src/background.C
src/background.h
src/init.C
src/rxvt.h

diff --git a/Changes b/Changes
index 6c9e93ea2ff71f40d43574df7b55e541a21f00b1..fd7dfdc9e0f918069f6abb988712e7e830b4866c 100644 (file)
--- a/Changes
+++ b/Changes
@@ -38,6 +38,7 @@ TODO: cursor over overlays, when focus change?
         - try to work around linux first breaking sched_yield and now breaking
           the only known workaround.
         - new option -icon, resource iconFile (based on patch by Frank Schmitt).
+        - intiialise the as visual only on demand, instead of unconditionally.
 
 9.05 Sun Jun 15 20:09:20 CEST 2008
        - new option --cd/chdir to set the starting working directory.
index ccd11bfad979093d3ad597a0a96530a8aed0657a..c60a32b0506f703d805f9cff2dd1f4e09e1362dc 100644 (file)
@@ -3,7 +3,7 @@
  *----------------------------------------------------------------------*
  *
  * All portions of code are copyright by their respective author/s.
- * Copyright (c) 2005-2006 Marc Lehmann <pcg@goof.com>
+ * Copyright (c) 2005-2008 Marc Lehmann <pcg@goof.com>
  * Copyright (c) 2007      Sasha Vasko <sasha@aftercode.net>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -451,10 +451,14 @@ bgPixmap_t::render_asim (ASImage *background, ARGB32 background_tint)
   if (target == NULL)
     return false;
 
-  int target_width = (int)target->szHint.width;
-  int target_height = (int)target->szHint.height;
-  int new_pmap_width = target_width, new_pmap_height = target_height;
-  ASImage *result = NULL;
+  target->init_asv ();
+
+  ASImage *result = 0;
+
+  int target_width    = target->szHint.width;
+  int target_height   = target->szHint.height;
+  int new_pmap_width  = target_width;
+  int new_pmap_height = target_height;
 
   int x = 0;
   int y = 0;
@@ -665,19 +669,15 @@ bgPixmap_t::render_asim (ASImage *background, ARGB32 background_tint)
 bool
 bgPixmap_t::set_file (const char *file)
 {
-  char *f;
-
   assert (file);
 
   if (*file)
     {
 #  ifdef HAVE_AFTERIMAGE
-      if (target->asimman == NULL)
+      if (!target->asimman)
         target->asimman = create_generic_imageman (target->rs[Rs_path]);
 
-      if ((f = strchr (file, ';')) == NULL)
-        original_asim = get_asimage (target->asimman, file, 0xFFFFFFFF, 100);
-      else
+      if (char *f = strchr (file, ';'))
         {
           size_t len = f - file;
           f = (char *)malloc (len + 1);
@@ -686,6 +686,8 @@ bgPixmap_t::set_file (const char *file)
           original_asim = get_asimage (target->asimman, f, 0xFFFFFFFF, 100);
           free (f);
         }
+      else
+        original_asim = get_asimage (target->asimman, file, 0xFFFFFFFF, 100);
 
       return original_asim;
 #  endif
@@ -1119,9 +1121,11 @@ bgPixmap_t::render ()
   if (target == NULL)
     return false;
 
+  target->init_asv ();
+
   TIMING_TEST_START (tp);
 
-  invalidate();
+  invalidate ();
 # ifdef ENABLE_TRANSPARENCY
   if (flags & isTransparent)
     {
@@ -1143,7 +1147,7 @@ bgPixmap_t::render ()
       ASImage *background = NULL;
       ARGB32 as_tint = TINT_LEAVE_SAME;
       if (background_flags)
-          background = pixmap2ximage (target->asv, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, 100);
+        background = pixmap2ximage (target->asv, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, 100);
 
 #  ifdef ENABLE_TRANSPARENCY
       if (!(background_flags & transpPmapTinted) && (flags & tintNeeded))
@@ -1160,6 +1164,7 @@ bgPixmap_t::render ()
 
           as_tint = shading2tint32 (&as_shade);
         }
+
       if (!(background_flags & transpPmapBlured) && (flags & blurNeeded) && background != NULL)
         {
           ASImage* tmp = blur_asimage_gauss (target->asv, background, h_blurRadius, v_blurRadius, 0xFFFFFFFF,
@@ -1176,12 +1181,10 @@ bgPixmap_t::render ()
       if (render_asim (background, as_tint))
         flags = flags & ~isInvalid;
       if (background)
-          destroy_asimage (&background);
+        destroy_asimage (&background);
     }
   else if (background_flags && pmap_depth != target->depth)
-    {
-      result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap);
-    }
+    result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap);
 
 # elif !XFT /* our own client-side tinting */
 
@@ -1191,6 +1194,7 @@ bgPixmap_t::render ()
   if (background_flags && (flags & isInvalid))
     {
       result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap);
+
       if (result != NULL && !(background_flags & transpPmapTinted) && (flags & tintNeeded))
         {
           rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC);
@@ -1275,6 +1279,7 @@ bgPixmap_t::set_target (rxvt_term *new_target)
 # endif
         return true;
       }
+
   return false;
 }
 
index 431afee8ae0f91a3f2fdae58f360fb25453a80b7..9b6a0b2374f5dca3c5e51920726733db2c5080b5 100644 (file)
@@ -19,35 +19,41 @@ struct bgPixmap_t
   void destroy ();
 
   enum {
-    geometrySet     = (1UL<<0),
-    propScale       = (1UL<<1),
-    geometryFlags   = (geometrySet|propScale),
-
-    tintSet         = (1UL<<8),
-    tintNeeded      = (1UL<<9),
-    tintWholesome   = (1UL<<10),
-    tintServerSide  = (1UL<<11),
-    tintFlags       = (tintSet|tintServerSide|tintNeeded|tintWholesome),
-    blurNeeded      = (1UL<<12),
-    blurServerSide  = (1UL<<13), /* this doesn't work yet */
-
-    isTransparent   = (1UL<<16),
-    isInvalid       = (1UL<<17),
-    isVtOrigin      = (1UL<<18),  /* if set pixmap has origin at corner of
-                                     vt window instead of parent[0]! */
-    hasChanged      = (1UL<<19)
+    geometrySet     = 1 <<  0,
+    propScale       = 1 <<  1,
+    geometryFlags   = geometrySet | propScale,
+
+    tintSet         = 1 <<  8,
+    tintNeeded      = 1 <<  9,
+    tintWholesome   = 1 << 10,
+    tintServerSide  = 1 << 11,
+    tintFlags       = tintSet | tintServerSide | tintNeeded | tintWholesome,
+
+    blurNeeded      = 1 << 12,
+    blurServerSide  = 1 << 13, /* this doesn't work yet */
+
+    isTransparent   = 1 << 16,
+    isInvalid       = 1 << 17,
+    isVtOrigin      = 1 << 18,  /* if set pixmap has origin at corner of
+                                   vt window instead of parent[0]! */
+    hasChanged      = 1 << 19,
   };
 
-  unsigned long flags;
+  unsigned int flags;
 
   enum {
-    transpPmapTiled = (1UL<<0),
-    transpPmapTinted = tintNeeded,
-    transpPmapBlured = blurNeeded,
-    transpTransformations = (tintNeeded|blurNeeded)
+    transpPmapTiled       = 1 << 0,
+    transpPmapTinted      = tintNeeded,
+    transpPmapBlured      = blurNeeded,
+    transpTransformations = tintNeeded | blurNeeded,
   }; /* these flags are returned by make_transparency_pixmap if called */
 
-  bool check_clearChanged () { bool r = flags & hasChanged; flags &= ~hasChanged; return r; };
+  bool check_clearChanged ()
+  {
+    bool r = flags & hasChanged;
+    flags &= ~hasChanged;
+    return r;
+  };
 
 # ifdef  BG_IMAGE_FROM_FILE
 #  ifdef HAVE_AFTERIMAGE
@@ -67,7 +73,10 @@ struct bgPixmap_t
   unsigned int h_scale, v_scale;/* percents of the window size */
   int h_align, v_align;         /* percents of the window size:
                                   0 - left align, 50 - center, 100 - right */
-  void unset_geometry () { flags = flags & ~geometryFlags; };
+  void unset_geometry ()
+  {
+    flags = flags & ~geometryFlags;
+  };
   bool set_geometry (const char *geom);
   void set_defaultGeometry ()
   {
index e781623e9a8fd412528cfe3a00b4c82948093fe5..0a9040e3493628f1a03cad9998bb457257ee41d1 100644 (file)
@@ -394,17 +394,17 @@ rxvt_term::init_resources (int argc, const char *const *argv)
     select_visual (strtol (rs[Rs_depth], 0, 0));
 #endif
 
-#ifdef HAVE_AFTERIMAGE
-  set_application_name ((char*)rs[Rs_name]);
-  set_output_threshold (OUTPUT_LEVEL_WARNING);
-  asv = create_asvisual_for_id (dpy, display->screen, depth, XVisualIDFromVisual (visual), cmap, NULL);
-#endif
   free (r_argv);
 
   for (int i = NUM_RESOURCES; i--; )
     if (rs [i] == resval_undef)
       rs [i] = 0;
 
+#ifdef HAVE_AFTERIMAGE
+  set_application_name ((char *)rs[Rs_name]);
+  set_output_threshold (OUTPUT_LEVEL_WARNING);
+#endif
+
 #if ENABLE_PERL
   if (!rs[Rs_perl_ext_1])
     rs[Rs_perl_ext_1] = "default";
@@ -425,6 +425,7 @@ rxvt_term::init_resources (int argc, const char *const *argv)
     {
       if (!rs[Rs_title])
         rs[Rs_title] = rxvt_basename (cmd_argv[0]);
+
       if (!rs[Rs_iconName])
         rs[Rs_iconName] = rs[Rs_title];
     }
@@ -432,6 +433,7 @@ rxvt_term::init_resources (int argc, const char *const *argv)
     {
       if (!rs[Rs_title])
         rs[Rs_title] = rs[Rs_name];
+
       if (!rs[Rs_iconName])
         rs[Rs_iconName] = rs[Rs_name];
     }
@@ -1143,10 +1145,13 @@ rxvt_term::create_windows (int argc, const char *const *argv)
    * set up icon hint
    * rs [Rs_iconfile] is path to icon, asv has been created in init_resources
    */
-  if (rs [Rs_iconfile] && asv)
+
+  if (rs [Rs_iconfile])
     {
+      init_asv ();
+
       ASImage *im = file2ASImage (rs [Rs_iconfile], 0xFFFFFFFF, SCREEN_GAMMA, 0, NULL);
-      if (im)
+      if (asv && im)
         {
           int w = im->width;
           int h = im->height;
@@ -1167,7 +1172,7 @@ rxvt_term::create_windows (int argc, const char *const *argv)
 
               destroy_asimage (&result);
               XChangeProperty (dpy, top, xa[XA_NET_WM_ICON], XA_CARDINAL, 32,
-                              PropModeReplace, (const unsigned char*) buffer, 2 + w * h);
+                               PropModeReplace, (const unsigned char*) buffer, 2 + w * h);
               free (buffer);
             }
           else
index ce8b3fbc8c2301dbf5e0ab999c738f3a0a150c9b..0b14b9b138f7ac8100aedf35ac8ed21019a50746 100644 (file)
@@ -1029,6 +1029,12 @@ struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen {
 #ifdef HAVE_AFTERIMAGE
   ASVisual       *asv;
   ASImageManager *asimman;
+
+  void init_asv ()
+  {
+    if (!asv)
+      asv = create_asvisual_for_id (dpy, display->screen, depth, XVisualIDFromVisual (visual), cmap, NULL);
+  }
 #endif
 
 #if ENABLE_OVERLAY