Commit cc24d25a authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

[kstyle] Create shadow tiles on demand

Differential Revision: https://phabricator.kde.org/D14898
parent 763ec6d3
......@@ -228,8 +228,10 @@ namespace Breeze
// make sure shadow is not already installed
if( findShadow( object ) ) return;
if ( !_shadowHelper ) return;
// create new shadow
auto windowShadow( new MdiWindowShadow( widget->parentWidget(), _shadowTiles ) );
auto windowShadow( new MdiWindowShadow( widget->parentWidget(), _shadowHelper->shadowTiles() ) );
windowShadow->setWidget( widget );
}
......
......@@ -26,12 +26,15 @@
#include <QWidget>
#include <QPaintEvent>
#include <QPointer>
#include "breezetileset.h"
namespace Breeze
{
class ShadowHelper;
//* frame shadow
/** this allows the shadow to be painted over the widgets viewport */
class MdiWindowShadow: public QWidget
......@@ -91,9 +94,9 @@ namespace Breeze
virtual ~MdiWindowShadowFactory()
{}
//* set shadow tiles
void setShadowTiles( const TileSet& shadowTiles )
{ _shadowTiles = shadowTiles; }
//* set shadow helper
void setShadowHelper( ShadowHelper* shadowHelper )
{ _shadowHelper = shadowHelper; }
//* register widget
bool registerWidget( QWidget* );
......@@ -160,8 +163,8 @@ namespace Breeze
//* set of registered widgets
QSet<const QObject*> _registeredWidgets;
//* tileset used to draw shadow
TileSet _shadowTiles;
//* shadow helper used to generate the shadows
QPointer<ShadowHelper> _shadowHelper;
};
......
......@@ -216,9 +216,6 @@ namespace Breeze
// reset
reset();
// create shadow tiles
shadowTiles();
// update property for registered widgets
for( QMap<QWidget*,WId>::const_iterator iter = _widgets.constBegin(); iter != _widgets.constEnd(); ++iter )
{ installShadows( iter.key() ); }
......@@ -480,7 +477,7 @@ namespace Breeze
//_______________________________________________________
bool ShadowHelper::installShadows( QWidget* widget )
{
if( !widget || !_shadowTiles.isValid() ) return false;
if( !widget ) return false;
/*
From bespin code. Supposibly prevent playing with some 'pseudo-widgets'
......@@ -489,6 +486,11 @@ namespace Breeze
if( !(widget->testAttribute(Qt::WA_WState_Created) && widget->internalWinId() ))
{ return false; }
// create shadow tiles if needed
shadowTiles();
if( !_shadowTiles.isValid() ) return false;
if( Helper::isX11() ) return installX11Shadows( widget );
if( Helper::isWayland() ) return installWaylandShadows( widget );
......
......@@ -1433,7 +1433,7 @@ namespace Breeze
_shadowHelper->loadConfig();
// set mdiwindow factory shadow tiles
_mdiWindowShadowFactory->setShadowTiles( _shadowHelper->shadowTiles() );
_mdiWindowShadowFactory->setShadowHelper( _shadowHelper );
// clear icon cache
_iconCache.clear();
......
Markdown is supported
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