Make the default window icon randomly tinted.
authorMikael Magnusson <mikachu@comhem.se>
Mon, 23 Jul 2007 23:36:47 +0000 (01:36 +0200)
committerMikael Magnusson <mikachu@comhem.se>
Wed, 16 Jan 2008 06:19:58 +0000 (07:19 +0100)
openbox/client.c

index f97bd43062d97b4168d66a606ab2df776278db66..1a684ac66cf6b3c93d8f3d28027b1b43d501678c 100644 (file)
@@ -2098,14 +2098,18 @@ void client_update_icons(ObClient *self)
     if (self->nicons == 0 && !self->parents) {
         RrPixel32 *icon = ob_rr_theme->def_win_icon;
         gulong *data;
+        gint32 r,g,b;
+        r = g_random_int_range(0,255);
+        g = g_random_int_range(0,255);
+        b = g_random_int_range(0,255);
 
         data = g_new(gulong, 48*48+2);
         data[0] = data[1] =  48;
         for (i = 0; i < 48*48; ++i)
             data[i+2] = (((icon[i] >> RrDefaultAlphaOffset) & 0xff) << 24) +
-                (((icon[i] >> RrDefaultRedOffset) & 0xff) << 16) +
-                (((icon[i] >> RrDefaultGreenOffset) & 0xff) << 8) +
-                (((icon[i] >> RrDefaultBlueOffset) & 0xff) << 0);
+                ((((icon[i] >> RrDefaultRedOffset) & 0xff)*r/255) << 16) +
+                ((((icon[i] >> RrDefaultGreenOffset) & 0xff)*g/255) << 8) +
+                ((((icon[i] >> RrDefaultBlueOffset) & 0xff)*b/255) << 0);
         PROP_SETA32(self->window, net_wm_icon, cardinal, data, 48*48+2);
         g_free(data);
     } else if (self->frame)