From 5ce103a6e654c7f6f2e397aaab8cd6203c79c315 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Wed, 28 Jul 2010 01:07:47 +0000 Subject: [PATCH] - fixed rendering glitch because updateTitleRect had too small clip region - moved check on titleOutline to dedicated inline function - removed some trailing spaces. svn path=/trunk/KDE/kdebase/workspace/; revision=1155744 --- clients/oxygen/oxygenclient.cpp | 9 ++++----- clients/oxygen/oxygenclient.h | 18 ++++++++++++++---- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/clients/oxygen/oxygenclient.cpp b/clients/oxygen/oxygenclient.cpp index 4967384253..fb51d02c02 100644 --- a/clients/oxygen/oxygenclient.cpp +++ b/clients/oxygen/oxygenclient.cpp @@ -593,9 +593,6 @@ namespace Oxygen void Client::renderWindowBorder( QPainter* painter, const QRect& clipRect, const QWidget* widget, const QPalette& palette ) const { - // check if outline is needed - if( clientGroupItems().count() < 2 && !itemData_.isAnimated() && !( isActive() && configuration().drawTitleOutline() ) ) return; - // get coordinates relative to the client area // this is annoying. One could use mapTo if this was taking const QWidget* and not // const QWidget* as argument. @@ -1414,7 +1411,9 @@ namespace Oxygen // window background renderWindowBackground( &painter, frame, widget(), backgroundPalette( widget(), palette ) ); - renderWindowBorder( &painter, frame, widget(), palette ); + + // window border (for title outline) + if( hasTitleOutline() ) renderWindowBorder( &painter, frame, widget(), palette ); // clipping if( compositingActive() ) @@ -1696,7 +1695,7 @@ namespace Oxygen itemData_.setDirty( true ); moveItemInClientGroup( from, itemClicked ); updateTitleRect(); - + } else { setForceActive( true ); diff --git a/clients/oxygen/oxygenclient.h b/clients/oxygen/oxygenclient.h index 4ce5a75228..2427254f9d 100644 --- a/clients/oxygen/oxygenclient.h +++ b/clients/oxygen/oxygenclient.h @@ -204,12 +204,13 @@ namespace Oxygen //! resize event virtual void resizeEvent(QResizeEvent *e); - + public slots: - + //! triggers widget update in titleRect only + /*! one needs to add the title top margin to avoid some clipping glitches */ void updateTitleRect( void ) - { widget()->update( titleRect() ); } + { widget()->update( titleRect().adjusted( 0, -layoutMetric( LM_TitleEdgeTop ), 0, 0 ) ); } protected: @@ -327,6 +328,15 @@ namespace Oxygen !isPreview(); } + //! true if some title outline is rendered + bool hasTitleOutline( void ) const + { + return + clientGroupItems().count() >= 2 || + itemData_.isAnimated() || + ( isActive() && configuration().drawTitleOutline() ); + } + //! calculate mask QRegion calcMask( void ) const; @@ -371,7 +381,7 @@ namespace Oxygen //! clear force active flag void clearForceActive( void ) { if( isActive() ) setForceActive( false ); } - + //! title bounding rects /*! calculate and return title bounding rects in case of tabbed window */ void updateItemBoundingRects( bool alsoUpdate = true );