Fixed shadow effect losing its shadows after making changes to the settings.

Added force mode to buildQuads() to allow refreshing the cache.
Made EffectWindow::buildQuads() no longer internal.

svn path=/trunk/KDE/kdebase/workspace/; revision=872836
This commit is contained in:
Lucas Murray 2008-10-18 10:31:59 +00:00
parent b969ba71b7
commit c07ba30b63
6 changed files with 19 additions and 9 deletions

View file

@ -1381,9 +1381,9 @@ double EffectWindowImpl::shadowSaturation( ShadowType type ) const
return toplevel->workspace()->decorationShadowSaturation( type );
}
WindowQuadList EffectWindowImpl::buildQuads() const
WindowQuadList EffectWindowImpl::buildQuads( bool force ) const
{
return sceneWindow()->buildQuads();
return sceneWindow()->buildQuads( force );
}
EffectWindow* effectWindow( Toplevel* w )

View file

@ -243,7 +243,7 @@ class EffectWindowImpl : public EffectWindow
virtual double shadowBrightness( ShadowType type ) const;
virtual double shadowSaturation( ShadowType type ) const;
virtual WindowQuadList buildQuads() const;
virtual WindowQuadList buildQuads( bool force = false ) const;
const Toplevel* window() const;
Toplevel* window();

View file

@ -138,6 +138,9 @@ void ShadowEffect::reconfigure( ReconfigureFlags )
updateShadowColor();
// Load decoration shadow related things
bool reconfiguring = false;
if( mShadowQuadTypes.count() )
reconfiguring = true;
mShadowQuadTypes.clear(); // Changed decoration? TODO: Unregister?
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
if( effects->compositingType() == OpenGLCompositing )
@ -178,6 +181,12 @@ void ShadowEffect::reconfigure( ReconfigureFlags )
}
}
#endif
if( reconfiguring )
{ // Force rebuild of all quads to clear their caches
foreach( EffectWindow *w, effects->stackingOrder() )
w->buildQuads( true );
}
}
void ShadowEffect::updateShadowColor()

View file

@ -837,9 +837,10 @@ class KWIN_EXPORT EffectWindow
* Returns the desired saturation of the shadow.
*/
virtual double shadowSaturation( ShadowType type ) const = 0;
// TODO internal?
virtual WindowQuadList buildQuads() const = 0;
/**
* Returns the unmodified window quad list. Can also be used to force rebuilding.
*/
virtual WindowQuadList buildQuads( bool force = false ) const = 0;
};
class KWIN_EXPORT EffectWindowGroup

View file

@ -447,9 +447,9 @@ void Scene::Window::disablePainting( int reason )
disable_painting |= reason;
}
WindowQuadList Scene::Window::buildQuads() const
WindowQuadList Scene::Window::buildQuads( bool force ) const
{
if( cached_quad_list != NULL )
if( cached_quad_list != NULL && !force )
return *cached_quad_list;
WindowQuadList ret;
if( toplevel->clientPos() == QPoint( 0, 0 ) && toplevel->clientSize() == toplevel->size())

View file

@ -182,7 +182,7 @@ class Scene::Window
void discardShape();
void updateToplevel( Toplevel* c );
// creates initial quad list for the window
virtual WindowQuadList buildQuads() const;
virtual WindowQuadList buildQuads( bool force = false ) const;
void suspendUnredirect( bool suspend );
protected:
WindowQuadList makeQuads( WindowQuadType type, const QRegion& reg ) const;