renamed ::updatebackgroundcolor to ::activeChange, for consistency with client, and removed useless color manipulations from there; fixed window attributes to optimize painting; fixed color manipulation in 'paintevent', and rationalized layout metric manipulation in ::updatePosition
svn path=/trunk/KDE/kdebase/workspace/; revision=1018246
This commit is contained in:
parent
7e3a920edb
commit
22bfe6a4b3
1 changed files with 23 additions and 35 deletions
|
@ -48,9 +48,11 @@ namespace Nitrogen
|
||||||
decoration_offset_( false )
|
decoration_offset_( false )
|
||||||
{
|
{
|
||||||
|
|
||||||
|
setAttribute(Qt::WA_NoSystemBackground );
|
||||||
|
setAutoFillBackground( false );
|
||||||
|
|
||||||
// cursor
|
// cursor
|
||||||
setCursor( Qt::SizeFDiagCursor );
|
setCursor( Qt::SizeFDiagCursor );
|
||||||
setAutoFillBackground( true );
|
|
||||||
|
|
||||||
// size
|
// size
|
||||||
setFixedSize( QSize( GRIP_SIZE, GRIP_SIZE ) );
|
setFixedSize( QSize( GRIP_SIZE, GRIP_SIZE ) );
|
||||||
|
@ -66,7 +68,6 @@ namespace Nitrogen
|
||||||
|
|
||||||
// embed
|
// embed
|
||||||
embed();
|
embed();
|
||||||
updateBackgroundColor();
|
|
||||||
updatePosition();
|
updatePosition();
|
||||||
|
|
||||||
// event filter
|
// event filter
|
||||||
|
@ -81,25 +82,8 @@ namespace Nitrogen
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//_____________________________________________
|
//_____________________________________________
|
||||||
void NitrogenSizeGrip::updateBackgroundColor( void )
|
void NitrogenSizeGrip::activeChange( void )
|
||||||
{
|
{ XMapRaised( QX11Info::display(), winId() ); }
|
||||||
|
|
||||||
QPalette palette = client().widget()->palette();
|
|
||||||
|
|
||||||
// active color
|
|
||||||
palette.setCurrentColorGroup( client().isActive() ? QPalette::Active:QPalette::Inactive );
|
|
||||||
|
|
||||||
// get relevant colors
|
|
||||||
QColor base( client().configuration().overwriteColors() ?
|
|
||||||
palette.button().color().darker(250) :
|
|
||||||
client().options()->color( NitrogenClient::ColorTitleBar, client().isActive() ) );
|
|
||||||
|
|
||||||
palette.setColor( backgroundRole(), base );
|
|
||||||
setPalette( palette );
|
|
||||||
|
|
||||||
XMapRaised( QX11Info::display(), winId() );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//_____________________________________________
|
//_____________________________________________
|
||||||
void NitrogenSizeGrip::embed( void )
|
void NitrogenSizeGrip::embed( void )
|
||||||
|
@ -144,14 +128,8 @@ namespace Nitrogen
|
||||||
void NitrogenSizeGrip::paintEvent( QPaintEvent* )
|
void NitrogenSizeGrip::paintEvent( QPaintEvent* )
|
||||||
{
|
{
|
||||||
|
|
||||||
QPalette palette = client().widget()->palette();
|
|
||||||
palette.setCurrentColorGroup( (client().isActive() ) ? QPalette::Active : QPalette::Inactive );
|
|
||||||
|
|
||||||
// get relevant colors
|
// get relevant colors
|
||||||
QColor base( client().configuration().overwriteColors() ?
|
QColor base( palette().brush( (client().isActive() ) ? QPalette::Active : QPalette::Inactive, QPalette::Button ).color() );
|
||||||
palette.button().color() :
|
|
||||||
client().options()->color( NitrogenClient::ColorTitleBar, client().isActive() ) );
|
|
||||||
|
|
||||||
QColor dark( base.darker(250) );
|
QColor dark( base.darker(250) );
|
||||||
QColor light( base.darker(150) );
|
QColor light( base.darker(150) );
|
||||||
|
|
||||||
|
@ -237,12 +215,22 @@ namespace Nitrogen
|
||||||
client().width() - GRIP_SIZE - OFFSET,
|
client().width() - GRIP_SIZE - OFFSET,
|
||||||
client().height() - GRIP_SIZE - OFFSET );
|
client().height() - GRIP_SIZE - OFFSET );
|
||||||
|
|
||||||
if( decoration_offset_ )
|
if( client().isPreview() )
|
||||||
{
|
{
|
||||||
|
|
||||||
position-= QPoint( client().borderWidth(), client().borderHeight() );
|
position -= QPoint(
|
||||||
|
client().layoutMetric( NitrogenClient::LM_BorderLeft )+client().layoutMetric( NitrogenClient::LM_OuterPaddingLeft ),
|
||||||
|
client().layoutMetric( NitrogenClient::LM_TitleHeight )+client().layoutMetric( NitrogenClient::LM_TitleEdgeTop )+client().layoutMetric( NitrogenClient::LM_TitleEdgeBottom )+client().layoutMetric( NitrogenClient::LM_BorderBottom ) );
|
||||||
|
|
||||||
|
} else if( decoration_offset_ ) {
|
||||||
|
|
||||||
|
// not sure whether this case still happens or not
|
||||||
|
position -= QPoint(
|
||||||
|
client().layoutMetric( NitrogenClient::LM_BorderLeft )+client().layoutMetric( NitrogenClient::LM_BorderRight ),
|
||||||
|
client().layoutMetric( NitrogenClient::LM_TitleHeight )+client().layoutMetric( NitrogenClient::LM_TitleEdgeTop )+client().layoutMetric( NitrogenClient::LM_TitleEdgeBottom )+client().layoutMetric( NitrogenClient::LM_BorderBottom ) );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
position -= QPoint(
|
position -= QPoint(
|
||||||
client().layoutMetric( NitrogenClient::LM_BorderRight ),
|
client().layoutMetric( NitrogenClient::LM_BorderRight ),
|
||||||
client().layoutMetric( NitrogenClient::LM_BorderBottom ) );
|
client().layoutMetric( NitrogenClient::LM_BorderBottom ) );
|
||||||
|
|
Loading…
Reference in a new issue