Hey gallium, this patch makes it look cool in black.
You disappeared off IRC, so I'll check this in and you can revert if you hate it :) svn path=/trunk/kdebase/kwin/; revision=101323icc-effect-5.14.5
parent
ba45a39fa5
commit
71618ff55c
|
@ -16,6 +16,30 @@ using namespace KWinInternal;
|
||||||
static const int s_frameWidth = 5;
|
static const int s_frameWidth = 5;
|
||||||
static const int s_buttonSize = 19;
|
static const int s_buttonSize = 19;
|
||||||
|
|
||||||
|
static void fixColorGroup(QColorGroup & colorGroup)
|
||||||
|
{
|
||||||
|
QColor light = colorGroup.light();
|
||||||
|
|
||||||
|
int hue, saturation, value;
|
||||||
|
|
||||||
|
light.hsv(&hue, &saturation, &value);
|
||||||
|
|
||||||
|
if (value < 128)
|
||||||
|
{
|
||||||
|
light.setHsv(hue, saturation, 128);
|
||||||
|
colorGroup.setColor(QColorGroup::Light, light);
|
||||||
|
}
|
||||||
|
|
||||||
|
QColor dark = colorGroup.light();
|
||||||
|
|
||||||
|
dark.hsv(&hue, &saturation, &value);
|
||||||
|
|
||||||
|
if (value < 84)
|
||||||
|
{
|
||||||
|
dark.setHsv(hue, saturation, 84);
|
||||||
|
colorGroup.setColor(QColorGroup::Dark, dark);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MwmButton::MwmButton( MwmClient* parent, const char* name, int btnType )
|
MwmButton::MwmButton( MwmClient* parent, const char* name, int btnType )
|
||||||
: QButton( parent, name , WStyle_Customize | WStyle_NoBorder
|
: QButton( parent, name , WStyle_Customize | WStyle_NoBorder
|
||||||
|
@ -36,22 +60,24 @@ void MwmButton::drawButton( QPainter* p )
|
||||||
p->setBrush( options->color( Options::TitleBar, m_parent->isActive() ) );
|
p->setBrush( options->color( Options::TitleBar, m_parent->isActive() ) );
|
||||||
p->drawRect( 0, 0, s_buttonSize, s_buttonSize );
|
p->drawRect( 0, 0, s_buttonSize, s_buttonSize );
|
||||||
|
|
||||||
|
QColorGroup colorGroup =
|
||||||
|
options->colorGroup( Options::TitleBar, m_parent->isActive() );
|
||||||
|
|
||||||
|
fixColorGroup(colorGroup);
|
||||||
|
|
||||||
qDrawShadePanel( p, 0, 0, s_buttonSize, s_buttonSize,
|
qDrawShadePanel( p, 0, 0, s_buttonSize, s_buttonSize,
|
||||||
options->colorGroup( Options::TitleBar, m_parent->isActive() ), isDown() );
|
colorGroup, isDown() );
|
||||||
|
|
||||||
switch ( m_btnType )
|
switch ( m_btnType )
|
||||||
{
|
{
|
||||||
case (BtnMenu):
|
case (BtnMenu):
|
||||||
qDrawShadePanel( p, 4, 7, 11, 4,
|
qDrawShadePanel( p, 4, 7, 11, 4, colorGroup );
|
||||||
options->colorGroup( Options::TitleBar, m_parent->isActive() ) );
|
|
||||||
break;
|
break;
|
||||||
case (BtnIconify):
|
case (BtnIconify):
|
||||||
qDrawShadePanel( p, 7, 7, 5, 5,
|
qDrawShadePanel( p, 7, 7, 5, 5, colorGroup );
|
||||||
options->colorGroup( Options::TitleBar, m_parent->isActive() ) );
|
|
||||||
break;
|
break;
|
||||||
case (BtnMax):
|
case (BtnMax):
|
||||||
qDrawShadePanel( p, 4, 4, 11, 11,
|
qDrawShadePanel( p, 4, 4, 11, 11, colorGroup );
|
||||||
options->colorGroup( Options::TitleBar, m_parent->isActive() ) );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -187,6 +213,11 @@ void MwmClient::paintEvent( QPaintEvent* )
|
||||||
{
|
{
|
||||||
QPainter p( this );
|
QPainter p( this );
|
||||||
|
|
||||||
|
QColorGroup colorGroup =
|
||||||
|
options->colorGroup( Options::TitleBar, isActive() );
|
||||||
|
|
||||||
|
fixColorGroup(colorGroup);
|
||||||
|
|
||||||
QRect trect = titlebar->geometry();
|
QRect trect = titlebar->geometry();
|
||||||
QRect wrect = windowWrapper()->geometry();
|
QRect wrect = windowWrapper()->geometry();
|
||||||
QRect mrect = rect();
|
QRect mrect = rect();
|
||||||
|
@ -196,7 +227,7 @@ void MwmClient::paintEvent( QPaintEvent* )
|
||||||
p.drawRect( mrect );
|
p.drawRect( mrect );
|
||||||
p.setPen( Qt::NoPen );
|
p.setPen( Qt::NoPen );
|
||||||
|
|
||||||
p.setBrush( options->color( Options::TitleBar, isActive() ) );
|
p.setBrush( colorGroup.background() );
|
||||||
|
|
||||||
// draw frame-background:
|
// draw frame-background:
|
||||||
p.drawRect(
|
p.drawRect(
|
||||||
|
@ -226,7 +257,7 @@ void MwmClient::paintEvent( QPaintEvent* )
|
||||||
wrect.y(),
|
wrect.y(),
|
||||||
s_frameWidth,
|
s_frameWidth,
|
||||||
wrect.height() - s_buttonSize,
|
wrect.height() - s_buttonSize,
|
||||||
options->colorGroup( Options::TitleBar, isActive() ) );
|
colorGroup );
|
||||||
|
|
||||||
// draw right frame:
|
// draw right frame:
|
||||||
qDrawShadePanel( &p,
|
qDrawShadePanel( &p,
|
||||||
|
@ -234,7 +265,7 @@ void MwmClient::paintEvent( QPaintEvent* )
|
||||||
wrect.y(),
|
wrect.y(),
|
||||||
s_frameWidth,
|
s_frameWidth,
|
||||||
wrect.height() - s_buttonSize,
|
wrect.height() - s_buttonSize,
|
||||||
options->colorGroup( Options::TitleBar, isActive() ) );
|
colorGroup );
|
||||||
|
|
||||||
// draw top frame:
|
// draw top frame:
|
||||||
qDrawShadePanel( &p,
|
qDrawShadePanel( &p,
|
||||||
|
@ -242,7 +273,7 @@ void MwmClient::paintEvent( QPaintEvent* )
|
||||||
1,
|
1,
|
||||||
wrect.width() - 2*s_buttonSize,
|
wrect.width() - 2*s_buttonSize,
|
||||||
s_frameWidth,
|
s_frameWidth,
|
||||||
options->colorGroup( Options::TitleBar, isActive() ) );
|
colorGroup );
|
||||||
|
|
||||||
// draw bottom frame:
|
// draw bottom frame:
|
||||||
qDrawShadePanel( &p,
|
qDrawShadePanel( &p,
|
||||||
|
@ -250,10 +281,11 @@ void MwmClient::paintEvent( QPaintEvent* )
|
||||||
mrect.height() - s_frameWidth - 1,
|
mrect.height() - s_frameWidth - 1,
|
||||||
wrect.width() - 2*s_buttonSize,
|
wrect.width() - 2*s_buttonSize,
|
||||||
s_frameWidth,
|
s_frameWidth,
|
||||||
options->colorGroup( Options::TitleBar, isActive() ) );
|
colorGroup );
|
||||||
|
|
||||||
// draw light corner parts:
|
// draw light corner parts:
|
||||||
p.setPen( options->colorGroup( Options::TitleBar, isActive() ).light() );
|
p.setPen( colorGroup.light() );
|
||||||
|
|
||||||
// tl corner:
|
// tl corner:
|
||||||
p.drawLine(
|
p.drawLine(
|
||||||
1,
|
1,
|
||||||
|
@ -322,7 +354,7 @@ void MwmClient::paintEvent( QPaintEvent* )
|
||||||
// p.setPen( Qt::NoPen );
|
// p.setPen( Qt::NoPen );
|
||||||
|
|
||||||
// draw dark corner parts:
|
// draw dark corner parts:
|
||||||
p.setPen( options->colorGroup( Options::TitleBar, isActive() ).dark() );
|
p.setPen( colorGroup.dark() );
|
||||||
// tl corner:
|
// tl corner:
|
||||||
p.drawLine(
|
p.drawLine(
|
||||||
1,
|
1,
|
||||||
|
@ -401,7 +433,7 @@ void MwmClient::paintEvent( QPaintEvent* )
|
||||||
// draw titlebar:
|
// draw titlebar:
|
||||||
p.drawRect( trect );
|
p.drawRect( trect );
|
||||||
qDrawShadePanel( &p, trect,
|
qDrawShadePanel( &p, trect,
|
||||||
options->colorGroup( Options::TitleBar, isActive() ) );
|
colorGroup );
|
||||||
|
|
||||||
// draw caption:
|
// draw caption:
|
||||||
p.setFont( options->font( true ) );
|
p.setFont( options->font( true ) );
|
||||||
|
|
Loading…
Reference in New Issue