From 979c3827e5aa000ce20a1eb8ffc5a0d7c14e8eb7 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Tue, 24 Jul 2007 01:36:47 +0200 Subject: [PATCH] Make the default window icon randomly tinted. --- openbox/client.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/openbox/client.c b/openbox/client.c index 3ff278ae..24eba20b 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -2309,6 +2309,10 @@ void client_update_icons(ObClient *self) if (!self->icon_set && !self->parents) { RrPixel32 *icon = ob_rr_theme->def_win_icon; gulong *ldata; /* use a long here to satisfy OBT_PROP_SETA32 */ + 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); w = ob_rr_theme->def_win_icon_w; h = ob_rr_theme->def_win_icon_h; @@ -2317,9 +2321,9 @@ void client_update_icons(ObClient *self) ldata[1] = h; for (i = 0; i < w*h; ++i) ldata[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); OBT_PROP_SETA32(self->window, NET_WM_ICON, CARDINAL, ldata, w*h+2); g_free(ldata); } else if (self->frame) -- 2.39.2