From c054eac3f7c09b46d581bb6f9f180cf041743ed4 Mon Sep 17 00:00:00 2001 From: Huynh Huu Long Date: Sat, 20 Jun 2009 13:28:55 +0000 Subject: [PATCH] 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=984209 --- clients/oxygen/oxygenclient.cpp | 17 +++++++++-------- clients/oxygen/oxygenclient.h | 1 + 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/clients/oxygen/oxygenclient.cpp b/clients/oxygen/oxygenclient.cpp index b1f1ccfa4a..79726c4d1d 100644 --- a/clients/oxygen/oxygenclient.cpp +++ b/clients/oxygen/oxygenclient.cpp @@ -125,7 +125,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) { @@ -285,6 +285,11 @@ QColor OxygenClient::titlebarTextColor(const QPalette &palette) } } +bool OxygenClient::isMaximized() const +{ + return maximizeMode()==MaximizeFull && !options()->moveResizeMaximizedWindows(); +} + void OxygenClient::paintEvent(QPaintEvent *e) { Q_UNUSED(e) @@ -322,7 +327,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), @@ -404,9 +409,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(), @@ -459,9 +462,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/oxygen/oxygenclient.h b/clients/oxygen/oxygenclient.h index 661e1ab139..34f14415f9 100644 --- a/clients/oxygen/oxygenclient.h +++ b/clients/oxygen/oxygenclient.h @@ -65,6 +65,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_;