From 04d286e87e1c7cd88b6276de477f00e55fc01a2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Tue, 9 Nov 2004 14:32:30 +0000 Subject: [PATCH] Make minimized windows grayed out, just like in kicker's taskbar. FEATURE: 91273 svn path=/trunk/kdebase/kwin/; revision=361708 --- tabbox.cpp | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/tabbox.cpp b/tabbox.cpp index bc51bcfa9f..1e07172700 100644 --- a/tabbox.cpp +++ b/tabbox.cpp @@ -30,6 +30,7 @@ License. See the file "COPYING" for the exact licensing terms. #include #include #include +#include #include #include @@ -358,16 +359,24 @@ void TabBox::drawContents( QPainter * ) p.fillRect(x, y, r.width(), lineHeight, colorGroup().highlight()); // draw icon + QPixmap icon; if ( showMiniIcon ) { if ( !(*it)->miniIcon().isNull() ) - p.drawPixmap( x+5, y + (lineHeight - iconWidth)/2, (*it)->miniIcon() ); + icon = (*it)->miniIcon(); } else if ( !(*it)->icon().isNull() ) - p.drawPixmap( x+5, y + (lineHeight - iconWidth)/2, (*it)->icon() ); + icon = (*it)->icon(); else if ( menu_pix ) - p.drawPixmap( x, y + (lineHeight - iconWidth)/2, *menu_pix ); + icon = *menu_pix; + + if( !icon.isNull()) + { + if( (*it)->isMinimized()) + KIconEffect::semiTransparent( icon ); + p.drawPixmap( x+5, y + (lineHeight - iconWidth)/2, icon ); + } // generate text to display QString s; @@ -385,6 +394,23 @@ void TabBox::drawContents( QPainter * ) // draw text if ( (*it) == currentClient() ) p.setPen(colorGroup().highlightedText()); + else if( (*it)->isMinimized()) + { + QColor c1 = colorGroup().text(); + QColor c2 = colorGroup().background(); + // from kicker's TaskContainer::blendColors() + int r1, g1, b1; + int r2, g2, b2; + + c1.rgb( &r1, &g1, &b1 ); + c2.rgb( &r2, &g2, &b2 ); + + r1 += (int) ( .5 * ( r2 - r1 ) ); + g1 += (int) ( .5 * ( g2 - g1 ) ); + b1 += (int) ( .5 * ( b2 - b1 ) ); + + p.setPen(QColor( r1, g1, b1 )); + } else p.setPen(colorGroup().text());