diff --git a/effects.cpp b/effects.cpp index ea95327486..fcce0d6988 100644 --- a/effects.cpp +++ b/effects.cpp @@ -103,15 +103,10 @@ EffectsHandlerImpl::EffectsHandlerImpl(CompositingType type) connect(ws, SIGNAL(deletedRemoved(KWin::Deleted*)), this, SLOT(slotDeletedRemoved(KWin::Deleted*))); // connect all clients foreach (Client *c, ws->clientList()) { - connect(c, SIGNAL(clientClosed(KWin::Client*)), this, SLOT(slotClientClosed(KWin::Client*))); - connect(c, SIGNAL(clientMaximizedStateChanged(KWin::Client*,KDecorationDefines::MaximizeMode)), this, SLOT(slotClientMaximized(KWin::Client*,KDecorationDefines::MaximizeMode))); - connect(c, SIGNAL(opacityChanged(KWin::Toplevel*,qreal)), this, SLOT(slotOpacityChanged(KWin::Toplevel*,qreal))); - connect(c, SIGNAL(clientMinimized(KWin::Client*,bool)), this, SLOT(slotClientMinimized(KWin::Client*,bool))); - connect(c, SIGNAL(clientUnminimized(KWin::Client*,bool)), this, SLOT(slotClientUnminimized(KWin::Client*,bool))); + setupClientConnections(c); } foreach (Unmanaged *u, ws->unmanagedList()) { - connect(u, SIGNAL(unmanagedClosed(KWin::Unmanaged*)), this, SLOT(slotUnmanagedClosed(KWin::Unmanaged*))); - connect(u, SIGNAL(opacityChanged(KWin::Toplevel*,qreal)), this, SLOT(slotOpacityChanged(KWin::Toplevel*,qreal))); + setupUnmanagedConnections(u); } reconfigure(); } @@ -126,6 +121,21 @@ EffectsHandlerImpl::~EffectsHandlerImpl() XDestroyWindow(display(), pos.second); } +void EffectsHandlerImpl::setupClientConnections(Client* c) +{ + connect(c, SIGNAL(clientClosed(KWin::Client*)), this, SLOT(slotClientClosed(KWin::Client*))); + connect(c, SIGNAL(clientMaximizedStateChanged(KWin::Client*,KDecorationDefines::MaximizeMode)), this, SLOT(slotClientMaximized(KWin::Client*,KDecorationDefines::MaximizeMode))); + connect(c, SIGNAL(opacityChanged(KWin::Toplevel*,qreal)), this, SLOT(slotOpacityChanged(KWin::Toplevel*,qreal))); + connect(c, SIGNAL(clientMinimized(KWin::Client*,bool)), this, SLOT(slotClientMinimized(KWin::Client*,bool))); + connect(c, SIGNAL(clientUnminimized(KWin::Client*,bool)), this, SLOT(slotClientUnminimized(KWin::Client*,bool))); +} + +void EffectsHandlerImpl::setupUnmanagedConnections(Unmanaged* u) +{ + connect(u, SIGNAL(unmanagedClosed(KWin::Unmanaged*)), this, SLOT(slotUnmanagedClosed(KWin::Unmanaged*))); + connect(u, SIGNAL(opacityChanged(KWin::Toplevel*,qreal)), this, SLOT(slotOpacityChanged(KWin::Toplevel*,qreal))); +} + void EffectsHandlerImpl::reconfigure() { KSharedConfig::Ptr _config = KGlobal::config(); @@ -301,18 +311,13 @@ void EffectsHandlerImpl::slotOpacityChanged(Toplevel *t, qreal oldOpacity) void EffectsHandlerImpl::slotClientAdded(Client *c) { - connect(c, SIGNAL(clientClosed(KWin::Client*)), this, SLOT(slotClientClosed(KWin::Client*))); - connect(c, SIGNAL(clientMaximizedStateChanged(KWin::Client*,KDecorationDefines::MaximizeMode)), this, SLOT(slotClientMaximized(KWin::Client*,KDecorationDefines::MaximizeMode))); - connect(c, SIGNAL(opacityChanged(KWin::Toplevel*,qreal)), this, SLOT(slotOpacityChanged(KWin::Toplevel*,qreal))); - connect(c, SIGNAL(clientMinimized(KWin::Client*,bool)), this, SLOT(slotClientMinimized(KWin::Client*,bool))); - connect(c, SIGNAL(clientUnminimized(KWin::Client*,bool)), this, SLOT(slotClientUnminimized(KWin::Client*,bool))); + setupClientConnections(c); emit windowAdded(c->effectWindow()); } void EffectsHandlerImpl::slotUnmanagedAdded(Unmanaged *u) { - connect(u, SIGNAL(unmanagedClosed(KWin::Unmanaged*)), this, SLOT(slotUnmanagedClosed(KWin::Unmanaged*))); - connect(u, SIGNAL(opacityChanged(KWin::Toplevel*,qreal)), this, SLOT(slotOpacityChanged(KWin::Toplevel*,qreal))); + setupUnmanagedConnections(u); emit windowAdded(u->effectWindow()); } diff --git a/effects.h b/effects.h index c2cadf9d57..98d7375261 100644 --- a/effects.h +++ b/effects.h @@ -206,6 +206,8 @@ protected Q_SLOTS: protected: KLibrary* findEffectLibrary(KService* service); void effectsChanged(); + void setupClientConnections(KWin::Client *c); + void setupUnmanagedConnections(KWin::Unmanaged *u); Effect* keyboard_grab_effect; QStack render_targets;