Fixed painting of maximized shaded window to show bottom border and shadow.

BUG: 207926 


svn path=/trunk/KDE/kdebase/workspace/; revision=1026061
This commit is contained in:
Hugo Pereira Da Costa 2009-09-20 17:51:06 +00:00
parent 272e68f224
commit aedaa73dc4
2 changed files with 47 additions and 28 deletions

View file

@ -186,8 +186,11 @@ namespace Oxygen
case LM_BorderBottom: case LM_BorderBottom:
{ {
int border( 0 ); int border( 0 );
if (respectWindowState && maximized) { if( respectWindowState && maximized && lm != LM_BorderBottom )
{
border = 0; border = 0;
} else if( lm == LM_BorderBottom && frameBorder >= OxygenConfiguration::BorderNoSide ) { } else if( lm == LM_BorderBottom && frameBorder >= OxygenConfiguration::BorderNoSide ) {
// for tiny border, the convention is to have a larger bottom area in order to // for tiny border, the convention is to have a larger bottom area in order to
@ -442,7 +445,7 @@ namespace Oxygen
} }
//_________________________________________________________ //_________________________________________________________
void OxygenClient::renderWindowBorder( QPainter* painter, const QRect& clipRect, const QWidget* widget, const QPalette& palette ) const void OxygenClient::renderWindowBorder( QPainter* painter, const QRect& clipRect, const QWidget* widget, const QPalette& palette, TileSet::Tiles tiles ) const
{ {
const QWidget* window = (isPreview()) ? OxygenClient::widget() : widget->window(); const QWidget* window = (isPreview()) ? OxygenClient::widget() : widget->window();
@ -472,6 +475,7 @@ namespace Oxygen
QRect frame; QRect frame;
// top line // top line
if( tiles&TileSet::Top )
{ {
int shadowSize = 5; int shadowSize = 5;
int height = HFRAMESIZE; int height = HFRAMESIZE;
@ -482,7 +486,7 @@ namespace Oxygen
} }
// bottom line // bottom line
if( configuration().frameBorder() > OxygenConfiguration::BorderNone ) if( configuration().frameBorder() > OxygenConfiguration::BorderNone && (tiles&TileSet::Bottom) )
{ {
int height = qMin( HFRAMESIZE, layoutMetric( LM_BorderBottom ) ); int height = qMin( HFRAMESIZE, layoutMetric( LM_BorderBottom ) );
QRect rect( r.bottomLeft()-position-QPoint(0,height), QSize( r.width(), height ) ); QRect rect( r.bottomLeft()-position-QPoint(0,height), QSize( r.width(), height ) );
@ -495,6 +499,7 @@ namespace Oxygen
{ {
// left // left
if( tiles&TileSet::Left )
{ {
int width = qMin( HFRAMESIZE, layoutMetric( LM_BorderLeft ) ); int width = qMin( HFRAMESIZE, layoutMetric( LM_BorderLeft ) );
QRect rect( r.topLeft()-position, QSize( width, r.height() ) ); QRect rect( r.topLeft()-position, QSize( width, r.height() ) );
@ -503,6 +508,7 @@ namespace Oxygen
} }
// right // right
if( tiles&TileSet::Right )
{ {
int width = qMin( HFRAMESIZE, layoutMetric( LM_BorderRight ) ); int width = qMin( HFRAMESIZE, layoutMetric( LM_BorderRight ) );
QRect rect( r.topRight()-position-QPoint(width,0), QSize( width, r.height() ) ); QRect rect( r.topRight()-position-QPoint(width,0), QSize( width, r.height() ) );
@ -513,8 +519,11 @@ namespace Oxygen
} }
// paint // paint
if( !mask.isEmpty() )
{
painter->setClipRegion( mask, Qt::IntersectClip); painter->setClipRegion( mask, Qt::IntersectClip);
renderWindowBackground(painter, frame, widget, palette ); renderWindowBackground(painter, frame, widget, palette );
}
// restore painter // restore painter
painter->restore(); painter->restore();
@ -698,23 +707,15 @@ namespace Oxygen
QColor color = palette.window().color(); QColor color = palette.window().color();
// draw shadows // draw shadows
if( compositingActive() && !isMaximized() ) if( compositingActive() )
{ {
if( configuration().useOxygenShadows() && timeLineIsRunning() ) TileSet *tileSet( 0 );
{ if( configuration().useOxygenShadows() && timeLineIsRunning() ) tileSet = oxygenShadowCache()->tileSet( this, timeLine_.currentFrame() );
else tileSet = oxygenShadowCache()->tileSet( this );
oxygenShadowCache()->tileSet( this, timeLine_.currentFrame() )->render( if( !isMaximized() ) tileSet->render( frame.adjusted( 4, 4, -4, -4), &painter, TileSet::Ring);
frame.adjusted( 4, 4, -4, -4), else if( isShade() ) tileSet->render( frame.adjusted( 0, 4, 0, -4), &painter, TileSet::Bottom);
&painter, TileSet::Ring);
} else {
oxygenShadowCache()->tileSet( this )->render(
frame.adjusted( 4, 4, -4, -4),
&painter, TileSet::Ring);
}
} }
@ -763,7 +764,11 @@ namespace Oxygen
// window background // window background
renderWindowBackground( &painter, frame, widget(), palette ); renderWindowBackground( &painter, frame, widget(), palette );
if( drawTitleOutline() && !isMaximized() ) renderWindowBorder( &painter, frame, widget(), backgroundPalette( widget(), palette ) ); if( drawTitleOutline() )
{
if( !isMaximized() ) renderWindowBorder( &painter, frame, widget(), backgroundPalette( widget(), palette ) );
else if( isShade() ) renderWindowBorder( &painter, frame, widget(), backgroundPalette( widget(), palette ), TileSet::Bottom );
}
// clipping // clipping
if( compositingActive() ) painter.setClipping(false); if( compositingActive() ) painter.setClipping(false);
@ -818,7 +823,10 @@ namespace Oxygen
frame.getRect(&x, &y, &w, &h); frame.getRect(&x, &y, &w, &h);
// shadow and resize handles // shadow and resize handles
if( configuration().frameBorder() >= OxygenConfiguration::BorderTiny && !isMaximized() ) if( configuration().frameBorder() >= OxygenConfiguration::BorderTiny )
{
if( !isMaximized() )
{ {
helper().drawFloatFrame( helper().drawFloatFrame(
@ -827,7 +835,18 @@ namespace Oxygen
KDecoration::options()->color(ColorTitleBar) KDecoration::options()->color(ColorTitleBar)
); );
if( isResizable() && !isShade() ) } else if( isShade() ) {
// adjust frame so that only the bottom part of the frame is drawn
helper().drawFloatFrame(
&painter, frame.adjusted( -4, -4, 4, 0 ), backgroundPalette( widget(), palette ).color( widget()->backgroundRole() ),
!compositingActive(), isActive(),
KDecoration::options()->color(ColorTitleBar)
);
}
if( isResizable() && !isShade() && !isMaximized() )
{ {
// Draw the 3-dots resize handles // Draw the 3-dots resize handles

View file

@ -124,7 +124,7 @@ namespace Oxygen
//! window border //! window border
// this draws a "blue" border around active window // this draws a "blue" border around active window
virtual void renderWindowBorder( QPainter*, const QRect&, const QWidget*, const QPalette& ) const; virtual void renderWindowBorder( QPainter*, const QRect&, const QWidget*, const QPalette&, TileSet::Tiles tiles = TileSet::Ring ) const;
//! separator //! separator
virtual void renderSeparator( QPainter*, const QRect&, const QWidget*, const QColor& ) const; virtual void renderSeparator( QPainter*, const QRect&, const QWidget*, const QColor& ) const;