config option to specify size of blocks to fall apart to

svn path=/trunk/KDE/kdebase/workspace/; revision=1172706
This commit is contained in:
Luboš Luňák 2010-09-07 21:52:51 +00:00
parent 0668599089
commit 117633d40d
2 changed files with 15 additions and 2 deletions

View file

@ -28,6 +28,17 @@ namespace KWin
KWIN_EFFECT( fallapart, FallApartEffect )
FallApartEffect::FallApartEffect()
{
reconfigure( ReconfigureAll );
}
void FallApartEffect::reconfigure( ReconfigureFlags )
{
KConfigGroup conf = effects->effectConfig( "FallApart" );
blockSize = qBound( 1, conf.readEntry( "BlockSize", 40 ), 100000 );
}
void FallApartEffect::prePaintScreen( ScreenPrePaintData& data, int time )
{
if( !windows.isEmpty())
@ -45,7 +56,7 @@ void FallApartEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data,
data.setTransformed();
w->enablePainting( EffectWindow::PAINT_DISABLED_BY_DELETE );
// Request the window to be divided into cells
data.quads = data.quads.makeGrid( 40 );
data.quads = data.quads.makeGrid( blockSize );
}
else
{

View file

@ -30,6 +30,8 @@ class FallApartEffect
: public Effect
{
public:
FallApartEffect();
virtual void reconfigure( ReconfigureFlags );
virtual void prePaintScreen( ScreenPrePaintData& data, int time );
virtual void prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time );
virtual void paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data );
@ -39,7 +41,7 @@ class FallApartEffect
private:
QHash< const EffectWindow*, double > windows;
bool isRealWindow ( EffectWindow* w );
int blockSize;
};
} // namespace