The previous patch had an error in the debian/control file. The attached patch fixes that problem.

On 02/10/08 11:24, Debian Bug Tracking System wrote:
Thank you for the problem report you have sent regarding Debian.
This is an automatically generated reply, to let you know your message has
been received.  It is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 Decklin Foster <[EMAIL PROTECTED]>

If you wish to submit further information on your problem, please send
it to [EMAIL PROTECTED] (and *not* to
[EMAIL PROTECTED]).

If you have filed this report in error and wish to close it, please
send mail to [EMAIL PROTECTED] with an explanation
why the bug report should be closed.

Please do not reply to the address at the top of this message,
unless you wish to report a problem with the Bug-tracking system.

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--
Scott Barker       [EMAIL PROTECTED]
Linux Consultant   http://www.mostlylinux.ca/scott
diff -urbBw wmctrl-1.07/Makefile.am wmctrl-1.07.mine/Makefile.am
--- wmctrl-1.07/Makefile.am     2005-01-03 11:48:35.000000000 -0700
+++ wmctrl-1.07.mine/Makefile.am        2008-02-10 10:43:28.000000000 -0700
@@ -1,7 +1,7 @@
 
 AM_CFLAGS = -Wall
 AM_CPPFLAGS = @X_CFLAGS@ @GLIB_CFLAGS@
-LDADD = @X_LIBS@ @X_PRE_LIBS@ -lX11 -lXmu @X_EXTRA_LIBS@ @GLIB_LIBS@
+LDADD = @X_LIBS@ @X_PRE_LIBS@ -lX11 -lXmu -lXpm @X_EXTRA_LIBS@ @GLIB_LIBS@
 
 bin_PROGRAMS = wmctrl
 wmctrl_SOURCES = main.c
diff -urbBw wmctrl-1.07/Makefile.in wmctrl-1.07.mine/Makefile.in
--- wmctrl-1.07/Makefile.in     2005-01-28 20:33:05.000000000 -0700
+++ wmctrl-1.07.mine/Makefile.in        2008-02-10 10:43:29.000000000 -0700
@@ -115,7 +115,7 @@
 
 AM_CFLAGS = -Wall
 AM_CPPFLAGS = @X_CFLAGS@ @GLIB_CFLAGS@
-LDADD = @X_LIBS@ @X_PRE_LIBS@ -lX11 -lXmu @X_EXTRA_LIBS@ @GLIB_LIBS@
+LDADD = @X_LIBS@ @X_PRE_LIBS@ -lX11 -lXmu -lXpm @X_EXTRA_LIBS@ @GLIB_LIBS@
 
 bin_PROGRAMS = wmctrl
 wmctrl_SOURCES = main.c
diff -urbBw wmctrl-1.07/debian/changelog wmctrl-1.07.mine/debian/changelog
--- wmctrl-1.07/debian/changelog        2008-02-10 11:19:54.000000000 -0700
+++ wmctrl-1.07.mine/debian/changelog   2008-02-10 11:17:49.000000000 -0700
@@ -1,3 +1,9 @@
+wmctrl (1.07-6local1) unstable; urgency=low
+
+  * Add ability to change application icons.
+
+ -- Scott Barker <[EMAIL PROTECTED]>  Sun, 10 Feb 2008 11:17:26 -0700
+
 wmctrl (1.07-6) unstable; urgency=low
 
   * Reverted CARD32 patch, which was broken on amd64; use fix from Chris
diff -urbBw wmctrl-1.07/debian/control wmctrl-1.07.mine/debian/control
--- wmctrl-1.07/debian/control  2008-02-10 11:19:54.000000000 -0700
+++ wmctrl-1.07.mine/debian/control     2008-02-10 11:19:42.000000000 -0700
@@ -2,7 +2,7 @@
 Section: x11
 Priority: optional
 Maintainer: Decklin Foster <[EMAIL PROTECTED]>
-Build-Depends: debhelper (>= 4.0.0), x11proto-core-dev, libx11-dev, 
libxmu-dev, libglib2.0-dev (>= 2.4.0)
+Build-Depends: debhelper (>= 4.0.0), x11proto-core-dev, libx11-dev, 
libxmu-dev, libxpm-dev, libglib2.0-dev (>= 2.4.0)
 Standards-Version: 3.6.2
 
 Package: wmctrl
diff -urbBw wmctrl-1.07/main.c wmctrl-1.07.mine/main.c
--- wmctrl-1.07/main.c  2008-02-10 11:19:54.000000000 -0700
+++ wmctrl-1.07.mine/main.c     2008-02-10 11:08:05.000000000 -0700
@@ -34,6 +34,8 @@
 #include <X11/Xatom.h>
 #include <X11/cursorfont.h>
 #include <X11/Xmu/WinUtil.h>
+#include <X11/xpm.h>
+#include <X11/Xmd.h>
 #include <glib.h>
 
 #define _NET_WM_STATE_REMOVE        0    /* remove/unset property */
@@ -64,6 +66,7 @@
 "                       argument and list of possible states is given 
below.\n" \
 "  -r <WIN> -N <STR>    Set the name (long title) of the window.\n" \
 "  -r <WIN> -I <STR>    Set the icon name (short title) of the window.\n" \
+"  -r <WIN> -M <PATH>   Set the mini-icon of the window to the xpm bitmap in 
<PATH>.\n" \
 "  -r <WIN> -T <STR>    Set both the name and the icon name of the window.\n" \
 "  -k (on|off)          Activate or deactivate window manager's\n" \
 "                       \"showing the desktop\" mode. Many window managers\n" \
@@ -264,7 +267,7 @@
         }
     }
    
-    while ((opt = getopt(argc, argv, 
"FGVvhlupidmxa:r:s:c:t:w:k:o:n:g:e:b:N:I:T:R:")) != -1) {
+    while ((opt = getopt(argc, argv, 
"FGVvhlupidmxa:r:s:c:t:w:k:o:n:g:e:b:N:I:T:R:M:")) != -1) {
         missing_option = 0;
         switch (opt) {
             case 'F':
@@ -296,7 +299,7 @@
             case 'r':
                 options.param_window = optarg;
                 break; 
-            case 't': case 'e': case 'b': case 'N': case 'I': case 'T':
+            case 't': case 'e': case 'b': case 'N': case 'I': case 'T': case 
'M':
                 options.param = optarg;
                 action = opt;
                 break;
@@ -356,7 +359,7 @@
             ret = wm_info(disp);
             break;
         case 'a': case 'c': case 'R': 
-        case 't': case 'e': case 'b': case 'N': case 'I': case 'T':
+        case 't': case 'e': case 'b': case 'N': case 'I': case 'T': case 'M':
             if (! options.param_window) {
                 fputs("No window was specified.\n", stderr);
                 return EXIT_FAILURE;
@@ -677,6 +680,64 @@
     
 }/*}}}*/
 
+static int window_set_mini_icon (Display *disp, Window win, /* {{{ */
+        char *path, char mode) {
+    XpmImage xpmImage;
+    XpmInfo xpmInfo;
+    Colormap colormap;
+    CARD32 *xpmColors;
+    XColor xc;
+    char *c;
+    CARD32 *iconBuffer;
+    int iconBufferSize;
+    int i;
+
+    if (XpmReadFileToXpmImage(path, &xpmImage, &xpmInfo) != 0) {
+      fputs("Invalid icon path.\n", stderr);
+      return EXIT_FAILURE;
+    }
+
+    colormap = DefaultColormap(disp, DefaultScreen(disp));
+    xpmColors = (CARD32 *)g_malloc0(xpmImage.ncolors * sizeof(CARD32));
+    for( i = 0; i < xpmImage.ncolors; i++ ) {
+      c = xpmImage.colorTable[i].c_color;
+      if (c == NULL) c = xpmImage.colorTable[i].g_color;
+      // else if (c == NULL) c = xpmImage.colorTable[i].g4_color;
+      // else if (c == NULL) c = xpmImage.colorTable[i].m_color;
+      // else if (c == NULL) c = xpmImage.colorTable[i].symbolic;
+      if (c == NULL) {
+        // Unknown color
+        xpmColors[i] = 0;
+      } else if (strcmp(c, "None") == 0) {
+        // No color - see thru
+        xpmColors[i] = 0;
+      } else if (XParseColor(disp, colormap, c, &xc)) {
+        // Color parsed successfully
+        ((char *)(xpmColors + i))[0] = xc.blue >> 8;
+        ((char *)(xpmColors + i))[1] = xc.green >> 8;
+        ((char *)(xpmColors + i))[2] = xc.red >> 8;
+        ((char *)(xpmColors + i))[3] = 0xff;
+      } else {
+        // Color parsing failed
+        xpmColors[i] = 0;
+      }
+    }
+
+    iconBufferSize = 2 + xpmImage.width * xpmImage.height;
+    iconBuffer = (CARD32 *)g_malloc0( iconBufferSize * sizeof( CARD32 ) );
+
+    iconBuffer[0] = xpmImage.width;
+    iconBuffer[1] = xpmImage.height;
+    for (i = 0; i < xpmImage.width * xpmImage.height; i++) {
+      iconBuffer[i+2] = xpmColors[xpmImage.data[i]];
+    }
+
+    XChangeProperty(disp, win, XInternAtom(disp, "_NET_WM_ICON", False), 
XInternAtom(disp, "CARDINAL", False), 32, PropModeReplace, (const unsigned 
char*)iconBuffer, iconBufferSize);
+
+    g_free(xpmColors);
+    g_free(iconBuffer);
+}/*}}}*/
+
 static int window_to_desktop (Display *disp, Window win, int desktop) {/*{{{*/
     unsigned long *cur_desktop = NULL;
     Window root = DefaultRootWindow(disp);
@@ -910,6 +971,10 @@
             window_set_title(disp, win, options.param, mode);
             return EXIT_SUCCESS;
 
+        case 'M':
+            window_set_mini_icon(disp, win, options.param, mode);
+            return EXIT_SUCCESS;
+
         default:
             fprintf(stderr, "Unknown action: '%c'\n", mode);
             return EXIT_FAILURE;
diff -urbBw wmctrl-1.07/wmctrl.1 wmctrl-1.07.mine/wmctrl.1
--- wmctrl-1.07/wmctrl.1        2005-01-03 11:42:52.000000000 -0700
+++ wmctrl-1.07.mine/wmctrl.1   2008-02-10 10:55:42.000000000 -0700
@@ -121,6 +121,13 @@
 .IR name .
 
 .TP
+.BI \-M " path"
+Set the mini-icon of the window specified by a
+.B \-r
+action to the xpm bitmap in
+.IR path .
+
+.TP
 .B \-k " (" on " | " off " )"
 Turn on or off the window manager's "show the desktop" mode (if the
 window manager implements this feature).

Reply via email to