const & in foreach

svn path=/trunk/KDE/kdebase/workspace/; revision=801427
This commit is contained in:
Albert Astals Cid 2008-04-26 16:03:02 +00:00
parent 84664f2ba6
commit 3b9121ec3f
9 changed files with 45 additions and 45 deletions

View file

@ -59,9 +59,9 @@ EffectsHandlerImpl::~EffectsHandlerImpl()
{
if( keyboard_grab_effect != NULL )
ungrabKeyboard();
foreach( EffectPair ep, loaded_effects )
foreach( const EffectPair &ep, loaded_effects )
unloadEffect( ep.first );
foreach( InputWindowPair pos, input_windows )
foreach( const InputWindowPair &pos, input_windows )
XDestroyWindow( display(), pos.second );
}
@ -73,7 +73,7 @@ void EffectsHandlerImpl::reconfigure()
KService::List offers = KServiceTypeTrader::self()->query("KWin/Effect");
QStringList effectsToBeLoaded;
// First unload necessary effects
foreach( KService::Ptr service, offers )
foreach( const KService::Ptr &service, offers )
{
KPluginInfo plugininfo( service );
plugininfo.load( conf );
@ -86,7 +86,7 @@ void EffectsHandlerImpl::reconfigure()
effectsToBeLoaded.append( plugininfo.pluginName() );
}
// Then load those that should be loaded
foreach( QString effectName, effectsToBeLoaded )
foreach( const QString &effectName, effectsToBeLoaded )
{
if( !isEffectLoaded( effectName ))
{
@ -180,7 +180,7 @@ void EffectsHandlerImpl::startPaint()
void EffectsHandlerImpl::windowUserMovedResized( EffectWindow* c, bool first, bool last )
{
foreach( EffectPair ep, loaded_effects )
foreach( const EffectPair &ep, loaded_effects )
ep.second->windowUserMovedResized( c, first, last );
}
@ -188,50 +188,50 @@ void EffectsHandlerImpl::windowOpacityChanged( EffectWindow* c, double old_opaci
{
if( static_cast<EffectWindowImpl*>(c)->window()->opacity() == old_opacity )
return;
foreach( EffectPair ep, loaded_effects )
foreach( const EffectPair &ep, loaded_effects )
ep.second->windowOpacityChanged( c, old_opacity );
}
void EffectsHandlerImpl::windowAdded( EffectWindow* c )
{
foreach( EffectPair ep, loaded_effects )
foreach( const EffectPair &ep, loaded_effects )
ep.second->windowAdded( c );
}
void EffectsHandlerImpl::windowDeleted( EffectWindow* c )
{
foreach( EffectPair ep, loaded_effects )
foreach( const EffectPair &ep, loaded_effects )
ep.second->windowDeleted( c );
elevated_windows.removeAll( c );
}
void EffectsHandlerImpl::windowClosed( EffectWindow* c )
{
foreach( EffectPair ep, loaded_effects )
foreach( const EffectPair &ep, loaded_effects )
ep.second->windowClosed( c );
}
void EffectsHandlerImpl::windowActivated( EffectWindow* c )
{
foreach( EffectPair ep, loaded_effects )
foreach( const EffectPair &ep, loaded_effects )
ep.second->windowActivated( c );
}
void EffectsHandlerImpl::windowMinimized( EffectWindow* c )
{
foreach( EffectPair ep, loaded_effects )
foreach( const EffectPair &ep, loaded_effects )
ep.second->windowMinimized( c );
}
void EffectsHandlerImpl::windowUnminimized( EffectWindow* c )
{
foreach( EffectPair ep, loaded_effects )
foreach( const EffectPair &ep, loaded_effects )
ep.second->windowUnminimized( c );
}
void EffectsHandlerImpl::desktopChanged( int old )
{
foreach( EffectPair ep, loaded_effects )
foreach( const EffectPair &ep, loaded_effects )
ep.second->desktopChanged( old );
}
@ -239,7 +239,7 @@ void EffectsHandlerImpl::windowDamaged( EffectWindow* w, const QRect& r )
{
if( w == NULL )
return;
foreach( EffectPair ep, loaded_effects )
foreach( const EffectPair &ep, loaded_effects )
ep.second->windowDamaged( w, r );
}
@ -247,25 +247,25 @@ void EffectsHandlerImpl::windowGeometryShapeChanged( EffectWindow* w, const QRec
{
if( w == NULL ) // during late cleanup effectWindow() may be already NULL
return; // in some functions that may still call this
foreach( EffectPair ep, loaded_effects )
foreach( const EffectPair &ep, loaded_effects )
ep.second->windowGeometryShapeChanged( w, old );
}
void EffectsHandlerImpl::tabBoxAdded( int mode )
{
foreach( EffectPair ep, loaded_effects )
foreach( const EffectPair &ep, loaded_effects )
ep.second->tabBoxAdded( mode );
}
void EffectsHandlerImpl::tabBoxClosed()
{
foreach( EffectPair ep, loaded_effects )
foreach( const EffectPair &ep, loaded_effects )
ep.second->tabBoxClosed();
}
void EffectsHandlerImpl::tabBoxUpdated()
{
foreach( EffectPair ep, loaded_effects )
foreach( const EffectPair &ep, loaded_effects )
ep.second->tabBoxUpdated();
}
@ -282,7 +282,7 @@ Effect* EffectsHandlerImpl::activeFullScreenEffect() const
bool EffectsHandlerImpl::borderActivated( ElectricBorder border )
{
bool ret = false;
foreach( EffectPair ep, loaded_effects )
foreach( const EffectPair &ep, loaded_effects )
if( ep.second->borderActivated( border ))
ret = true; // bail out or tell all?
return ret;
@ -292,7 +292,7 @@ void EffectsHandlerImpl::mouseChanged( const QPoint& pos, const QPoint& oldpos,
Qt::MouseButtons buttons, Qt::MouseButtons oldbuttons,
Qt::KeyboardModifiers modifiers, Qt::KeyboardModifiers oldmodifiers )
{
foreach( EffectPair ep, loaded_effects )
foreach( const EffectPair &ep, loaded_effects )
ep.second->mouseChanged( pos, oldpos, buttons, oldbuttons, modifiers, oldmodifiers );
}
@ -329,7 +329,7 @@ void EffectsHandlerImpl::propertyNotify( EffectWindow* c, long atom )
{
if( !registered_atoms.contains( atom ))
return;
foreach( EffectPair ep, loaded_effects )
foreach( const EffectPair &ep, loaded_effects )
ep.second->propertyNotify( c, atom );
}
@ -583,7 +583,7 @@ Window EffectsHandlerImpl::createInputWindow( Effect* e, int x, int y, int w, in
void EffectsHandlerImpl::destroyInputWindow( Window w )
{
foreach( InputWindowPair pos, input_windows )
foreach( const InputWindowPair &pos, input_windows )
{
if( pos.second == w )
{
@ -599,7 +599,7 @@ bool EffectsHandlerImpl::checkInputWindowEvent( XEvent* e )
{
if( e->type != ButtonPress && e->type != ButtonRelease && e->type != MotionNotify )
return false;
foreach( InputWindowPair pos, input_windows )
foreach( const InputWindowPair &pos, input_windows )
{
if( pos.second == e->xany.window )
{
@ -648,7 +648,7 @@ void EffectsHandlerImpl::checkInputWindowStacking()
return;
Window* wins = new Window[ input_windows.count() ];
int pos = 0;
foreach( InputWindowPair it, input_windows )
foreach( const InputWindowPair &it, input_windows )
wins[ pos++ ] = it.second;
XRaiseWindow( display(), wins[ 0 ] );
XRestackWindows( display(), wins, pos );
@ -797,7 +797,7 @@ bool EffectsHandlerImpl::loadEffect( const QString& name )
// TODO: detect circular deps
KPluginInfo plugininfo( service );
QStringList dependencies = plugininfo.dependencies();
foreach( QString depName, dependencies )
foreach( const QString &depName, dependencies )
{
if( !loadEffect(depName))
{
@ -866,7 +866,7 @@ void EffectsHandlerImpl::effectsChanged()
{
loaded_effects.clear();
// kDebug(1212) << "Recreating effects' list:";
foreach( EffectPair effect, effect_order )
foreach( const EffectPair &effect, effect_order )
{
// kDebug(1212) << effect.first;
loaded_effects.append( effect );

View file

@ -303,7 +303,7 @@ void BlurEffect::updateBlurTexture(const QRegion& region)
QRect bounding = region.boundingRect();
QVector<QRect> rects = region.rects();
int totalarea = 0;
foreach( QRect r, rects )
foreach( const QRect &r, rects )
totalarea += r.width() * r.height();
if( (int)(totalarea * 1.33 + 100 ) < bounding.width() * bounding.height() )
{
@ -329,7 +329,7 @@ void BlurEffect::updateBlurTexture(const QVector<QRect>& rects)
mSceneTexture->bind();
foreach( QRect r, rects )
foreach( const QRect &r, rects )
{
// We change x coordinates here because horizontal blur pass (which
// comes after this one) also uses pixels that are horizontally edging
@ -354,7 +354,7 @@ void BlurEffect::updateBlurTexture(const QVector<QRect>& rects)
mTmpTexture->bind();
foreach( QRect r, rects )
foreach( const QRect &r, rects )
{
glBegin(GL_QUADS);
glVertex2f( r.x() , r.y() + r.height() );

View file

@ -112,7 +112,7 @@ void ShadowEffect::drawWindow( EffectWindow* w, int mask, QRegion region, Window
if( !shadowDatas.isEmpty())
d.clip |= shadowDatas.last().clip;
d.mask = mask;
foreach(QRect r, region.rects())
foreach(const QRect &r, region.rects())
d.region |= shadowRectangle(r);
d.region &= region;
shadowDatas.append(d);

View file

@ -67,7 +67,7 @@ void TaskbarThumbnailEffect::paintWindow( EffectWindow* w, int mask, QRegion reg
effects->paintWindow( w, mask, region, data ); // paint window first
if( thumbnails.contains( w ))
{ // paint thumbnails on it
foreach( const Data thumb, thumbnails.values( w ))
foreach( const Data &thumb, thumbnails.values( w ))
{
EffectWindow* thumbw = effects->findWindow( thumb.window );
if( thumbw == NULL )

View file

@ -51,7 +51,7 @@ void FlameEffect::paintWindow( EffectWindow* w, int mask, QRegion region, Window
{
WindowQuadList new_quads;
double ylimit = windows[ w ] * w->height(); // parts above this are already away
foreach( WindowQuad quad, data.quads )
foreach( const WindowQuad &quad, data.quads )
{
if( quad.bottom() <= ylimit )
continue;

View file

@ -92,7 +92,7 @@ void VideoRecordEffect::postPaintScreen()
if( CapturyProcessRegionStart( client ) == CAPTURY_SUCCESS )
{
capture_region &= QRect( 0, 0, displayWidth(), displayHeight()); // limit to screen
foreach( QRect r, capture_region.rects())
foreach( const QRect &r, capture_region.rects())
{
int gly = displayHeight() - r.y() - r.height(); // opengl coords
CapturyProcessRegion( client, r.x(), gly, r.width(), r.height());

View file

@ -191,7 +191,7 @@ void Scene::paintGenericScreen( int orig_mask, ScreenPaintData )
// preparation step
effects->prePaintWindow( effectWindow( w ), data, time_diff );
#ifndef NDEBUG
foreach( WindowQuad q, data.quads )
foreach( const WindowQuad &q, data.quads )
if( q.isTransformed())
kFatal( 1212 ) << "Pre-paint calls are not allowed to transform quads!" ;
#endif
@ -200,7 +200,7 @@ void Scene::paintGenericScreen( int orig_mask, ScreenPaintData )
phase2.append( Phase2Data( w, infiniteRegion(), data.clip, data.mask, data.quads ));
}
foreach( Phase2Data d, phase2 )
foreach( const Phase2Data &d, phase2 )
paintWindow( d.window, d.mask, d.region, d.quads );
}
@ -230,7 +230,7 @@ void Scene::paintSimpleScreen( int orig_mask, QRegion region )
// preparation step
effects->prePaintWindow( effectWindow( w ), data, time_diff );
#ifndef NDEBUG
foreach( WindowQuad q, data.quads )
foreach( const WindowQuad &q, data.quads )
if( q.isTransformed())
kFatal( 1212 ) << "Pre-paint calls are not allowed to transform quads!" ;
#endif
@ -438,7 +438,7 @@ WindowQuadList Scene::Window::buildQuads() const
WindowQuadList Scene::Window::makeQuads( WindowQuadType type, const QRegion& reg ) const
{
WindowQuadList ret;
foreach( QRect r, reg.rects())
foreach( const QRect &r, reg.rects())
{
WindowQuad quad( type );
// TODO asi mam spatne pravy dolni roh - bud tady, nebo v jinych castech

View file

@ -645,7 +645,7 @@ void SceneOpenGL::flushBuffer( int mask, QRegion damage )
waitSync();
if( glXCopySubBuffer )
{
foreach( QRect r, damage.rects())
foreach( const QRect &r, damage.rects())
{
// convert to OpenGL coordinates
int y = displayHeight() - r.y() - r.height();
@ -658,7 +658,7 @@ void SceneOpenGL::flushBuffer( int mask, QRegion damage )
glDrawBuffer( GL_FRONT );
int xpos = 0;
int ypos = 0;
foreach( QRect r, damage.rects())
foreach( const QRect &r, damage.rects())
{
// convert to OpenGL coordinates
int y = displayHeight() - r.y() - r.height();
@ -691,7 +691,7 @@ void SceneOpenGL::flushBuffer( int mask, QRegion damage )
glXWaitGL();
waitSync();
if( mask & PAINT_SCREEN_REGION )
foreach( QRect r, damage.rects())
foreach( const QRect &r, damage.rects())
XCopyArea( display(), buffer, rootWindow(), gcroot, r.x(), r.y(), r.width(), r.height(), r.x(), r.y());
else
XCopyArea( display(), buffer, rootWindow(), gcroot, 0, 0, displayWidth(), displayHeight(), 0, 0 );
@ -877,7 +877,7 @@ QRegion SceneOpenGL::Texture::optimizeBindDamage( const QRegion& reg, int limit
// between all the areas and the bounding rectangle is small, simply use
// only the bounding rectangle
int size = 0;
foreach( QRect r, reg.rects())
foreach( const QRect &r, reg.rects())
size += r.width() * r.height();
if( reg.boundingRect().width() * reg.boundingRect().height() - size < limit )
return reg.boundingRect();
@ -983,7 +983,7 @@ bool SceneOpenGL::Texture::load( const Pixmap& pix, const QSize& size,
mSize.width(), mSize.height(), depth );
QRegion damage = optimizeBindDamage( region, 100 * 100 );
glPixelStorei( GL_UNPACK_ROW_LENGTH, mSize.width());
foreach( QRect r, damage.rects())
foreach( const QRect &r, damage.rects())
{ // TODO for small areas it might be faster to not use SHM to avoid the XSync()
XCopyArea( display(), pix, p, gc, r.x(), r.y(), r.width(), r.height(), 0, 0 );
glXWaitX();
@ -1030,7 +1030,7 @@ bool SceneOpenGL::Texture::load( const Pixmap& pix, const QSize& size,
{
glBindTexture( mTarget, mTexture );
QRegion damage = optimizeBindDamage( region, 30 * 30 );
foreach( QRect r, damage.rects())
foreach( const QRect &r, damage.rects())
{
// convert to OpenGL coordinates (this is mapping
// the pixmap to a texture, this is not affected

View file

@ -222,7 +222,7 @@ void SceneXrender::paintTransformedScreen( int orig_mask )
// preparation step
effects->prePaintWindow( effectWindow( w ), data, time_diff );
#ifndef NDEBUG
foreach( WindowQuad q, data.quads )
foreach( const WindowQuad &q, data.quads )
if( q.isTransformed())
kFatal( 1212 ) << "Pre-paint calls are not allowed to transform quads!" ;
#endif
@ -254,7 +254,7 @@ void SceneXrender::paintTransformedScreen( int orig_mask )
// That we draw bottom to top is important now since we're drawing translucent objects
// and also are clipping only by opaque windows.
QRegion add_paint;
foreach( Phase2Data d, phase2 )
foreach( const Phase2Data &d, phase2 )
{
Scene::Window* w = d.window;
paintWindow( w, d.mask, d.region | add_paint, d.quads );