fix laptop deco painting
REVIEW: 114511 BUG: 329326 FIXED-IN: 4.11.6
This commit is contained in:
parent
3d389961ff
commit
2ee0f27d43
1 changed files with 44 additions and 33 deletions
|
@ -495,59 +495,75 @@ void LaptopClient::paintEvent( QPaintEvent* )
|
||||||
QPalette g = options()->palette(KDecoration::ColorFrame, isActive());
|
QPalette g = options()->palette(KDecoration::ColorFrame, isActive());
|
||||||
g.setCurrentColorGroup( QPalette::Active );
|
g.setCurrentColorGroup( QPalette::Active );
|
||||||
|
|
||||||
|
const int borderBottom = layoutMetric(LM_BorderBottom);
|
||||||
|
const int borderLeft = layoutMetric(LM_BorderLeft);
|
||||||
|
const int titleEdgeTop = layoutMetric(LM_TitleEdgeTop);
|
||||||
|
|
||||||
QRect r(widget()->rect());
|
QRect r(widget()->rect());
|
||||||
p.setPen(Qt::black);
|
|
||||||
p.drawRect(r.adjusted(0, 0, -1, -1));
|
|
||||||
|
|
||||||
// fill mid frame...
|
// fill mid frame...
|
||||||
p.setPen(g.background().color());
|
p.setPen(g.background().color());
|
||||||
|
p.drawRect(r.adjusted(0,0,-1,-1));
|
||||||
p.drawLine(r.x()+2, r.y()+2, r.right()-2, r.y()+2);
|
p.drawLine(r.x()+2, r.y()+2, r.right()-2, r.y()+2);
|
||||||
p.drawLine(r.left()+2, r.y()+3, r.left()+2, r.bottom()-layoutMetric(LM_BorderBottom)+1);
|
const int boff = borderBottom ? borderBottom - 1 : 1;
|
||||||
p.drawLine(r.right()-2, r.y()+3, r.right()-2, r.bottom()-layoutMetric(LM_BorderBottom)+1);
|
p.drawLine(r.left()+2, r.y()+3, r.left()+2, r.bottom() - boff);
|
||||||
|
p.drawLine(r.right()-2, r.y()+3, r.right()-2, r.bottom() - boff);
|
||||||
p.drawLine(r.left()+3, r.y()+3, r.left()+3, r.y()+layoutMetric(LM_TitleEdgeTop)+layoutMetric(LM_TitleHeight)+layoutMetric(LM_TitleEdgeTop) );
|
p.drawLine(r.left()+3, r.y()+3, r.left()+3, r.y()+layoutMetric(LM_TitleEdgeTop)+layoutMetric(LM_TitleHeight)+layoutMetric(LM_TitleEdgeTop) );
|
||||||
p.drawLine(r.right()-3, r.y()+3, r.right()-3, r.y()+layoutMetric(LM_TitleEdgeTop)+layoutMetric(LM_TitleHeight)+layoutMetric(LM_TitleEdgeTop) );
|
p.drawLine(r.right()-3, r.y()+3, r.right()-3, r.y()+layoutMetric(LM_TitleEdgeTop)+layoutMetric(LM_TitleHeight)+layoutMetric(LM_TitleEdgeTop) );
|
||||||
if (!mustDrawHandle() )
|
if (borderBottom)
|
||||||
p.drawLine(r.left()+1, r.bottom()-2, r.right()-1, r.bottom()-2);
|
p.drawLine(r.left()+1, r.bottom()-2, r.right()-1, r.bottom()-2);
|
||||||
|
|
||||||
// outer frame
|
// outer frame
|
||||||
p.setPen(g.color(QPalette::Light));
|
if (borderBottom)
|
||||||
|
p.setPen(g.color(QPalette::Light));
|
||||||
p.drawLine(r.x()+1, r.y()+1, r.right()-1, r.y()+1);
|
p.drawLine(r.x()+1, r.y()+1, r.right()-1, r.y()+1);
|
||||||
p.drawLine(r.x()+1, r.y()+1, r.x()+1, r.bottom()-1);
|
p.drawLine(r.x()+1, r.y()+1, r.x()+1, r.bottom()-1);
|
||||||
p.setPen(g.dark().color());
|
if (borderBottom)
|
||||||
|
p.setPen(g.dark().color());
|
||||||
p.drawLine(r.right()-1, r.y()+1, r.right()-1, r.bottom()-1);
|
p.drawLine(r.right()-1, r.y()+1, r.right()-1, r.bottom()-1);
|
||||||
p.drawLine(r.x()+1, r.bottom()-1, r.right()-1, r.bottom()-1);
|
p.drawLine(r.x()+1, r.bottom()-1, r.right()-1, r.bottom()-1);
|
||||||
|
|
||||||
int th = titleHeight;
|
int th = titleHeight;
|
||||||
int bb = handleSize + 2; // Bottom border
|
int bb = handleSize + 2; // Bottom border
|
||||||
int bs = handleSize - 2; // inner size of bottom border
|
int bs = handleSize - 2; // inner size of bottom border
|
||||||
|
int tb = layoutMetric(LM_TitleEdgeTop, false, NULL); // top border
|
||||||
|
int sb = layoutMetric(LM_BorderRight, false, NULL) - 1; // side border
|
||||||
if (!mustDrawHandle()) {
|
if (!mustDrawHandle()) {
|
||||||
bb = 6;
|
bb = borderBottom + 2;
|
||||||
bs = 0;
|
bs = 0;
|
||||||
}
|
}
|
||||||
if ( isToolWindow() )
|
if ( isToolWindow() )
|
||||||
th -= 2;
|
th -= 2;
|
||||||
|
|
||||||
// inner rect
|
// inner rect
|
||||||
p.drawRect(r.x() + 3, r.y() + th + 3, r.width() - 7, r.height() - th - bb - 1);
|
p.drawRect(r.x() + sb, r.y() + th + tb, r.width() - (2*sb + 1), r.height() - (th + bb + 1));
|
||||||
|
|
||||||
|
p.setPen(Qt::black);
|
||||||
|
if (titleEdgeTop)
|
||||||
|
p.drawLine(r.topLeft(), r.topRight());
|
||||||
|
if (borderBottom)
|
||||||
|
p.drawLine(r.bottomLeft(), r.bottomRight());
|
||||||
|
if (borderLeft) {
|
||||||
|
p.drawLine(r.topLeft(), r.bottomLeft());
|
||||||
|
p.drawLine(r.topRight(), r.bottomRight());
|
||||||
|
}
|
||||||
|
|
||||||
// handles
|
// handles
|
||||||
if (mustDrawHandle()) {
|
if (mustDrawHandle()) {
|
||||||
if (r.width() > 3*handleSize + 20) {
|
if (r.width() > 3*handleSize + 20) {
|
||||||
int range = 8 + 3*handleSize/2;
|
int range = 8 + 3*handleSize/2;
|
||||||
qDrawShadePanel(&p, r.x() + 1, r.bottom() - bs, range,
|
qDrawShadePanel(&p, r.x() + 1, r.bottom() - bs, range,
|
||||||
handleSize - 2, g, false, 1, &g.brush(QPalette::Mid));
|
handleSize - 2, g, false, 1, &g.brush(QPalette::Mid));
|
||||||
qDrawShadePanel(&p, r.x() + range + 1, r.bottom() - bs,
|
qDrawShadePanel(&p, r.x() + range + 1, r.bottom() - bs,
|
||||||
r.width() - 2*range - 2, handleSize - 2, g, false, 1,
|
r.width() - 2*range - 2, handleSize - 2, g, false, 1,
|
||||||
isActive() ? &g.brush(QPalette::Background) :
|
isActive() ? &g.brush(QPalette::Background) : &g.brush(QPalette::Mid));
|
||||||
&g.brush(QPalette::Mid));
|
qDrawShadePanel(&p, r.right() - range, r.bottom() - bs,
|
||||||
qDrawShadePanel(&p, r.right() - range, r.bottom() - bs,
|
range, bs, g, false, 1, &g.brush(QPalette::Mid));
|
||||||
range, bs, g, false, 1, &g.brush(QPalette::Mid));
|
} else {
|
||||||
} else {
|
qDrawShadePanel(&p, r.x() + 1, r.bottom() - bs,
|
||||||
qDrawShadePanel(&p, r.x() + 1, r.bottom() - bs,
|
r.width() - 2, bs, g, false, 1,
|
||||||
r.width() - 2, bs, g, false, 1,
|
isActive() ? &g.brush(QPalette::Background) : &g.brush(QPalette::Mid));
|
||||||
isActive() ? &g.brush(QPalette::Background) :
|
}
|
||||||
&g.brush(QPalette::Mid));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
r = titleRect();
|
r = titleRect();
|
||||||
|
@ -621,12 +637,7 @@ QRegion LaptopClient::cornerShape(WindowCorner corner)
|
||||||
|
|
||||||
bool LaptopClient::mustDrawHandle() const
|
bool LaptopClient::mustDrawHandle() const
|
||||||
{
|
{
|
||||||
bool drawSmallBorders = !options()->moveResizeMaximizedWindows();
|
return isResizable() && !(maximizeMode() & MaximizeVertical);
|
||||||
if (drawSmallBorders && (maximizeMode() & MaximizeVertical)) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return isResizable();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LaptopClient::updateActiveBuffer( )
|
void LaptopClient::updateActiveBuffer( )
|
||||||
|
@ -635,7 +646,7 @@ void LaptopClient::updateActiveBuffer( )
|
||||||
if( !bufferDirty && (lastBufferWidth == rTitle.width()))
|
if( !bufferDirty && (lastBufferWidth == rTitle.width()))
|
||||||
return;
|
return;
|
||||||
if ( rTitle.width() <= 0 || rTitle.height() <= 0 )
|
if ( rTitle.width() <= 0 || rTitle.height() <= 0 )
|
||||||
return;
|
return;
|
||||||
lastBufferWidth = rTitle.width();
|
lastBufferWidth = rTitle.width();
|
||||||
bufferDirty = false;
|
bufferDirty = false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue