diff --git a/clients/oxygen/oxygenclient.cpp b/clients/oxygen/oxygenclient.cpp index 5470eda712..e7b9a943d2 100644 --- a/clients/oxygen/oxygenclient.cpp +++ b/clients/oxygen/oxygenclient.cpp @@ -1432,22 +1432,40 @@ namespace Oxygen QRegion Client::region( KDecorationDefines::Region r ) { - if( - (r == KDecorationDefines::ExtendedBorderRegion) && - configuration().useExtendedWindowBorder() && - configuration().frameBorder() <= Configuration::BorderNoSide ) + // return empty region for anything but extended borders, when enabled + if( !( r == KDecorationDefines::ExtendedBorderRegion && configuration().useExtendedWindowBorder() ) ) + { return QRegion(); } + + // return empty region for maximized windows + if( isMaximized() ) return QRegion(); + + // return 3 pixels extended borders for sides that have no visible borders + // also add the invisible pixels at the masked rounded corners, in non compositing mode + if( configuration().frameBorder() <= Configuration::BorderNoSide || !compositingActive() ) { - const QRect rect = widget()->rect().adjusted( - 0, 0, - -layoutMetric( LM_OuterPaddingLeft ) - layoutMetric( LM_OuterPaddingRight ), - -layoutMetric( LM_OuterPaddingTop ) - layoutMetric( LM_OuterPaddingBottom ) ); + QRect rect = widget()->rect().adjusted( + layoutMetric( LM_OuterPaddingLeft ), + layoutMetric( LM_OuterPaddingTop ), + - layoutMetric( LM_OuterPaddingRight ), + - layoutMetric( LM_OuterPaddingBottom ) ); + + rect.translate( -layoutMetric( LM_OuterPaddingLeft ), -layoutMetric( LM_OuterPaddingTop ) ); + + // mask + QRegion mask( calcMask() ); + if( mask.isEmpty() ) mask = rect; + else mask.translate( -layoutMetric( LM_OuterPaddingLeft ), -layoutMetric( LM_OuterPaddingTop ) ); // only return non-empty region on the sides for which there is no border - if( configuration().frameBorder() == Configuration::BorderNone ) return QRegion( rect.adjusted( -3, 0, 3, 3 ) ) - rect; - else return QRegion( rect.adjusted( -3, 0, 3, 0 ) ) - rect; + if( configuration().frameBorder() == Configuration::BorderNone ) return QRegion( rect.adjusted( -3, 0, 3, 3 ) ) - mask; + else if( configuration().frameBorder() == Configuration::BorderNoSide ) return QRegion( rect.adjusted( -3, 0, 3, 0 ) ) - mask; + else if( !compositingActive() ) return QRegion( rect ) - mask; + + } - } else return QRegion(); + // fall back + return QRegion(); }