summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2007-05-28 02:56:35 +0000
committerDana Jansens <danakj@orodu.net>2007-05-28 02:56:35 +0000
commitdb4bc708d3923016095bfc34e4cde871ea3c4800 (patch)
treea361e7edb3b5fc0e705e4321e93bf7daf221f098
parent8205b6581d7ae4df50b41f943046be2fbe236a15 (diff)
make iconic windows have 50% opacity in the alt-tab box
-rw-r--r--openbox/focus_cycle_popup.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/openbox/focus_cycle_popup.c b/openbox/focus_cycle_popup.c
index e282465e..13f12da5 100644
--- a/openbox/focus_cycle_popup.c
+++ b/openbox/focus_cycle_popup.c
@@ -405,6 +405,7 @@ static void popup_render(ObFocusCyclePopup *p, const ObClient *c)
const gint row = i / icons_per_row; /* starting from 0 */
const gint col = i % icons_per_row; /* starting from 0 */
gint innerx, innery;
+ RrPixel32 *icon_data;
/* find the dimensions of the icon inside it */
innerx = icons_center_x + l + (col * ICON_SIZE);
@@ -420,12 +421,33 @@ static void popup_render(ObFocusCyclePopup *p, const ObClient *c)
icon = client_icon(target->client, innerw, innerh);
p->a_icon->texture[0].data.rgba.width = icon->width;
p->a_icon->texture[0].data.rgba.height = icon->height;
- p->a_icon->texture[0].data.rgba.data = icon->data;
+ if (target->client->iconic) {
+ /* fade iconic windows */
+ gint i;
+ RrPixel32 *d, *s;
+
+ icon_data = g_new(RrPixel32, icon->width * icon->height);
+
+ s = icon->data;
+ d = icon_data;
+ for (i = 0; i < icon->width * icon->height; ++i, ++d, ++s) {
+ /* 50% opacity */
+ gint a = ((*s >> RrDefaultAlphaOffset) & 0xff);
+ *d = *s - (a << RrDefaultAlphaOffset) +
+ ((a>>1) << RrDefaultAlphaOffset);
+ }
+
+ } else
+ icon_data = icon->data;
+ p->a_icon->texture[0].data.rgba.data = icon_data;
/* draw the icon */
p->a_icon->surface.parentx = innerx;
p->a_icon->surface.parenty = innery;
RrPaint(p->a_icon, target->win, innerw, innerh);
+
+ if (target->client->iconic)
+ g_free(icon_data);
}
}