Commit 7f18aa39 authored by Hugo Pereira Da Costa's avatar Hugo Pereira Da Costa
Browse files

- Moved shadowSize from anonymous namespace to static member function

- calculate proper shadow size for Mdi windows
- fix mdi windows shadow renderning.
parent c49174a8
......@@ -20,6 +20,7 @@
#include "breezemdiwindowshadow.h"
#include "breeze.h"
#include "breezeshadowhelper.h"
#include "breezestyleconfigdata.h"
#include <QMdiArea>
......@@ -46,7 +47,7 @@ namespace Breeze
if( !_widget ) return;
// metrics
const int shadowSize = StyleConfigData::shadowSize()*12/16;
const int shadowSize = ShadowHelper::shadowSize( StyleConfigData::shadowSize() );
const int shadowOffset = qMax( shadowSize/2, Metrics::Shadow_Overlap*2 );
const int size( shadowSize - Metrics::Shadow_Overlap );
const int topSize( size - shadowOffset );
......@@ -75,7 +76,7 @@ namespace Breeze
}
// update geometry and mask
const QRegion mask = QRegion( geometry ) - hole;
const QRegion mask = QRegion( geometry ) - hole.adjusted( 2, 2, -2, -2 );
if( mask.isEmpty() ) hide();
else {
......
......@@ -46,10 +46,13 @@
#include <KWayland/Client/surface.h>
#endif
namespace
namespace Breeze
{
int shadowSize( int shadowSizeEnum )
const char ShadowHelper::netWMShadowAtomName[] ="_KDE_NET_WM_SHADOW";
//_____________________________________________________
int ShadowHelper::shadowSize( int shadowSizeEnum )
{
switch( shadowSizeEnum )
......@@ -65,13 +68,6 @@ namespace
}
}
namespace Breeze
{
const char ShadowHelper::netWMShadowAtomName[] ="_KDE_NET_WM_SHADOW";
//_____________________________________________________
ShadowHelper::ShadowHelper( QObject* parent, Helper& helper ):
QObject( parent ),
......@@ -239,7 +235,7 @@ namespace Breeze
TileSet ShadowHelper::shadowTiles()
{
// metrics
const int shadowSize = ::shadowSize( StyleConfigData::shadowSize() );
const int shadowSize = this->shadowSize( StyleConfigData::shadowSize() );
if( !shadowSize ) return TileSet();
else if( !_shadowTiles.isValid() )
{
......@@ -530,7 +526,7 @@ namespace Breeze
const qreal devicePixelRatio( _helper.devicePixelRatio( _shadowTiles.pixmap( 0 ) ) );
// metrics
const int shadowSize = ::shadowSize( StyleConfigData::shadowSize() );
const int shadowSize = this->shadowSize( StyleConfigData::shadowSize() );
if( !shadowSize ) return QMargins();
const int shadowOffset = qMax( shadowSize/2, Metrics::Shadow_Overlap*2 );
......
......@@ -73,6 +73,9 @@ namespace Breeze
bool isSupported() const
{ return _supported; }
//* shadow size from enum
static int shadowSize( int shadowSizeEnum );
//* reset
void reset();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment