iconfile patch
authorroot <root>
Tue, 4 Nov 2008 11:03:28 +0000 (11:03 +0000)
committerroot <root>
Tue, 4 Nov 2008 11:03:28 +0000 (11:03 +0000)
Changes
doc/rxvt.1.pod
src/init.C
src/rsinc.h
src/rxvttoolkit.C
src/rxvttoolkit.h
src/xdefaults.C

diff --git a/Changes b/Changes
index 888377aa17862e13e18f1a78cc67f869429ea847..6c9e93ea2ff71f40d43574df7b55e541a21f00b1 100644 (file)
--- a/Changes
+++ b/Changes
@@ -37,6 +37,7 @@ TODO: cursor over overlays, when focus change?
           monopolising the whole process by outputting a lot of text.
         - 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).
 
 9.05 Sun Jun 15 20:09:20 CEST 2008
        - new option --cd/chdir to set the starting working directory.
index 6abc73f422e5420c7ad6cfd5ab0e3030208e54d4..563d22835dadbc50ad2ac39f72a80b347ea64d9a 100644 (file)
@@ -184,6 +184,12 @@ radii to 1 and another to a large number creates interesting effects
 on some backgrounds. Maximum radius value is 128. Compile I<afterimage>;
 resource I<blurRadius>.
 
+=item B<-icon> I<file>
+
+Compile I<afterimage>: Use the specified image as application icon. This
+is used by many window managers, taskbars and pagers to represent the
+appliation window; resource I<iconFile>.
+
 =item B<-bg> I<colour>
 
 Window background colour; resource B<background>.
@@ -715,9 +721,13 @@ Specify background blending type; option B<-blt>.
 
 =item B<blurRadius:> I<number>
 
-Apply Gaussian Blurr with the specified radius to the transparent
+Apply gaussian blur with the specified radius to the transparent
 background image; option B<-blr>.
 
+=item B<iconFile:> I<file>
+
+Set the application icon pixmap; option B<-icon>.
+
 =item B<scrollColor:> I<colour>
 
 Use the specified colour for the scrollbar [default #B2B2B2].
index ace90f42251f707882083ed2ae4dea85a44e7b5e..e781623e9a8fd412528cfe3a00b4c82948093fe5 100644 (file)
@@ -1137,6 +1137,53 @@ rxvt_term::create_windows (int argc, const char *const *argv)
 
   XmbSetWMProperties (dpy, top, NULL, NULL, (char **)argv, argc,
                       &szHint, &wmHint, &classHint);
+#if ENABLE_EWMH 
+# ifdef HAVE_AFTERIMAGE
+  /*
+   * set up icon hint
+   * rs [Rs_iconfile] is path to icon, asv has been created in init_resources
+   */
+  if (rs [Rs_iconfile] && asv)
+    {
+      ASImage *im = file2ASImage (rs [Rs_iconfile], 0xFFFFFFFF, SCREEN_GAMMA, 0, NULL);
+      if (im)
+        {
+          int w = im->width;
+          int h = im->height;
+          long* buffer = (long *)malloc ((2 + w * h) * sizeof (long));
+          ASImage *result = scale_asimage (asv, im,
+                                           w, h, ASA_ARGB32,
+                                           100, ASIMAGE_QUALITY_DEFAULT);
+          destroy_asimage (&im);
+
+          if (buffer && result)
+            {
+              ARGB32 *asbuf = result->alt.argb32;
+              buffer [0] = w;
+              buffer [1] = h;
+
+              for (unsigned int i = 0; i < w * h; ++i)
+                buffer [i + 2] = asbuf [i];
+
+              destroy_asimage (&result);
+              XChangeProperty (dpy, top, xa[XA_NET_WM_ICON], XA_CARDINAL, 32,
+                              PropModeReplace, (const unsigned char*) buffer, 2 + w * h);
+              free (buffer);
+            }
+          else
+            {
+              if (!buffer)
+                rxvt_warn ("Memory allocation for icon hint failed, continuing without.\n");
+
+              if (!result)
+                rxvt_warn ("Icon image transformation to ARGB failed, continuing without.\n");
+            }
+        }
+      else
+        rxvt_warn ("Loading image icon failed, continuing without.\n");
+    }
+# endif
+#endif
 
 #if ENABLE_FRILLS
   if (mwmhints.flags)
index 45aa5944bf36018a1f4434080859c3f8dae4113e..903a77163de7bf00ef4a9ccffdf3753851c61317 100644 (file)
 #ifdef HAVE_AFTERIMAGE
   def (blendtype)
   def (blurradius)
+  def (iconfile)
 #endif
index 103c58df1fe28afa3a60f19c0dd62273c8a4f719..5110a818feef173bc56c6e1df35186559ee83e83 100644 (file)
@@ -61,6 +61,7 @@ const char *const xa_names[] =
   "_NET_WM_NAME",
   "_NET_WM_ICON_NAME",
   "_NET_WM_PING",
+  "_NET_WM_ICON",
 #endif
 #if USE_XIM
   "WM_LOCALE_NAME",
index d009a9db8a3e329939d188af88b6f0dc8ba7d67e..7b5ff29b313426df9fd58fecc817e9f358b4a7dc 100644 (file)
@@ -61,6 +61,7 @@ enum {
   XA_NET_WM_NAME,
   XA_NET_WM_ICON_NAME,
   XA_NET_WM_PING,
+  XA_NET_WM_ICON,
 #endif
 #if USE_XIM
   XA_WM_LOCALE_NAME,
index c861f858251e7abb8b881cb3bf27c66194233f2b..1b654c5c1bf2216c7a13d90868e03e8dced5f85d 100644 (file)
@@ -263,7 +263,10 @@ optList[] = {
 #endif
 #ifdef HAVE_AFTERIMAGE
               STRG (Rs_blendtype, "blendType", "blt", "string", "background image blending type - alpha, tint, etc..."),
-              STRG (Rs_blurradius, "blurRadius", "blr", "HxV", "Gaussian Blur radii to apply to the root background"),
+              STRG (Rs_blurradius, "blurRadius", "blr", "HxV", "gaussian blur radii to apply to the root background"),
+# if ENABLE_EWMH
+              STRG (Rs_iconfile, "iconFile", "icon", "file", "path to aplication icon image"),
+# endif
 #endif
               INFO ("e", "command arg ...", "command to execute")
             };