From 1a727268752619d790ae76062d38c5294638f0c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Sat, 20 Jun 2009 13:34:13 +0000 Subject: [PATCH] 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 --- clients/ozone/oxygenclient.cpp | 17 +++++++++-------- clients/ozone/oxygenclient.h | 1 + 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/clients/ozone/oxygenclient.cpp b/clients/ozone/oxygenclient.cpp index e260057845..04e679c4ae 100644 --- a/clients/ozone/oxygenclient.cpp +++ b/clients/ozone/oxygenclient.cpp @@ -127,7 +127,7 @@ bool OxygenClient::decorationBehaviour(DecorationBehaviour behaviour) 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(); 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) { Q_UNUSED(e) @@ -332,7 +337,7 @@ void OxygenClient::paintEvent(QPaintEvent *e) // draw shadow - if (compositingActive()) + if (compositingActive() && !isMaximized()) shadowTiles(color,KDecoration::options()->color(ColorTitleBar), SHADOW_WIDTH, isActive())->render( frame.adjusted(-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 - bool maximized = maximizeMode()==MaximizeFull && !options()->moveResizeMaximizedWindows(); - - if(maximized) + if(isMaximized()) return; helper_.drawFloatFrame(&painter, frame, color, !compositingActive(), isActive(), @@ -469,9 +472,7 @@ void OxygenClient::drawStripes(QPainter *p, QPalette &palette, const int start, void OxygenClient::updateWindowShape() { - bool maximized = maximizeMode()==MaximizeFull && !options()->moveResizeMaximizedWindows(); - - if(maximized || compositingActive()) { + if(isMaximized() || compositingActive()) { clearMask(); return; } diff --git a/clients/ozone/oxygenclient.h b/clients/ozone/oxygenclient.h index 0daef69e50..9fc1a368a4 100644 --- a/clients/ozone/oxygenclient.h +++ b/clients/ozone/oxygenclient.h @@ -67,6 +67,7 @@ private: void paintEvent(QPaintEvent *e); void drawStripes(QPainter *p, QPalette &palette, const int start, const int end, const int topMargin); QColor titlebarTextColor(const QPalette &palette); + bool isMaximized() const; bool colorCacheInvalid_; QColor cachedTitlebarTextColor_;