Backport from oxygen: rev 984209

Prevent shadows from being drawn when windows are maximized which causes some visual problems on multi monitor settings.
Also clean up some code duplication.

svn path=/trunk/KDE/kdebase/workspace/; revision=984214
This commit is contained in:
Martin Gräßlin 2009-06-20 13:34:13 +00:00
parent c054eac3f7
commit 1a72726875
2 changed files with 10 additions and 8 deletions

View file

@ -127,7 +127,7 @@ bool OxygenClient::decorationBehaviour(DecorationBehaviour behaviour) const
int OxygenClient::layoutMetric(LayoutMetric lm, bool respectWindowState, const KCommonDecorationButton *btn) const int OxygenClient::layoutMetric(LayoutMetric lm, bool respectWindowState, const KCommonDecorationButton *btn) const
{ {
bool maximized = maximizeMode()==MaximizeFull && !options()->moveResizeMaximizedWindows(); bool maximized = isMaximized();
int frameWidth = OxygenFactory::borderSize(); int frameWidth = OxygenFactory::borderSize();
switch (lm) { switch (lm) {
@ -289,6 +289,11 @@ QColor OxygenClient::titlebarTextColor(const QPalette &palette)
} }
} }
bool OxygenClient::isMaximized() const
{
return maximizeMode()==MaximizeFull && !options()->moveResizeMaximizedWindows();
}
void OxygenClient::paintEvent(QPaintEvent *e) void OxygenClient::paintEvent(QPaintEvent *e)
{ {
Q_UNUSED(e) Q_UNUSED(e)
@ -332,7 +337,7 @@ void OxygenClient::paintEvent(QPaintEvent *e)
// draw shadow // draw shadow
if (compositingActive()) if (compositingActive() && !isMaximized())
shadowTiles(color,KDecoration::options()->color(ColorTitleBar), shadowTiles(color,KDecoration::options()->color(ColorTitleBar),
SHADOW_WIDTH, isActive())->render( frame.adjusted(-SHADOW_WIDTH+4, SHADOW_WIDTH, isActive())->render( frame.adjusted(-SHADOW_WIDTH+4,
-SHADOW_WIDTH+4, SHADOW_WIDTH-4, SHADOW_WIDTH-4), -SHADOW_WIDTH+4, SHADOW_WIDTH-4, SHADOW_WIDTH-4),
@ -414,9 +419,7 @@ void OxygenClient::paintEvent(QPaintEvent *e)
} }
// Draw shadows of the frame // Draw shadows of the frame
bool maximized = maximizeMode()==MaximizeFull && !options()->moveResizeMaximizedWindows(); if(isMaximized())
if(maximized)
return; return;
helper_.drawFloatFrame(&painter, frame, color, !compositingActive(), isActive(), helper_.drawFloatFrame(&painter, frame, color, !compositingActive(), isActive(),
@ -469,9 +472,7 @@ void OxygenClient::drawStripes(QPainter *p, QPalette &palette, const int start,
void OxygenClient::updateWindowShape() void OxygenClient::updateWindowShape()
{ {
bool maximized = maximizeMode()==MaximizeFull && !options()->moveResizeMaximizedWindows(); if(isMaximized() || compositingActive()) {
if(maximized || compositingActive()) {
clearMask(); clearMask();
return; return;
} }

View file

@ -67,6 +67,7 @@ private:
void paintEvent(QPaintEvent *e); void paintEvent(QPaintEvent *e);
void drawStripes(QPainter *p, QPalette &palette, const int start, const int end, const int topMargin); void drawStripes(QPainter *p, QPalette &palette, const int start, const int end, const int topMargin);
QColor titlebarTextColor(const QPalette &palette); QColor titlebarTextColor(const QPalette &palette);
bool isMaximized() const;
bool colorCacheInvalid_; bool colorCacheInvalid_;
QColor cachedTitlebarTextColor_; QColor cachedTitlebarTextColor_;