Hello,

I tried to fix all issues you mentioned. Some comments below:

Marc Lehmann <[EMAIL PROTECTED]> writes:

> I just had basically a four hour talk about your patch, and here is the deal:
>
> - the code seems to be broken - _NET_WM_ICON expects cardinals, and thus
>   an array of longs, but you seem to pass in two int's followed by bytes?
>   you would need to fix this.
> - similarly, are you sure there isn't any endianness issue in the conversion?
>   does it really work on big-endian systems?
> - fix the coding style to be the same as the rest of the code (especially
>   the indentation which is weird, but also curly braces and
>   whitespace).

All this should be OK now.

> - make sure you set the property before urxvt maps the window (this seems
>   to be the case already).

Should be fine. My code is in create_windows(), this is called in the
middle of init() while the windows are mapped at the end of init().

> - you don't seem to free the created asvisual anywhere, bug?

I removed the call to create_asvisual and used the object already
created in init_resources instead. However it seems, the one created
init_resources isn't freed, too.

> - make it dependent on ENABLE_FRILLS

Done.

> - add the neccessary documentation (rxvt.1.pod)

I have a terse documentation for the resource and a slightly longer for
the option as this seems to be the standard, I hope this is ok.

If there are more issues with the reworked patch, just tell me.

Yours,
Frank

-- 
Have you ever considered how much text can fit in eighty columns?  Given that a
signature typically contains up to four lines of text, this space allows you to
attach a tremendous amount of valuable information to your messages.  Seize the
opportunity and don't waste your signature on bullshit that nobody cares about.
Index: doc/rxvt.1.pod
===================================================================
RCS file: /schmorpforge/rxvt-unicode/doc/rxvt.1.pod,v
retrieving revision 1.167
diff -u -r1.167 rxvt.1.pod
--- doc/rxvt.1.pod	15 Oct 2008 14:48:22 -0000	1.167
+++ doc/rxvt.1.pod	1 Nov 2008 19:53:53 -0000
@@ -184,6 +184,12 @@
 on some backgrounds. Maximum radius value is 128. Compile I<afterimage>;
 resource I<blurRadius>.
 
+=item B<-icon> I<file>
+
+Compile I<afterimage>: Specify image file for the applications
+icon. Many window managers will show the icon in some sort of taskbar
+or in the window title bar; resource I<iconFile>.
+
 =item B<-bg> I<colour>
 
 Window background colour; resource B<background>.
@@ -718,6 +724,10 @@
 Apply Gaussian Blurr 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: src/init.C
===================================================================
RCS file: /schmorpforge/rxvt-unicode/src/init.C,v
retrieving revision 1.253
diff -u -r1.253 init.C
--- src/init.C	15 Jul 2008 16:41:22 -0000	1.253
+++ src/init.C	1 Nov 2008 19:54:00 -0000
@@ -1137,6 +1137,52 @@
 
   XmbSetWMProperties (dpy, top, NULL, NULL, (char **)argv, argc,
                       &szHint, &wmHint, &classHint);
+#if ENABLE_FRILLS 
+#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!=NULL)
+        {
+          int w=im->width;
+          int h=im->height;
+          size_t length=(w*h+2)*sizeof(long);
+          long* buffer = (long*)malloc(length);
+          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);
+              Atom net_wm_icon = XInternAtom(dpy, "_NET_WM_ICON", False);
+              Atom cardinal = XInternAtom(dpy, "CARDINAL", False);
+              XChangeProperty(dpy, top, net_wm_icon, cardinal, 32,
+                              PropModeReplace, (const unsigned char*) buffer, 2+w*h);
+              free(buffer);
+            }
+          else
+            {
+              if (!buffer)
+                rxvt_warn ("Memory allocation for icon hint failed!\n");
+              if (!result)
+                rxvt_warn ("Image transformation to ARGB of image for icon hint failed!\n");
+            }
+        }
+      else
+        rxvt_warn ("Loading of image for icon hint failed!\n");
+    }
+#endif
+#endif
 
 #if ENABLE_FRILLS
   if (mwmhints.flags)
Index: src/rsinc.h
===================================================================
RCS file: /schmorpforge/rxvt-unicode/src/rsinc.h,v
retrieving revision 1.26
diff -u -r1.26 rsinc.h
--- src/rsinc.h	15 Jun 2008 13:54:15 -0000	1.26
+++ src/rsinc.h	1 Nov 2008 19:54:00 -0000
@@ -116,4 +116,5 @@
 #ifdef HAVE_AFTERIMAGE
   def (blendtype)
   def (blurradius)
+  def (iconfile)
 #endif
Index: src/xdefaults.C
===================================================================
RCS file: /schmorpforge/rxvt-unicode/src/xdefaults.C,v
retrieving revision 1.137
diff -u -r1.137 xdefaults.C
--- src/xdefaults.C	15 Jun 2008 13:54:15 -0000	1.137
+++ src/xdefaults.C	1 Nov 2008 19:54:02 -0000
@@ -264,6 +264,9 @@
 #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"),
+#if ENABLE_FRILLS 							
+              STRG (Rs_iconfile, "iconFile", "icon", "file", "Filename of icon offered to window manager"),
+#endif
 #endif
               INFO ("e", "command arg ...", "command to execute")
             };
_______________________________________________
rxvt-unicode mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/rxvt-unicode

Reply via email to