From 458ded5de1723e3e6912890a7c19cab63ce81c82 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Fri, 9 Oct 2009 00:19:32 +0000 Subject: [PATCH] moved title and buttons one pixel up, adjusted title outline and window border (in outline mode) accordingly. Also added a 'shadow' pixel on the sides and at the bottom of the active window border outline, and removed an unnecessary 'if( true )'. svn path=/trunk/KDE/kdebase/workspace/; revision=1032966 --- clients/oxygen/oxygenbutton.cpp | 5 +-- clients/oxygen/oxygenclient.cpp | 79 +++++++++++++++++++-------------- 2 files changed, 47 insertions(+), 37 deletions(-) diff --git a/clients/oxygen/oxygenbutton.cpp b/clients/oxygen/oxygenbutton.cpp index 5c1a2f3b65..b8c68f4029 100644 --- a/clients/oxygen/oxygenbutton.cpp +++ b/clients/oxygen/oxygenbutton.cpp @@ -188,9 +188,8 @@ namespace Oxygen if( client_.drawSeparator() ) { client_.renderSeparator( &painter, rect(), this, color ); } - // translate buttons up if window maximized - if(client_.isMaximized()) - { painter.translate( 0, -1 ); } + // translate button up for centering + painter.translate( 0, -1 ); // for menu button the application icon is used if (type_ == ButtonMenu) diff --git a/clients/oxygen/oxygenclient.cpp b/clients/oxygen/oxygenclient.cpp index 62afd93f18..363a495174 100644 --- a/clients/oxygen/oxygenclient.cpp +++ b/clients/oxygen/oxygenclient.cpp @@ -471,7 +471,7 @@ namespace Oxygen int shadowSize = 5; if( timeLineIsRunning() ) shadowSize*=opacity(); - int height = HFRAMESIZE; + int height = HFRAMESIZE-1; QRect rect( r.topLeft()-position, QSize( r.width(), height ) ); helper().slab( palette.color( widget->backgroundRole() ), 0, shadowSize )->render( rect.adjusted(-shadowSize-1, 0, shadowSize+1, 2 ), painter, TileSet::Bottom ); mask += rect; @@ -481,10 +481,16 @@ namespace Oxygen // bottom line if( configuration().frameBorder() > OxygenConfiguration::BorderNone && (tiles&TileSet::Bottom) ) { - int height = qMin( HFRAMESIZE, layoutMetric( LM_BorderBottom ) ); + int height = qMin( HFRAMESIZE, layoutMetric( LM_BorderBottom ) )-1; + QColor shadow( helper().backgroundBottomColor( widget->palette().color( widget->backgroundRole() ) ) ); + painter->setPen( shadow ); QRect rect( r.bottomLeft()-position-QPoint(0,height), QSize( r.width(), height ) ); + painter->drawLine( r.bottomLeft()-position-QPoint(0,height+1), r.bottomRight()-position-QPoint(0,height+1) ); + mask += rect; frame |= rect; + + } // left and right @@ -492,10 +498,14 @@ namespace Oxygen { // left + QColor shadow( helper().calcDarkColor( widget->palette().color( widget->backgroundRole() ) ) ); + painter->setPen( shadow ); if( tiles&TileSet::Left ) { - int width = qMin( HFRAMESIZE, layoutMetric( LM_BorderLeft ) ); + int width = qMin( HFRAMESIZE, layoutMetric( LM_BorderLeft ) )-1; QRect rect( r.topLeft()-position, QSize( width, r.height() ) ); + painter->drawLine( r.topLeft()-position-QPoint(width+1,HFRAMESIZE), r.bottomLeft()-position-QPoint(width+1,-HFRAMESIZE) ); + mask += rect; frame |= rect; } @@ -503,8 +513,10 @@ namespace Oxygen // right if( tiles&TileSet::Right ) { - int width = qMin( HFRAMESIZE, layoutMetric( LM_BorderRight ) ); + int width = qMin( HFRAMESIZE, layoutMetric( LM_BorderRight ) )-1; QRect rect( r.topRight()-position-QPoint(width,0), QSize( width, r.height() ) ); + painter->drawLine( r.topRight()-position-QPoint(-width-1,HFRAMESIZE), r.bottomRight()-position-QPoint(-width-1,-HFRAMESIZE) ); + mask += rect; frame |= rect; } @@ -612,6 +624,9 @@ namespace Oxygen boundingRect.setBottom( titleRect.bottom() ); boundingRect.setLeft( qMax( boundingRect.left(), titleRect.left() ) ); boundingRect.setRight( qMin( boundingRect.right(), titleRect.right() ) ); + + // finally translate one pixel up + boundingRect.translate(0, -1 ); return boundingRect; } @@ -893,7 +908,7 @@ namespace Oxygen // title outline if( drawTitleOutline() ) - { renderTitleOutline( &painter, boundingRect.adjusted( -2*HFRAMESIZE, -layoutMetric(LM_TitleEdgeTop), 2*HFRAMESIZE, 2 ), backgroundPalette( widget(), palette ) ); } + { renderTitleOutline( &painter, boundingRect.adjusted( -2*HFRAMESIZE, -layoutMetric(LM_TitleEdgeTop)+1, 2*HFRAMESIZE, 2 ), backgroundPalette( widget(), palette ) ); } // draw title text renderTitleText( &painter, boundingRect, configuration().titleAlignment() | Qt::AlignVCenter, titlebarTextColor( backgroundPalette( widget(), palette ) ) ); @@ -907,43 +922,39 @@ namespace Oxygen if( compositingActive() ) frame.adjust(-1,-1, 1, 1); // shadow and resize handles - if( true ) + if( !isMaximized() ) { - if( !isMaximized() ) + + if( configuration().frameBorder() >= OxygenConfiguration::BorderTiny ) { - if( configuration().frameBorder() >= OxygenConfiguration::BorderTiny ) - { - - helper().drawFloatFrame( - &painter, frame, backgroundPalette( widget(), palette ).color( widget()->backgroundRole() ), - !compositingActive(), isActive() && configuration().useOxygenShadows(), - KDecoration::options()->color(ColorTitleBar) - ); - - } else { - - // for tiny borders, use a frame that matches the titlebar only - QRect local( frame.topLeft(), QSize( frame.width(), layoutMetric(LM_TitleHeight) + layoutMetric(LM_TitleEdgeTop) ) ); - helper().drawFloatFrame( - &painter, local, backgroundPalette( widget(), palette ).color( widget()->backgroundRole() ), - false, isActive() && configuration().useOxygenShadows(), - KDecoration::options()->color(ColorTitleBar) - ); - } - - } else if( isShade() ) { - - // for shaded maximized windows adjust frame and draw the bottom part of it helper().drawFloatFrame( - &painter, frame.adjusted( -4, 0, 4, 0 ), backgroundPalette( widget(), palette ).color( widget()->backgroundRole() ), - !compositingActive(), isActive(), - KDecoration::options()->color(ColorTitleBar), - TileSet::Bottom + &painter, frame, backgroundPalette( widget(), palette ).color( widget()->backgroundRole() ), + !compositingActive(), isActive() && configuration().useOxygenShadows(), + KDecoration::options()->color(ColorTitleBar) ); + } else { + + // for tiny borders, use a frame that matches the titlebar only + QRect local( frame.topLeft(), QSize( frame.width(), layoutMetric(LM_TitleHeight) + layoutMetric(LM_TitleEdgeTop) ) ); + helper().drawFloatFrame( + &painter, local, backgroundPalette( widget(), palette ).color( widget()->backgroundRole() ), + false, isActive() && configuration().useOxygenShadows(), + KDecoration::options()->color(ColorTitleBar) + ); } + } else if( isShade() ) { + + // for shaded maximized windows adjust frame and draw the bottom part of it + helper().drawFloatFrame( + &painter, frame.adjusted( -4, 0, 4, 0 ), backgroundPalette( widget(), palette ).color( widget()->backgroundRole() ), + !compositingActive(), isActive(), + KDecoration::options()->color(ColorTitleBar), + TileSet::Bottom + ); + } if( configuration().frameBorder() >= OxygenConfiguration::BorderTiny )