From dcebc7481bb3ce569e384c29691d599dbaf9b2cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Sun, 6 Mar 2011 21:15:09 +0100 Subject: [PATCH] ClientGroupItem* become signals This needs to be improved in core. Currently ClientGroup does not yet emit signals, as it would be difficult to connect them. Nevertheless the effects dependency should be removed. --- clientgroup.cpp | 6 +++--- effects.cpp | 15 ++++++--------- effects.h | 6 +++--- effects/slideback/slideback.cpp | 3 ++- effects/slideback/slideback.h | 3 +-- libkwineffects/kwineffects.cpp | 12 ------------ libkwineffects/kwineffects.h | 6 +++--- 7 files changed, 18 insertions(+), 33 deletions(-) diff --git a/clientgroup.cpp b/clientgroup.cpp index a349fff3a0..f8604b60ed 100644 --- a/clientgroup.cpp +++ b/clientgroup.cpp @@ -110,7 +110,7 @@ void ClientGroup::add(Client* c, int before, bool becomeVisible) // Notify effects of merge if (effects != NULL) - static_cast(effects)->clientGroupItemAdded( + static_cast(effects)->slotClientGroupItemAdded( c->effectWindow(), clients_[visible_]->effectWindow()); // Actually remove from old group if required and update @@ -165,7 +165,7 @@ void ClientGroup::remove(Client* c, const QRect& newGeom, bool toNullGroup) // Notify effects of removal if (effects) - static_cast(effects)->clientGroupItemRemoved( + static_cast(effects)->slotClientGroupItemRemoved( c->effectWindow(), newVisible->effectWindow()); setVisible(newVisible); // Display new window before removing old one @@ -258,7 +258,7 @@ void ClientGroup::setVisible(Client* c) // Notify effects of switch if (effects != NULL) - static_cast(effects)->clientGroupItemSwitched( + static_cast(effects)->slotClientGroupItemSwitched( clients_[visible_]->effectWindow(), c->effectWindow()); visible_ = indexOfClient(c); diff --git a/effects.cpp b/effects.cpp index 10a6a6df41..c2c401dbd1 100644 --- a/effects.cpp +++ b/effects.cpp @@ -364,22 +364,19 @@ void EffectsHandlerImpl::slotClientUnminimized(Client* c, bool animate) } } -void EffectsHandlerImpl::clientGroupItemSwitched(EffectWindow* from, EffectWindow* to) +void EffectsHandlerImpl::slotClientGroupItemSwitched(EffectWindow* from, EffectWindow* to) { - foreach (const EffectPair & ep, loaded_effects) - ep.second->clientGroupItemSwitched(from, to); + emit clientGroupItemSwitched(from, to); } -void EffectsHandlerImpl::clientGroupItemAdded(EffectWindow* from, EffectWindow* to) +void EffectsHandlerImpl::slotClientGroupItemAdded(EffectWindow* from, EffectWindow* to) { - foreach (const EffectPair & ep, loaded_effects) - ep.second->clientGroupItemAdded(from, to); + emit clientGroupItemAdded(from, to); } -void EffectsHandlerImpl::clientGroupItemRemoved(EffectWindow* c, EffectWindow* group) +void EffectsHandlerImpl::slotClientGroupItemRemoved(EffectWindow* c, EffectWindow* group) { - foreach (const EffectPair & ep, loaded_effects) - ep.second->clientGroupItemRemoved(c, group); + emit clientGroupItemRemoved(c, group); } void EffectsHandlerImpl::slotDesktopChanged(int old) diff --git a/effects.h b/effects.h index 7ea1ad071b..31ed151684 100644 --- a/effects.h +++ b/effects.h @@ -159,9 +159,6 @@ public: // internal (used by kwin core or compositing code) void startPaint(); void windowMoveResizeGeometryUpdate(EffectWindow* c, const QRect& geometry); - void clientGroupItemSwitched(EffectWindow* from, EffectWindow* to); - void clientGroupItemAdded(EffectWindow* from, EffectWindow* to); - void clientGroupItemRemoved(EffectWindow* c, EffectWindow* group); void windowDamaged(EffectWindow* w, const QRect& r); void windowGeometryShapeChanged(EffectWindow* w, const QRect& old); bool borderActivated(ElectricBorder border); @@ -184,6 +181,9 @@ public: public Q_SLOTS: void slotWindowUserMovedResized(EffectWindow* c, bool first, bool last); + void slotClientGroupItemSwitched(EffectWindow* from, EffectWindow* to); + void slotClientGroupItemAdded(EffectWindow* from, EffectWindow* to); + void slotClientGroupItemRemoved(EffectWindow* c, EffectWindow* group); protected Q_SLOTS: void slotDesktopChanged(int old); diff --git a/effects/slideback/slideback.cpp b/effects/slideback/slideback.cpp index 5f697aa5ff..5377025582 100644 --- a/effects/slideback/slideback.cpp +++ b/effects/slideback/slideback.cpp @@ -37,6 +37,7 @@ SlideBackEffect::SlideBackEffect() connect(effects, SIGNAL(windowActivated(EffectWindow*)), this, SLOT(slotWindowActivated(EffectWindow*))); connect(effects, SIGNAL(windowDeleted(EffectWindow*)), this, SLOT(slotWindowDeleted(EffectWindow*))); connect(effects, SIGNAL(windowUnminimized(EffectWindow*)), this, SLOT(slotWindowUnminimized(EffectWindow*))); + connect(effects, SIGNAL(clientGroupItemSwitched(EffectWindow*,EffectWindow*)), this, SLOT(slotClientGroupItemSwitched(EffectWindow*,EffectWindow*))); } static inline bool windowsShareDesktop(EffectWindow *w1, EffectWindow *w2) @@ -309,7 +310,7 @@ void SlideBackEffect::slotWindowUnminimized(EffectWindow* w) } } -void SlideBackEffect::clientGroupItemSwitched(EffectWindow* from, EffectWindow* to) +void SlideBackEffect::slotClientGroupItemSwitched(EffectWindow* from, EffectWindow* to) { clientItemShown = to; clientItemHidden = from; diff --git a/effects/slideback/slideback.h b/effects/slideback/slideback.h index 0f2480e47b..f48469b502 100644 --- a/effects/slideback/slideback.h +++ b/effects/slideback/slideback.h @@ -41,8 +41,6 @@ public: virtual void prePaintScreen(ScreenPrePaintData &data, int time); virtual void postPaintScreen(); - virtual void clientGroupItemSwitched(EffectWindow* from, EffectWindow* to); - virtual void tabBoxClosed(); public Q_SLOTS: @@ -50,6 +48,7 @@ public Q_SLOTS: void slotWindowActivated(EffectWindow *w); void slotWindowDeleted(EffectWindow *w); void slotWindowUnminimized(EffectWindow *w); + void slotClientGroupItemSwitched(EffectWindow* from, EffectWindow* to); private: diff --git a/libkwineffects/kwineffects.cpp b/libkwineffects/kwineffects.cpp index 8c2352fcde..b34f853d22 100644 --- a/libkwineffects/kwineffects.cpp +++ b/libkwineffects/kwineffects.cpp @@ -123,18 +123,6 @@ void Effect::windowMoveResizeGeometryUpdate(EffectWindow* , const QRect&) { } -void Effect::clientGroupItemSwitched(EffectWindow*, EffectWindow*) -{ -} - -void Effect::clientGroupItemAdded(EffectWindow*, EffectWindow*) -{ -} - -void Effect::clientGroupItemRemoved(EffectWindow*, EffectWindow*) -{ -} - void Effect::windowInputMouseEvent(Window, QEvent*) { } diff --git a/libkwineffects/kwineffects.h b/libkwineffects/kwineffects.h index d17488fc3f..fe6cfc3096 100644 --- a/libkwineffects/kwineffects.h +++ b/libkwineffects/kwineffects.h @@ -442,9 +442,6 @@ public: /** called when the geometry changed during moving/resizing. */ virtual void windowMoveResizeGeometryUpdate(EffectWindow* c, const QRect& geometry); - virtual void clientGroupItemSwitched(EffectWindow* from, EffectWindow* to); - virtual void clientGroupItemAdded(EffectWindow* from, EffectWindow* to); // from merged with to - virtual void clientGroupItemRemoved(EffectWindow* c, EffectWindow* group); // c removed from group virtual void windowInputMouseEvent(Window w, QEvent* e); virtual void windowDamaged(EffectWindow* w, const QRect& r); virtual void windowGeometryShapeChanged(EffectWindow* w, const QRect& old); @@ -926,6 +923,9 @@ Q_SIGNALS: * @since 4.7 **/ void tabBoxKeyEvent(QKeyEvent* event); + void clientGroupItemSwitched(EffectWindow* from, EffectWindow* to); + void clientGroupItemAdded(EffectWindow* from, EffectWindow* to); // from merged with to + void clientGroupItemRemoved(EffectWindow* c, EffectWindow* group); // c removed from group protected: QVector< EffectPair > loaded_effects;