From e355700e6e3ca997b42ca621b73f70f65b605154 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Sun, 27 Feb 2011 10:47:42 +0100 Subject: [PATCH] EffectsHandler emits windowDeleted signal Workspace emits a deletedRemoved signal which the EffectsHandlerImpl translates into a windowDeleted signal. --- effects.cpp | 8 ++++---- effects.h | 3 ++- effects/desktopgrid/desktopgrid.cpp | 3 ++- effects/desktopgrid/desktopgrid.h | 2 +- effects/diminactive/diminactive.cpp | 3 ++- effects/diminactive/diminactive.h | 2 +- effects/explosion/explosion.cpp | 3 ++- effects/explosion/explosion.h | 3 +-- effects/fade/fade.cpp | 3 ++- effects/fade/fade.h | 2 +- effects/fallapart/fallapart.cpp | 3 ++- effects/fallapart/fallapart.h | 2 +- effects/glide/glide.cpp | 3 ++- effects/glide/glide.h | 3 +-- effects/highlightwindow/highlightwindow.cpp | 3 ++- effects/highlightwindow/highlightwindow.h | 3 +-- effects/logout/logout.cpp | 3 ++- effects/logout/logout.h | 2 +- effects/magiclamp/magiclamp.cpp | 3 ++- effects/magiclamp/magiclamp.h | 5 ++++- effects/minimizeanimation/minimizeanimation.cpp | 3 ++- effects/minimizeanimation/minimizeanimation.h | 5 ++++- effects/presentwindows/presentwindows.cpp | 3 ++- effects/presentwindows/presentwindows.h | 2 +- effects/sheet/sheet.cpp | 3 ++- effects/sheet/sheet.h | 3 +-- effects/slideback/slideback.cpp | 3 ++- effects/slideback/slideback.h | 2 +- effects/slidingpopups/slidingpopups.cpp | 3 ++- effects/slidingpopups/slidingpopups.h | 2 +- effects/taskbarthumbnail/taskbarthumbnail.cpp | 3 ++- effects/taskbarthumbnail/taskbarthumbnail.h | 2 +- libkwineffects/kwineffects.cpp | 4 ---- libkwineffects/kwineffects.h | 13 ++++++++++++- workspace.cpp | 3 +-- workspace.h | 1 + 36 files changed, 71 insertions(+), 46 deletions(-) diff --git a/effects.cpp b/effects.cpp index 4e5df1209..6e0c8cf5d 100644 --- a/effects.cpp +++ b/effects.cpp @@ -100,6 +100,7 @@ EffectsHandlerImpl::EffectsHandlerImpl(CompositingType type) connect(ws, SIGNAL(clientAdded(KWin::Client*)), this, SLOT(slotClientAdded(KWin::Client*))); connect(ws, SIGNAL(unmanagedAdded(KWin::Unmanaged*)), this, SLOT(slotUnmanagedAdded(KWin::Unmanaged*))); connect(ws, SIGNAL(clientActivated(KWin::Client*)), this, SLOT(slotClientActivated(KWin::Client*))); + 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*))); @@ -303,11 +304,10 @@ void EffectsHandlerImpl::slotUnmanagedAdded(Unmanaged *u) emit windowAdded(u->effectWindow()); } -void EffectsHandlerImpl::windowDeleted(EffectWindow* c) +void EffectsHandlerImpl::slotDeletedRemoved(KWin::Deleted *d) { - foreach (const EffectPair & ep, loaded_effects) - ep.second->windowDeleted(c); - elevated_windows.removeAll(c); + emit windowDeleted(d->effectWindow()); + elevated_windows.removeAll(d->effectWindow()); } void EffectsHandlerImpl::slotClientClosed(Client *c) diff --git a/effects.h b/effects.h index 4e51e6de8..d2b655c9d 100644 --- a/effects.h +++ b/effects.h @@ -37,6 +37,7 @@ namespace KWin { class Client; +class Deleted; class Unmanaged; class EffectsHandlerImpl : public EffectsHandler @@ -160,7 +161,6 @@ public: void windowUserMovedResized(EffectWindow* c, bool first, bool last); void windowMoveResizeGeometryUpdate(EffectWindow* c, const QRect& geometry); void windowOpacityChanged(EffectWindow* c, double old_opacity); - void windowDeleted(EffectWindow* c); void windowMinimized(EffectWindow* c); void windowUnminimized(EffectWindow* c); void clientGroupItemSwitched(EffectWindow* from, EffectWindow* to); @@ -198,6 +198,7 @@ protected Q_SLOTS: void slotClientClosed(KWin::Client *c); void slotUnmanagedClosed(KWin::Unmanaged *u); void slotClientActivated(KWin::Client *c); + void slotDeletedRemoved(KWin::Deleted *d); protected: KLibrary* findEffectLibrary(KService* service); diff --git a/effects/desktopgrid/desktopgrid.cpp b/effects/desktopgrid/desktopgrid.cpp index 2d8d82d52..4fa4267d5 100644 --- a/effects/desktopgrid/desktopgrid.cpp +++ b/effects/desktopgrid/desktopgrid.cpp @@ -75,6 +75,7 @@ DesktopGridEffect::DesktopGridEffect() connect(a, SIGNAL(globalShortcutChanged(QKeySequence)), this, SLOT(globalShortcutChanged(QKeySequence))); connect(effects, SIGNAL(windowAdded(EffectWindow*)), this, SLOT(slotWindowAdded(EffectWindow*))); connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*))); + connect(effects, SIGNAL(windowDeleted(EffectWindow*)), this, SLOT(slotWindowDeleted(EffectWindow*))); // Load all other configuration details reconfigure(ReconfigureAll); @@ -425,7 +426,7 @@ void DesktopGridEffect::slotWindowClosed(EffectWindow* w) effects->addRepaintFull(); } -void DesktopGridEffect::windowDeleted(EffectWindow* w) +void DesktopGridEffect::slotWindowDeleted(EffectWindow* w) { for (QHash< DesktopButtonsView*, EffectWindow*>::iterator it = m_desktopButtonsViews.begin(); it != m_desktopButtonsViews.end(); ++it) { diff --git a/effects/desktopgrid/desktopgrid.h b/effects/desktopgrid/desktopgrid.h index 6fc66dce0..17aadeb21 100644 --- a/effects/desktopgrid/desktopgrid.h +++ b/effects/desktopgrid/desktopgrid.h @@ -71,7 +71,6 @@ public: virtual void postPaintScreen(); virtual void prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time); virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data); - virtual void windowDeleted(EffectWindow* w); virtual void windowGeometryShapeChanged(EffectWindow* w, const QRect& old); virtual void windowInputMouseEvent(Window w, QEvent* e); virtual void grabbedKeyboardEvent(QKeyEvent* e); @@ -89,6 +88,7 @@ private slots: void slotRemoveDesktop(); void slotWindowAdded(EffectWindow* w); void slotWindowClosed(EffectWindow *w); + void slotWindowDeleted(EffectWindow *w); private: QPointF scalePos(const QPoint& pos, int desktop, int screen = -1) const; diff --git a/effects/diminactive/diminactive.cpp b/effects/diminactive/diminactive.cpp index aa8038950..6e568964a 100644 --- a/effects/diminactive/diminactive.cpp +++ b/effects/diminactive/diminactive.cpp @@ -36,6 +36,7 @@ DimInactiveEffect::DimInactiveEffect() active = effects->activeWindow(); previousActive = NULL; connect(effects, SIGNAL(windowActivated(EffectWindow*)), this, SLOT(slotWindowActivated(EffectWindow*))); + connect(effects, SIGNAL(windowDeleted(EffectWindow*)), this, SLOT(slotWindowDeleted(EffectWindow*))); } void DimInactiveEffect::reconfigure(ReconfigureFlags) @@ -100,7 +101,7 @@ bool DimInactiveEffect::dimWindow(const EffectWindow* w) const return true; // dim the rest } -void DimInactiveEffect::windowDeleted(EffectWindow* w) +void DimInactiveEffect::slotWindowDeleted(EffectWindow* w) { if (w == previousActive) previousActive = NULL; diff --git a/effects/diminactive/diminactive.h b/effects/diminactive/diminactive.h index e1bfd8f18..543a7436f 100644 --- a/effects/diminactive/diminactive.h +++ b/effects/diminactive/diminactive.h @@ -38,10 +38,10 @@ public: virtual void reconfigure(ReconfigureFlags); virtual void prePaintScreen(ScreenPrePaintData& data, int time); virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data); - virtual void windowDeleted(EffectWindow* w); public Q_SLOTS: void slotWindowActivated(EffectWindow* c); + void slotWindowDeleted(EffectWindow *w); private: bool dimWindow(const EffectWindow* w) const; diff --git a/effects/explosion/explosion.cpp b/effects/explosion/explosion.cpp index 679dd6c74..c148efaa7 100644 --- a/effects/explosion/explosion.cpp +++ b/effects/explosion/explosion.cpp @@ -47,6 +47,7 @@ ExplosionEffect::ExplosionEffect() : Effect() mValid = true; mInited = false; connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*))); + connect(effects, SIGNAL(windowDeleted(EffectWindow*)), this, SLOT(slotWindowDeleted(EffectWindow*))); } ExplosionEffect::~ExplosionEffect() @@ -194,7 +195,7 @@ void ExplosionEffect::slotWindowClosed(EffectWindow* c) } } -void ExplosionEffect::windowDeleted(EffectWindow* c) +void ExplosionEffect::slotWindowDeleted(EffectWindow* c) { mWindows.remove(c); } diff --git a/effects/explosion/explosion.h b/effects/explosion/explosion.h index 5eb9e7f12..b112ab198 100644 --- a/effects/explosion/explosion.h +++ b/effects/explosion/explosion.h @@ -48,12 +48,11 @@ public: virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data); virtual void postPaintScreen(); - virtual void windowDeleted(EffectWindow* c); - static bool supported(); public Q_SLOTS: void slotWindowClosed(EffectWindow *c); + void slotWindowDeleted(EffectWindow *w); protected: bool loadData(); diff --git a/effects/fade/fade.cpp b/effects/fade/fade.cpp index 330aa2fdf..ef92feb98 100644 --- a/effects/fade/fade.cpp +++ b/effects/fade/fade.cpp @@ -32,6 +32,7 @@ FadeEffect::FadeEffect() reconfigure(ReconfigureAll); connect(effects, SIGNAL(windowAdded(EffectWindow*)), this, SLOT(slotWindowAdded(EffectWindow*))); connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*))); + connect(effects, SIGNAL(windowDeleted(EffectWindow*)), this, SLOT(slotWindowDeleted(EffectWindow*))); } void FadeEffect::reconfigure(ReconfigureFlags) @@ -176,7 +177,7 @@ void FadeEffect::slotWindowClosed(EffectWindow* w) w->addRepaintFull(); } -void FadeEffect::windowDeleted(EffectWindow* w) +void FadeEffect::slotWindowDeleted(EffectWindow* w) { windows.remove(w); } diff --git a/effects/fade/fade.h b/effects/fade/fade.h index c4285110e..487dd2ddd 100644 --- a/effects/fade/fade.h +++ b/effects/fade/fade.h @@ -39,13 +39,13 @@ public: // TODO react also on virtual desktop changes virtual void windowOpacityChanged(EffectWindow* c, double old_opacity); - virtual void windowDeleted(EffectWindow* c); bool isFadeWindow(EffectWindow* w); public Q_SLOTS: void slotWindowAdded(EffectWindow* c); void slotWindowClosed(EffectWindow *c); + void slotWindowDeleted(EffectWindow *w); private: class WindowInfo; QHash< const EffectWindow*, WindowInfo > windows; diff --git a/effects/fallapart/fallapart.cpp b/effects/fallapart/fallapart.cpp index ac16fc8d9..16fd6130c 100644 --- a/effects/fallapart/fallapart.cpp +++ b/effects/fallapart/fallapart.cpp @@ -33,6 +33,7 @@ FallApartEffect::FallApartEffect() { reconfigure(ReconfigureAll); connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*))); + connect(effects, SIGNAL(windowDeleted(EffectWindow*)), this, SLOT(slotWindowDeleted(EffectWindow*))); } void FallApartEffect::reconfigure(ReconfigureFlags) @@ -154,7 +155,7 @@ void FallApartEffect::slotWindowClosed(EffectWindow* c) c->refWindow(); } -void FallApartEffect::windowDeleted(EffectWindow* c) +void FallApartEffect::slotWindowDeleted(EffectWindow* c) { windows.remove(c); } diff --git a/effects/fallapart/fallapart.h b/effects/fallapart/fallapart.h index 11c1762db..a29ea0bca 100644 --- a/effects/fallapart/fallapart.h +++ b/effects/fallapart/fallapart.h @@ -37,10 +37,10 @@ public: virtual void prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time); virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data); virtual void postPaintScreen(); - virtual void windowDeleted(EffectWindow* c); public Q_SLOTS: void slotWindowClosed(EffectWindow *c); + void slotWindowDeleted(EffectWindow *w); private: QHash< const EffectWindow*, double > windows; diff --git a/effects/glide/glide.cpp b/effects/glide/glide.cpp index 12f974ec2..93467693f 100644 --- a/effects/glide/glide.cpp +++ b/effects/glide/glide.cpp @@ -39,6 +39,7 @@ GlideEffect::GlideEffect() reconfigure(ReconfigureAll); connect(effects, SIGNAL(windowAdded(EffectWindow*)), this, SLOT(slotWindowAdded(EffectWindow*))); connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*))); + connect(effects, SIGNAL(windowDeleted(EffectWindow*)), this, SLOT(slotWindowDeleted(EffectWindow*))); } bool GlideEffect::supported() @@ -202,7 +203,7 @@ void GlideEffect::slotWindowClosed(EffectWindow* w) w->addRepaintFull(); } -void GlideEffect::windowDeleted(EffectWindow* w) +void GlideEffect::slotWindowDeleted(EffectWindow* w) { windows.remove(w); } diff --git a/effects/glide/glide.h b/effects/glide/glide.h index 9e61bfe10..09464d995 100644 --- a/effects/glide/glide.h +++ b/effects/glide/glide.h @@ -40,12 +40,11 @@ public: virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data); virtual void postPaintWindow(EffectWindow* w); - virtual void windowDeleted(EffectWindow* c); - static bool supported(); public Q_SLOTS: void slotWindowAdded(EffectWindow* c); void slotWindowClosed(EffectWindow *c); + void slotWindowDeleted(EffectWindow *w); private: class WindowInfo; diff --git a/effects/highlightwindow/highlightwindow.cpp b/effects/highlightwindow/highlightwindow.cpp index 779669ebc..2ee28b5cd 100644 --- a/effects/highlightwindow/highlightwindow.cpp +++ b/effects/highlightwindow/highlightwindow.cpp @@ -40,6 +40,7 @@ HighlightWindowEffect::HighlightWindowEffect() XChangeProperty(display(), rootWindow(), m_atom, m_atom, 8, PropModeReplace, &dummy, 1); connect(effects, SIGNAL(windowAdded(EffectWindow*)), this, SLOT(slotWindowAdded(EffectWindow*))); connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*))); + connect(effects, SIGNAL(windowDeleted(EffectWindow*)), this, SLOT(slotWindowDeleted(EffectWindow*))); } HighlightWindowEffect::~HighlightWindowEffect() @@ -123,7 +124,7 @@ void HighlightWindowEffect::slotWindowClosed(EffectWindow* w) finishHighlighting(); } -void HighlightWindowEffect::windowDeleted(EffectWindow* w) +void HighlightWindowEffect::slotWindowDeleted(EffectWindow* w) { m_windowOpacity.remove(w); } diff --git a/effects/highlightwindow/highlightwindow.h b/effects/highlightwindow/highlightwindow.h index bbedea55e..4965ed500 100644 --- a/effects/highlightwindow/highlightwindow.h +++ b/effects/highlightwindow/highlightwindow.h @@ -37,13 +37,12 @@ public: virtual void prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time); virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data); - virtual void windowDeleted(EffectWindow* w); - virtual void propertyNotify(EffectWindow* w, long atom); public Q_SLOTS: void slotWindowAdded(EffectWindow* w); void slotWindowClosed(EffectWindow *w); + void slotWindowDeleted(EffectWindow *w); private: void prepareHighlighting(); diff --git a/effects/logout/logout.cpp b/effects/logout/logout.cpp index 862a594aa..9c88b2a5d 100644 --- a/effects/logout/logout.cpp +++ b/effects/logout/logout.cpp @@ -62,6 +62,7 @@ LogoutEffect::LogoutEffect() reconfigure(ReconfigureAll); connect(effects, SIGNAL(windowAdded(EffectWindow*)), this, SLOT(slotWindowAdded(EffectWindow*))); connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*))); + connect(effects, SIGNAL(windowDeleted(EffectWindow*)), this, SLOT(slotWindowDeleted(EffectWindow*))); } LogoutEffect::~LogoutEffect() @@ -318,7 +319,7 @@ void LogoutEffect::slotWindowClosed(EffectWindow* w) } } -void LogoutEffect::windowDeleted(EffectWindow* w) +void LogoutEffect::slotWindowDeleted(EffectWindow* w) { windows.removeAll(w); ignoredWindows.removeAll(w); diff --git a/effects/logout/logout.h b/effects/logout/logout.h index f641c47cd..767dcd6ec 100644 --- a/effects/logout/logout.h +++ b/effects/logout/logout.h @@ -44,11 +44,11 @@ public: virtual void paintScreen(int mask, QRegion region, ScreenPaintData& data); virtual void postPaintScreen(); virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data); - virtual void windowDeleted(EffectWindow* w); virtual void propertyNotify(EffectWindow* w, long a); public Q_SLOTS: void slotWindowAdded(EffectWindow* w); void slotWindowClosed(EffectWindow *w); + void slotWindowDeleted(EffectWindow *w); private: bool isLogoutDialog(EffectWindow* w); double progress; // 0-1 diff --git a/effects/magiclamp/magiclamp.cpp b/effects/magiclamp/magiclamp.cpp index 3d1edf699..1631071c2 100644 --- a/effects/magiclamp/magiclamp.cpp +++ b/effects/magiclamp/magiclamp.cpp @@ -34,6 +34,7 @@ MagicLampEffect::MagicLampEffect() { mActiveAnimations = 0; reconfigure(ReconfigureAll); + connect(effects, SIGNAL(windowDeleted(EffectWindow*)), this, SLOT(slotWindowDeleted(EffectWindow*))); } bool MagicLampEffect::supported() @@ -321,7 +322,7 @@ void MagicLampEffect::postPaintScreen() effects->postPaintScreen(); } -void MagicLampEffect::windowDeleted(EffectWindow* w) +void MagicLampEffect::slotWindowDeleted(EffectWindow* w) { mTimeLineWindows.remove(w); } diff --git a/effects/magiclamp/magiclamp.h b/effects/magiclamp/magiclamp.h index 99326b2f6..db2bd36c2 100644 --- a/effects/magiclamp/magiclamp.h +++ b/effects/magiclamp/magiclamp.h @@ -29,6 +29,7 @@ namespace KWin class MagicLampEffect : public Effect { + Q_OBJECT public: MagicLampEffect(); @@ -38,12 +39,14 @@ public: virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data); virtual void postPaintScreen(); - virtual void windowDeleted(EffectWindow* c); virtual void windowMinimized(EffectWindow* c); virtual void windowUnminimized(EffectWindow* c); static bool supported(); +public Q_SLOTS: + void slotWindowDeleted(EffectWindow *w); + private: QHash< EffectWindow*, TimeLine > mTimeLineWindows; int mActiveAnimations; diff --git a/effects/minimizeanimation/minimizeanimation.cpp b/effects/minimizeanimation/minimizeanimation.cpp index 4c7148a84..6d50d1ea3 100644 --- a/effects/minimizeanimation/minimizeanimation.cpp +++ b/effects/minimizeanimation/minimizeanimation.cpp @@ -28,6 +28,7 @@ KWIN_EFFECT(minimizeanimation, MinimizeAnimationEffect) MinimizeAnimationEffect::MinimizeAnimationEffect() { mActiveAnimations = 0; + connect(effects, SIGNAL(windowDeleted(EffectWindow*)), this, SLOT(slotWindowDeleted(EffectWindow*))); } @@ -108,7 +109,7 @@ void MinimizeAnimationEffect::postPaintScreen() effects->postPaintScreen(); } -void MinimizeAnimationEffect::windowDeleted(EffectWindow* w) +void MinimizeAnimationEffect::slotWindowDeleted(EffectWindow* w) { mTimeLineWindows.remove(w); } diff --git a/effects/minimizeanimation/minimizeanimation.h b/effects/minimizeanimation/minimizeanimation.h index 64f76bee3..aeb2d0800 100644 --- a/effects/minimizeanimation/minimizeanimation.h +++ b/effects/minimizeanimation/minimizeanimation.h @@ -34,6 +34,7 @@ namespace KWin class MinimizeAnimationEffect : public Effect { + Q_OBJECT public: MinimizeAnimationEffect(); @@ -42,10 +43,12 @@ public: virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data); virtual void postPaintScreen(); - virtual void windowDeleted(EffectWindow* c); virtual void windowMinimized(EffectWindow* c); virtual void windowUnminimized(EffectWindow* c); +public Q_SLOTS: + void slotWindowDeleted(EffectWindow *w); + private: QHash< EffectWindow*, TimeLine > mTimeLineWindows; int mActiveAnimations; diff --git a/effects/presentwindows/presentwindows.cpp b/effects/presentwindows/presentwindows.cpp index deed866b3..dfe458977 100644 --- a/effects/presentwindows/presentwindows.cpp +++ b/effects/presentwindows/presentwindows.cpp @@ -100,6 +100,7 @@ PresentWindowsEffect::PresentWindowsEffect() reconfigure(ReconfigureAll); connect(effects, SIGNAL(windowAdded(EffectWindow*)), this, SLOT(slotWindowAdded(EffectWindow*))); connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*))); + connect(effects, SIGNAL(windowDeleted(EffectWindow*)), this, SLOT(slotWindowDeleted(EffectWindow*))); } PresentWindowsEffect::~PresentWindowsEffect() @@ -404,7 +405,7 @@ void PresentWindowsEffect::slotWindowClosed(EffectWindow *w) rearrangeWindows(); } -void PresentWindowsEffect::windowDeleted(EffectWindow *w) +void PresentWindowsEffect::slotWindowDeleted(EffectWindow *w) { if (!m_windowData.contains(w)) return; diff --git a/effects/presentwindows/presentwindows.h b/effects/presentwindows/presentwindows.h index 1ed4e4b78..24a6deb5f 100644 --- a/effects/presentwindows/presentwindows.h +++ b/effects/presentwindows/presentwindows.h @@ -102,7 +102,6 @@ public: virtual void paintWindow(EffectWindow *w, int mask, QRegion region, WindowPaintData &data); // User interaction - virtual void windowDeleted(EffectWindow *w); virtual void windowGeometryShapeChanged(EffectWindow* w, const QRect& old); virtual bool borderActivated(ElectricBorder border); virtual void windowInputMouseEvent(Window w, QEvent *e); @@ -161,6 +160,7 @@ public slots: // EffectsHandler void slotWindowAdded(EffectWindow *w); void slotWindowClosed(EffectWindow *w); + void slotWindowDeleted(EffectWindow *w); private slots: void closeWindow(); diff --git a/effects/sheet/sheet.cpp b/effects/sheet/sheet.cpp index 9da6d11b4..421d8184c 100644 --- a/effects/sheet/sheet.cpp +++ b/effects/sheet/sheet.cpp @@ -38,6 +38,7 @@ SheetEffect::SheetEffect() reconfigure(ReconfigureAll); connect(effects, SIGNAL(windowAdded(EffectWindow*)), this, SLOT(slotWindowAdded(EffectWindow*))); connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*))); + connect(effects, SIGNAL(windowDeleted(EffectWindow*)), this, SLOT(slotWindowDeleted(EffectWindow*))); } bool SheetEffect::supported() @@ -172,7 +173,7 @@ void SheetEffect::slotWindowClosed(EffectWindow* w) w->addRepaintFull(); } -void SheetEffect::windowDeleted(EffectWindow* w) +void SheetEffect::slotWindowDeleted(EffectWindow* w) { windows.remove(w); } diff --git a/effects/sheet/sheet.h b/effects/sheet/sheet.h index a687fc30b..2030eca8a 100644 --- a/effects/sheet/sheet.h +++ b/effects/sheet/sheet.h @@ -39,13 +39,12 @@ public: virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data); virtual void postPaintWindow(EffectWindow* w); - virtual void windowDeleted(EffectWindow* c); - static bool supported(); public Q_SLOTS: void slotWindowAdded(EffectWindow* c); void slotWindowClosed(EffectWindow *c); + void slotWindowDeleted(EffectWindow *w); private: class WindowInfo; typedef QMap< const EffectWindow*, WindowInfo > InfoMap; diff --git a/effects/slideback/slideback.cpp b/effects/slideback/slideback.cpp index 31dae80a2..600c87b9b 100644 --- a/effects/slideback/slideback.cpp +++ b/effects/slideback/slideback.cpp @@ -35,6 +35,7 @@ SlideBackEffect::SlideBackEffect() unminimizedWindow = NULL; connect(effects, SIGNAL(windowAdded(EffectWindow*)), this, SLOT(slotWindowAdded(EffectWindow*))); connect(effects, SIGNAL(windowActivated(EffectWindow*)), this, SLOT(slotWindowActivated(EffectWindow*))); + connect(effects, SIGNAL(windowDeleted(EffectWindow*)), this, SLOT(slotWindowDeleted(EffectWindow*))); } static inline bool windowsShareDesktop(EffectWindow *w1, EffectWindow *w2) @@ -278,7 +279,7 @@ void SlideBackEffect::postPaintWindow(EffectWindow* w) effects->postPaintWindow(w); } -void SlideBackEffect::windowDeleted(EffectWindow* w) +void SlideBackEffect::slotWindowDeleted(EffectWindow* w) { usableOldStackingOrder.removeAll(w); oldStackingOrder.removeAll(w); diff --git a/effects/slideback/slideback.h b/effects/slideback/slideback.h index eddc38e27..1021d7842 100644 --- a/effects/slideback/slideback.h +++ b/effects/slideback/slideback.h @@ -41,7 +41,6 @@ public: virtual void prePaintScreen(ScreenPrePaintData &data, int time); virtual void postPaintScreen(); - virtual void windowDeleted(EffectWindow* w); virtual void windowUnminimized(EffectWindow* w); virtual void clientGroupItemSwitched(EffectWindow* from, EffectWindow* to); @@ -50,6 +49,7 @@ public: public Q_SLOTS: void slotWindowAdded(EffectWindow *w); void slotWindowActivated(EffectWindow *w); + void slotWindowDeleted(EffectWindow *w); private: diff --git a/effects/slidingpopups/slidingpopups.cpp b/effects/slidingpopups/slidingpopups.cpp index 3677d5286..9df500a5a 100644 --- a/effects/slidingpopups/slidingpopups.cpp +++ b/effects/slidingpopups/slidingpopups.cpp @@ -40,6 +40,7 @@ SlidingPopupsEffect::SlidingPopupsEffect() XChangeProperty(display(), rootWindow(), mAtom, mAtom, 8, PropModeReplace, &dummy, 1); connect(effects, SIGNAL(windowAdded(EffectWindow*)), this, SLOT(slotWindowAdded(EffectWindow*))); connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*))); + connect(effects, SIGNAL(windowDeleted(EffectWindow*)), this, SLOT(slotWindowDeleted(EffectWindow*))); } SlidingPopupsEffect::~SlidingPopupsEffect() @@ -165,7 +166,7 @@ void SlidingPopupsEffect::slotWindowClosed(EffectWindow* w) } } -void SlidingPopupsEffect::windowDeleted(EffectWindow* w) +void SlidingPopupsEffect::slotWindowDeleted(EffectWindow* w) { mAppearingWindows.remove(w); mDisappearingWindows.remove(w); diff --git a/effects/slidingpopups/slidingpopups.h b/effects/slidingpopups/slidingpopups.h index 2c2755f05..29f44166b 100644 --- a/effects/slidingpopups/slidingpopups.h +++ b/effects/slidingpopups/slidingpopups.h @@ -39,12 +39,12 @@ public: virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data); virtual void postPaintWindow(EffectWindow* w); // TODO react also on virtual desktop changes - virtual void windowDeleted(EffectWindow* c); virtual void propertyNotify(EffectWindow* w, long a); public Q_SLOTS: void slotWindowAdded(EffectWindow *c); void slotWindowClosed(EffectWindow *c); + void slotWindowDeleted(EffectWindow *w); private: enum Position { West = 0, diff --git a/effects/taskbarthumbnail/taskbarthumbnail.cpp b/effects/taskbarthumbnail/taskbarthumbnail.cpp index d8e35033b..9c81fd5bf 100644 --- a/effects/taskbarthumbnail/taskbarthumbnail.cpp +++ b/effects/taskbarthumbnail/taskbarthumbnail.cpp @@ -44,6 +44,7 @@ TaskbarThumbnailEffect::TaskbarThumbnailEffect() unsigned char dummy = 0; XChangeProperty(display(), rootWindow(), atom, atom, 8, PropModeReplace, &dummy, 1); connect(effects, SIGNAL(windowAdded(EffectWindow*)), this, SLOT(slotWindowAdded(EffectWindow*))); + connect(effects, SIGNAL(windowDeleted(EffectWindow*)), this, SLOT(slotWindowDeleted(EffectWindow*))); } TaskbarThumbnailEffect::~TaskbarThumbnailEffect() @@ -124,7 +125,7 @@ void TaskbarThumbnailEffect::slotWindowAdded(EffectWindow* w) propertyNotify(w, atom); // read initial value } -void TaskbarThumbnailEffect::windowDeleted(EffectWindow* w) +void TaskbarThumbnailEffect::slotWindowDeleted(EffectWindow* w) { thumbnails.remove(w); } diff --git a/effects/taskbarthumbnail/taskbarthumbnail.h b/effects/taskbarthumbnail/taskbarthumbnail.h index 4bbf6f64b..4c39b9d57 100644 --- a/effects/taskbarthumbnail/taskbarthumbnail.h +++ b/effects/taskbarthumbnail/taskbarthumbnail.h @@ -39,11 +39,11 @@ public: virtual void prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time); virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data); virtual void windowDamaged(EffectWindow* w, const QRect& damage); - virtual void windowDeleted(EffectWindow* w); virtual void propertyNotify(EffectWindow* w, long atom); public Q_SLOTS: void slotWindowAdded(EffectWindow *w); + void slotWindowDeleted(EffectWindow *w); private: struct Data { Window window; // thumbnail of this window diff --git a/libkwineffects/kwineffects.cpp b/libkwineffects/kwineffects.cpp index 4e4ebdbde..0b577dfaf 100644 --- a/libkwineffects/kwineffects.cpp +++ b/libkwineffects/kwineffects.cpp @@ -131,10 +131,6 @@ void Effect::windowOpacityChanged(EffectWindow*, double) { } -void Effect::windowDeleted(EffectWindow*) -{ -} - void Effect::windowMinimized(EffectWindow*) { } diff --git a/libkwineffects/kwineffects.h b/libkwineffects/kwineffects.h index 588fd4a4c..264ddaf02 100644 --- a/libkwineffects/kwineffects.h +++ b/libkwineffects/kwineffects.h @@ -445,7 +445,6 @@ public: /** called when the geometry changed during moving/resizing. */ virtual void windowMoveResizeGeometryUpdate(EffectWindow* c, const QRect& geometry); virtual void windowOpacityChanged(EffectWindow* c, double old_opacity); - virtual void windowDeleted(EffectWindow* c); virtual void windowMinimized(EffectWindow* c); virtual void windowUnminimized(EffectWindow* c); virtual void clientGroupItemSwitched(EffectWindow* from, EffectWindow* to); @@ -857,6 +856,18 @@ Q_SIGNALS: * @since 4.7 **/ void windowActivated(EffectWindow *w); + /** + * Signal emitted when a window is deleted. + * This means that a closed window is not referenced any more. + * An effect bookkeeping the closed windows should connect to this + * signal to clean up the internal references. + * @param w The window which is going to be deleted. + * @see EffectWindow::refWindow + * @see EffectWindow::unrefWindow + * @see windowClosed + * @since 4.7 + **/ + void windowDeleted(EffectWindow *w); protected: QVector< EffectPair > loaded_effects; diff --git a/workspace.cpp b/workspace.cpp index f0e21b6fc..03a76caa1 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -725,8 +725,7 @@ void Workspace::removeDeleted(Deleted* c, allowed_t) assert(deleted.contains(c)); if (scene) scene->windowDeleted(c); - if (effects) - static_cast(effects)->windowDeleted(c->effectWindow()); + emit deletedRemoved(c); deleted.removeAll(c); x_stacking_dirty = true; } diff --git a/workspace.h b/workspace.h index 6e04182b4..cd53fc652 100644 --- a/workspace.h +++ b/workspace.h @@ -924,6 +924,7 @@ signals: void clientActivated(KWin::Client*); void groupAdded(KWin::Group*); void unmanagedAdded(KWin::Unmanaged*); + void deletedRemoved(KWin::Deleted*); private: void init();