EffectsHandler emits windowClosed signal

Client and Unmanaged use a signal to notify that they are about to be closed.
The EffectsHandlerImpl is connected to those signals and emits the appropriate
windowClosed signal to which the effects are connected.
This commit is contained in:
Martin Gräßlin 2011-02-27 09:25:45 +01:00
parent ab6f2ba1fd
commit 0b85768ec5
51 changed files with 135 additions and 57 deletions

View file

@ -234,8 +234,8 @@ void Client::releaseWindow(bool on_shutdown)
assert(!deleting);
deleting = true;
Deleted* del = Deleted::create(this);
if (effects) {
static_cast<EffectsHandlerImpl*>(effects)->windowClosed(effectWindow());
emit clientClosed(this);
if (scene) {
scene->windowClosed(this, del);
}
finishCompositing();
@ -302,8 +302,8 @@ void Client::destroyClient()
assert(!deleting);
deleting = true;
Deleted* del = Deleted::create(this);
if (effects) {
static_cast<EffectsHandlerImpl*>(effects)->windowClosed(effectWindow());
emit clientClosed(this);
if (scene) {
scene->windowClosed(this, del);
}
finishCompositing();

View file

@ -494,6 +494,7 @@ signals:
void maximizeSet(QPair<bool, bool>);
void s_activated();
void s_fullScreenSet(bool, bool);
void clientClosed(KWin::Client*);
// To make workspace-client calls, a few slots are also
// required

View file

@ -99,6 +99,13 @@ EffectsHandlerImpl::EffectsHandlerImpl(CompositingType type)
connect(ws, SIGNAL(currentDesktopChanged(int)), this, SLOT(slotDesktopChanged(int)));
connect(ws, SIGNAL(clientAdded(KWin::Client*)), this, SLOT(slotClientAdded(KWin::Client*)));
connect(ws, SIGNAL(unmanagedAdded(KWin::Unmanaged*)), this, SLOT(slotUnmanagedAdded(KWin::Unmanaged*)));
// connect all clients
foreach (Client *c, ws->clientList()) {
connect(c, SIGNAL(clientClosed(KWin::Client*)), this, SLOT(slotClientClosed(KWin::Client*)));
}
foreach (Unmanaged *u, ws->unmanagedList()) {
connect(u, SIGNAL(unmanagedClosed(KWin::Unmanaged*)), this, SLOT(slotUnmanagedClosed(KWin::Unmanaged*)));
}
reconfigure();
}
@ -285,11 +292,13 @@ void EffectsHandlerImpl::windowOpacityChanged(EffectWindow* c, double old_opacit
void EffectsHandlerImpl::slotClientAdded(Client *c)
{
connect(c, SIGNAL(clientClosed(KWin::Client*)), this, SLOT(slotClientClosed(KWin::Client*)));
emit windowAdded(c->effectWindow());
}
void EffectsHandlerImpl::slotUnmanagedAdded(Unmanaged *u)
{
connect(u, SIGNAL(unmanagedClosed(KWin::Unmanaged*)), this, SLOT(slotUnmanagedClosed(KWin::Unmanaged*)));
emit windowAdded(u->effectWindow());
}
@ -300,10 +309,14 @@ void EffectsHandlerImpl::windowDeleted(EffectWindow* c)
elevated_windows.removeAll(c);
}
void EffectsHandlerImpl::windowClosed(EffectWindow* c)
void EffectsHandlerImpl::slotClientClosed(Client *c)
{
foreach (const EffectPair & ep, loaded_effects)
ep.second->windowClosed(c);
emit windowClosed(c->effectWindow());
}
void EffectsHandlerImpl::slotUnmanagedClosed(Unmanaged* u)
{
emit windowClosed(u->effectWindow());
}
void EffectsHandlerImpl::windowActivated(EffectWindow* c)

View file

@ -160,7 +160,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 windowClosed(EffectWindow* c);
void windowDeleted(EffectWindow* c);
void windowActivated(EffectWindow* c);
void windowMinimized(EffectWindow* c);
@ -197,6 +196,8 @@ protected Q_SLOTS:
void slotDesktopChanged(int old);
void slotClientAdded(KWin::Client *c);
void slotUnmanagedAdded(KWin::Unmanaged *u);
void slotClientClosed(KWin::Client *c);
void slotUnmanagedClosed(KWin::Unmanaged *u);
protected:
KLibrary* findEffectLibrary(KService* service);

View file

@ -57,6 +57,7 @@ BoxSwitchEffect::BoxSwitchEffect()
highlight_margin = 10;
reconfigure(ReconfigureAll);
connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*)));
}
BoxSwitchEffect::~BoxSwitchEffect()
@ -475,7 +476,7 @@ void BoxSwitchEffect::setSelectedWindow(EffectWindow* w)
}
}
void BoxSwitchEffect::windowClosed(EffectWindow* w)
void BoxSwitchEffect::slotWindowClosed(EffectWindow* w)
{
if (w == selected_window) {
setSelectedWindow(0);

View file

@ -41,6 +41,7 @@ namespace KWin
class BoxSwitchEffect
: public Effect
{
Q_OBJECT
public:
BoxSwitchEffect();
~BoxSwitchEffect();
@ -57,10 +58,13 @@ public:
virtual void tabBoxAdded(int mode);
virtual void tabBoxClosed();
virtual void tabBoxUpdated();
virtual void windowClosed(EffectWindow* w);
virtual void* proxy();
void activateFromProxy(int mode, bool animate, bool showText, float positioningFactor);
void paintWindowsBox(const QRegion& region);
public Q_SLOTS:
void slotWindowClosed(EffectWindow* w);
private:
class ItemInfo;
void setActive();

View file

@ -70,6 +70,7 @@ CoverSwitchEffect::CoverSwitchEffect()
const QString fragmentshader = KGlobal::dirs()->findResource("data", "kwin/coverswitch-reflection.glsl");
m_reflectionShader = ShaderManager::instance()->loadFragmentShader(ShaderManager::GenericShader, fragmentshader);
connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*)));
}
CoverSwitchEffect::~CoverSwitchEffect()
@ -981,7 +982,7 @@ void CoverSwitchEffect::abort()
captionFrame->free();
}
void CoverSwitchEffect::windowClosed(EffectWindow* c)
void CoverSwitchEffect::slotWindowClosed(EffectWindow* c)
{
// if the list is not empty, the effect is active
if (!currentWindowList.isEmpty()) {

View file

@ -36,6 +36,7 @@ namespace KWin
class CoverSwitchEffect
: public Effect
{
Q_OBJECT
public:
CoverSwitchEffect();
~CoverSwitchEffect();
@ -49,9 +50,12 @@ public:
virtual void tabBoxClosed();
virtual void tabBoxUpdated();
virtual void windowInputMouseEvent(Window w, QEvent* e);
virtual void windowClosed(EffectWindow* c);
static bool supported();
public Q_SLOTS:
void slotWindowClosed(EffectWindow *c);
private:
void paintScene(EffectWindow* frontWindow, const EffectWindowList& leftWindows, const EffectWindowList& rightWindows,
bool reflectedWindows = false);

View file

@ -36,6 +36,7 @@ DashboardEffect::DashboardEffect()
// read settings
reconfigure(ReconfigureAll);
connect(effects, SIGNAL(windowAdded(EffectWindow*)), this, SLOT(slotWindowAdded(EffectWindow*)));
connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*)));
}
DashboardEffect::~DashboardEffect()
@ -188,7 +189,7 @@ void DashboardEffect::slotWindowAdded(EffectWindow* w)
}
}
void DashboardEffect::windowClosed(EffectWindow* w)
void DashboardEffect::slotWindowClosed(EffectWindow* w)
{
propertyNotify(w, atom);

View file

@ -43,10 +43,10 @@ public:
virtual void reconfigure(ReconfigureFlags);
virtual void unpropagate();
virtual void windowActivated(EffectWindow *w);
virtual void windowClosed(EffectWindow* c);
public Q_SLOTS:
void slotWindowAdded(EffectWindow* c);
void slotWindowClosed(EffectWindow *c);
private:
bool blur;
bool isDashboard(EffectWindow* w);

View file

@ -74,6 +74,7 @@ DesktopGridEffect::DesktopGridEffect()
connect(a, SIGNAL(triggered(bool)), this, SLOT(toggle()));
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*)));
// Load all other configuration details
reconfigure(ReconfigureAll);
@ -391,7 +392,7 @@ void DesktopGridEffect::slotWindowAdded(EffectWindow* w)
effects->addRepaintFull();
}
void DesktopGridEffect::windowClosed(EffectWindow* w)
void DesktopGridEffect::slotWindowClosed(EffectWindow* w)
{
if (!activated && timeline.value() == 0)
return;

View file

@ -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 windowClosed(EffectWindow* w);
virtual void windowDeleted(EffectWindow* w);
virtual void windowGeometryShapeChanged(EffectWindow* w, const QRect& old);
virtual void windowInputMouseEvent(Window w, QEvent* e);
@ -89,6 +88,7 @@ private slots:
void slotAddDesktop();
void slotRemoveDesktop();
void slotWindowAdded(EffectWindow* w);
void slotWindowClosed(EffectWindow *w);
private:
QPointF scalePos(const QPoint& pos, int desktop, int screen = -1) const;

View file

@ -28,6 +28,7 @@ KWIN_EFFECT(dialogparent, DialogParentEffect)
DialogParentEffect::DialogParentEffect()
{
reconfigure(ReconfigureAll);
connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*)));
}
void DialogParentEffect::reconfigure(ReconfigureFlags)
@ -92,7 +93,7 @@ void DialogParentEffect::windowActivated(EffectWindow* w)
}
}
void DialogParentEffect::windowClosed(EffectWindow* w)
void DialogParentEffect::slotWindowClosed(EffectWindow* w)
{
// If this window is a dialog, we need to repaint it's parent window, so
// that the effect could be run for it

View file

@ -37,6 +37,7 @@ namespace KWin
class DialogParentEffect
: public Effect
{
Q_OBJECT
public:
DialogParentEffect();
virtual void reconfigure(ReconfigureFlags);
@ -45,9 +46,10 @@ public:
virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data);
virtual void postPaintWindow(EffectWindow* w);
virtual void windowClosed(EffectWindow* c);
virtual void windowActivated(EffectWindow* c);
public Q_SLOTS:
void slotWindowClosed(EffectWindow *c);
protected:
bool hasModalWindow(EffectWindow* t);
private:

View file

@ -46,6 +46,7 @@ ExplosionEffect::ExplosionEffect() : Effect()
mActiveAnimations = 0;
mValid = true;
mInited = false;
connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*)));
}
ExplosionEffect::~ExplosionEffect()
@ -180,7 +181,7 @@ void ExplosionEffect::postPaintScreen()
effects->postPaintScreen();
}
void ExplosionEffect::windowClosed(EffectWindow* c)
void ExplosionEffect::slotWindowClosed(EffectWindow* c)
{
const void* e = c->data(WindowClosedGrabRole).value<void*>();
if (e && e != this)

View file

@ -38,6 +38,7 @@ class GLTexture;
class ExplosionEffect
: public Effect
{
Q_OBJECT
public:
ExplosionEffect();
~ExplosionEffect();
@ -47,11 +48,12 @@ public:
virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data);
virtual void postPaintScreen();
virtual void windowClosed(EffectWindow* c);
virtual void windowDeleted(EffectWindow* c);
static bool supported();
public Q_SLOTS:
void slotWindowClosed(EffectWindow *c);
protected:
bool loadData();

View file

@ -31,6 +31,7 @@ FadeEffect::FadeEffect()
{
reconfigure(ReconfigureAll);
connect(effects, SIGNAL(windowAdded(EffectWindow*)), this, SLOT(slotWindowAdded(EffectWindow*)));
connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*)));
}
void FadeEffect::reconfigure(ReconfigureFlags)
@ -162,7 +163,7 @@ void FadeEffect::slotWindowAdded(EffectWindow* w)
w->addRepaintFull();
}
void FadeEffect::windowClosed(EffectWindow* w)
void FadeEffect::slotWindowClosed(EffectWindow* w)
{
if (!fadeWindows || !isFadeWindow(w))
return;

View file

@ -39,13 +39,13 @@ public:
// TODO react also on virtual desktop changes
virtual void windowOpacityChanged(EffectWindow* c, double old_opacity);
virtual void windowClosed(EffectWindow* c);
virtual void windowDeleted(EffectWindow* c);
bool isFadeWindow(EffectWindow* w);
public Q_SLOTS:
void slotWindowAdded(EffectWindow* c);
void slotWindowClosed(EffectWindow *c);
private:
class WindowInfo;
QHash< const EffectWindow*, WindowInfo > windows;

View file

@ -32,6 +32,7 @@ KWIN_EFFECT(fallapart, FallApartEffect)
FallApartEffect::FallApartEffect()
{
reconfigure(ReconfigureAll);
connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*)));
}
void FallApartEffect::reconfigure(ReconfigureFlags)
@ -142,7 +143,7 @@ bool FallApartEffect::isRealWindow(EffectWindow* w)
return true;
}
void FallApartEffect::windowClosed(EffectWindow* c)
void FallApartEffect::slotWindowClosed(EffectWindow* c)
{
if (!isRealWindow(c))
return;

View file

@ -29,6 +29,7 @@ namespace KWin
class FallApartEffect
: public Effect
{
Q_OBJECT
public:
FallApartEffect();
virtual void reconfigure(ReconfigureFlags);
@ -36,8 +37,11 @@ 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 windowClosed(EffectWindow* c);
virtual void windowDeleted(EffectWindow* c);
public Q_SLOTS:
void slotWindowClosed(EffectWindow *c);
private:
QHash< const EffectWindow*, double > windows;
bool isRealWindow(EffectWindow* w);

View file

@ -70,6 +70,7 @@ FlipSwitchEffect::FlipSwitchEffect()
connect(b, SIGNAL(triggered(bool)), this, SLOT(toggleActiveAllDesktops()));
connect(b, SIGNAL(globalShortcutChanged(QKeySequence)), this, SLOT(globalShortcutChangedAll(QKeySequence)));
connect(effects, SIGNAL(windowAdded(EffectWindow*)), this, SLOT(slotWindowAdded(EffectWindow*)));
connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*)));
}
FlipSwitchEffect::~FlipSwitchEffect()
@ -584,7 +585,7 @@ void FlipSwitchEffect::slotWindowAdded(EffectWindow* w)
}
}
void FlipSwitchEffect::windowClosed(EffectWindow* w)
void FlipSwitchEffect::slotWindowClosed(EffectWindow* w)
{
if (m_active && m_windows.contains(w)) {
m_windows.remove(w);

View file

@ -47,7 +47,6 @@ public:
virtual void tabBoxAdded(int mode);
virtual void tabBoxClosed();
virtual void tabBoxUpdated();
virtual void windowClosed(EffectWindow* w);
virtual bool borderActivated(ElectricBorder border);
virtual void grabbedKeyboardEvent(QKeyEvent* e);
@ -58,6 +57,7 @@ private Q_SLOTS:
void globalShortcutChangedCurrent(QKeySequence shortcut);
void globalShortcutChangedAll(QKeySequence shortcut);
void slotWindowAdded(EffectWindow* w);
void slotWindowClosed(EffectWindow *w);
private:
class ItemInfo;

View file

@ -38,6 +38,7 @@ GlideEffect::GlideEffect()
{
reconfigure(ReconfigureAll);
connect(effects, SIGNAL(windowAdded(EffectWindow*)), this, SLOT(slotWindowAdded(EffectWindow*)));
connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*)));
}
bool GlideEffect::supported()
@ -180,7 +181,7 @@ void GlideEffect::slotWindowAdded(EffectWindow* w)
w->addRepaintFull();
}
void GlideEffect::windowClosed(EffectWindow* w)
void GlideEffect::slotWindowClosed(EffectWindow* w)
{
if (!isGlideWindow(w))
return;

View file

@ -40,12 +40,12 @@ public:
virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data);
virtual void postPaintWindow(EffectWindow* w);
virtual void windowClosed(EffectWindow* c);
virtual void windowDeleted(EffectWindow* c);
static bool supported();
public Q_SLOTS:
void slotWindowAdded(EffectWindow* c);
void slotWindowClosed(EffectWindow *c);
private:
class WindowInfo;

View file

@ -39,6 +39,7 @@ HighlightWindowEffect::HighlightWindowEffect()
unsigned char dummy = 0;
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*)));
}
HighlightWindowEffect::~HighlightWindowEffect()
@ -116,7 +117,7 @@ void HighlightWindowEffect::slotWindowAdded(EffectWindow* w)
propertyNotify(w, m_atom); // Check initial value
}
void HighlightWindowEffect::windowClosed(EffectWindow* w)
void HighlightWindowEffect::slotWindowClosed(EffectWindow* w)
{
if (m_monitorWindow == w) // The monitoring window was destroyed
finishHighlighting();

View file

@ -37,13 +37,13 @@ public:
virtual void prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time);
virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data);
virtual void windowClosed(EffectWindow* w);
virtual void windowDeleted(EffectWindow* w);
virtual void propertyNotify(EffectWindow* w, long atom);
public Q_SLOTS:
void slotWindowAdded(EffectWindow* w);
void slotWindowClosed(EffectWindow *w);
private:
void prepareHighlighting();

View file

@ -54,6 +54,7 @@ InvertEffect::InvertEffect()
b->setText(i18n("Toggle Invert Effect on Window"));
b->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::META + Qt::Key_U));
connect(b, SIGNAL(triggered(bool)), this, SLOT(toggleWindow()));
connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*)));
}
InvertEffect::~InvertEffect()
@ -140,7 +141,7 @@ void InvertEffect::paintEffectFrame(KWin::EffectFrame* frame, QRegion region, do
}
}
void InvertEffect::windowClosed(EffectWindow* w)
void InvertEffect::slotWindowClosed(EffectWindow* w)
{
m_windows.removeOne(w);
}

View file

@ -44,13 +44,13 @@ public:
virtual void prePaintScreen(ScreenPrePaintData &data, int time);
virtual void prePaintWindow(EffectWindow *w, WindowPrePaintData &data, int time);
virtual void paintEffectFrame(KWin::EffectFrame* frame, QRegion region, double opacity, double frameOpacity);
virtual void windowClosed(EffectWindow* w);
static bool supported();
public slots:
void toggle();
void toggleWindow();
void slotWindowClosed(EffectWindow *w);
protected:
bool loadData();

View file

@ -31,6 +31,7 @@ LoginEffect::LoginEffect()
: progress(1.0)
, login_window(NULL)
{
connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*)));
}
void LoginEffect::prePaintScreen(ScreenPrePaintData& data, int time)
@ -72,7 +73,7 @@ void LoginEffect::postPaintScreen()
effects->postPaintScreen();
}
void LoginEffect::windowClosed(EffectWindow* w)
void LoginEffect::slotWindowClosed(EffectWindow* w)
{
if (isLoginSplash(w)) {
if (login_window)

View file

@ -30,13 +30,17 @@ namespace KWin
class LoginEffect
: public Effect
{
Q_OBJECT
public:
LoginEffect();
virtual void prePaintScreen(ScreenPrePaintData& data, int time);
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 windowClosed(EffectWindow* w);
public Q_SLOTS:
void slotWindowClosed(EffectWindow *w);
private:
bool isLoginSplash(EffectWindow* w);
double progress; // 0-1

View file

@ -61,6 +61,7 @@ LogoutEffect::LogoutEffect()
#endif
reconfigure(ReconfigureAll);
connect(effects, SIGNAL(windowAdded(EffectWindow*)), this, SLOT(slotWindowAdded(EffectWindow*)));
connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*)));
}
LogoutEffect::~LogoutEffect()
@ -307,7 +308,7 @@ void LogoutEffect::slotWindowAdded(EffectWindow* w)
ignoredWindows.append(w);
}
void LogoutEffect::windowClosed(EffectWindow* w)
void LogoutEffect::slotWindowClosed(EffectWindow* w)
{
if (w == logoutWindow) {
logoutWindowClosed = true;

View file

@ -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 windowClosed(EffectWindow* w);
virtual void windowDeleted(EffectWindow* w);
virtual void propertyNotify(EffectWindow* w, long a);
public Q_SLOTS:
void slotWindowAdded(EffectWindow* w);
void slotWindowClosed(EffectWindow *w);
private:
bool isLogoutDialog(EffectWindow* w);
double progress; // 0-1

View file

@ -99,6 +99,7 @@ PresentWindowsEffect::PresentWindowsEffect()
shortcutClass = c->globalShortcut();
reconfigure(ReconfigureAll);
connect(effects, SIGNAL(windowAdded(EffectWindow*)), this, SLOT(slotWindowAdded(EffectWindow*)));
connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*)));
}
PresentWindowsEffect::~PresentWindowsEffect()
@ -385,7 +386,7 @@ void PresentWindowsEffect::slotWindowAdded(EffectWindow *w)
}
}
void PresentWindowsEffect::windowClosed(EffectWindow *w)
void PresentWindowsEffect::slotWindowClosed(EffectWindow *w)
{
if (m_managerWindow == w)
m_managerWindow = NULL;

View file

@ -102,7 +102,6 @@ public:
virtual void paintWindow(EffectWindow *w, int mask, QRegion region, WindowPaintData &data);
// User interaction
virtual void windowClosed(EffectWindow *w);
virtual void windowDeleted(EffectWindow *w);
virtual void windowGeometryShapeChanged(EffectWindow* w, const QRect& old);
virtual bool borderActivated(ElectricBorder border);
@ -161,6 +160,7 @@ public slots:
void globalShortcutChangedClass(const QKeySequence& seq);
// EffectsHandler
void slotWindowAdded(EffectWindow *w);
void slotWindowClosed(EffectWindow *w);
private slots:
void closeWindow();

View file

@ -29,6 +29,7 @@ ScaleInEffect::ScaleInEffect()
: Effect()
{
connect(effects, SIGNAL(windowAdded(EffectWindow*)), this, SLOT(slotWindowAdded(EffectWindow*)));
connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*)));
}
void ScaleInEffect::prePaintScreen(ScreenPrePaintData& data, int time)
@ -88,7 +89,7 @@ void ScaleInEffect::slotWindowAdded(EffectWindow* c)
}
}
void ScaleInEffect::windowClosed(EffectWindow* c)
void ScaleInEffect::slotWindowClosed(EffectWindow* c)
{
mTimeLineWindows.remove(c);
}

View file

@ -37,9 +37,9 @@ 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 windowClosed(EffectWindow* c);
public Q_SLOTS:
void slotWindowAdded(EffectWindow* c);
void slotWindowClosed(EffectWindow *c);
private:
bool isScaleWindow(EffectWindow* w);
QHash< const EffectWindow*, TimeLine > mTimeLineWindows;

View file

@ -37,6 +37,7 @@ SheetEffect::SheetEffect()
{
reconfigure(ReconfigureAll);
connect(effects, SIGNAL(windowAdded(EffectWindow*)), this, SLOT(slotWindowAdded(EffectWindow*)));
connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*)));
}
bool SheetEffect::supported()
@ -141,7 +142,7 @@ void SheetEffect::slotWindowAdded(EffectWindow* w)
w->addRepaintFull();
}
void SheetEffect::windowClosed(EffectWindow* w)
void SheetEffect::slotWindowClosed(EffectWindow* w)
{
if (!isSheetWindow(w))
return;

View file

@ -39,13 +39,13 @@ public:
virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data);
virtual void postPaintWindow(EffectWindow* w);
virtual void windowClosed(EffectWindow* c);
virtual void windowDeleted(EffectWindow* c);
static bool supported();
public Q_SLOTS:
void slotWindowAdded(EffectWindow* c);
void slotWindowClosed(EffectWindow *c);
private:
class WindowInfo;
typedef QMap< const EffectWindow*, WindowInfo > InfoMap;

View file

@ -39,6 +39,7 @@ SlidingPopupsEffect::SlidingPopupsEffect()
unsigned char dummy = 0;
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*)));
}
SlidingPopupsEffect::~SlidingPopupsEffect()
@ -147,7 +148,7 @@ void SlidingPopupsEffect::slotWindowAdded(EffectWindow *w)
}
}
void SlidingPopupsEffect::windowClosed(EffectWindow* w)
void SlidingPopupsEffect::slotWindowClosed(EffectWindow* w)
{
propertyNotify(w, mAtom);
if (w->isOnCurrentDesktop() && !w->isMinimized() && mWindowsData.contains(w)) {

View file

@ -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 windowClosed(EffectWindow* c);
virtual void windowDeleted(EffectWindow* c);
virtual void propertyNotify(EffectWindow* w, long a);
public Q_SLOTS:
void slotWindowAdded(EffectWindow *c);
void slotWindowClosed(EffectWindow *c);
private:
enum Position {
West = 0,

View file

@ -35,6 +35,7 @@ SnapHelperEffect::SnapHelperEffect()
{
m_timeline.setCurveShape(TimeLine::LinearCurve);
reconfigure(ReconfigureAll);
connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*)));
/*if ( effects->compositingType() == XRenderCompositing )
{
@ -187,7 +188,7 @@ void SnapHelperEffect::postPaintScreen()
}
}
void SnapHelperEffect::windowClosed(EffectWindow* w)
void SnapHelperEffect::slotWindowClosed(EffectWindow* w)
{
if (m_window == w) {
m_window->refWindow();

View file

@ -29,6 +29,7 @@ namespace KWin
class SnapHelperEffect
: public Effect
{
Q_OBJECT
public:
SnapHelperEffect();
~SnapHelperEffect();
@ -37,11 +38,13 @@ public:
virtual void prePaintScreen(ScreenPrePaintData &data, int time);
virtual void postPaintScreen();
virtual void windowClosed(EffectWindow* w);
virtual void windowUserMovedResized(EffectWindow* w, bool first, bool last);
static bool supported();
public Q_SLOTS:
void slotWindowClosed(EffectWindow *w);
private:
bool m_active;
EffectWindow* m_window;

View file

@ -38,6 +38,7 @@ ThumbnailAsideEffect::ThumbnailAsideEffect()
a->setText(i18n("Toggle Thumbnail for Current Window"));
a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::META + Qt::Key_T));
connect(a, SIGNAL(triggered(bool)), this, SLOT(toggleCurrentThumbnail()));
connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*)));
reconfigure(ReconfigureAll);
}
@ -87,7 +88,7 @@ void ThumbnailAsideEffect::windowGeometryShapeChanged(EffectWindow* w, const QRe
}
}
void ThumbnailAsideEffect::windowClosed(EffectWindow* w)
void ThumbnailAsideEffect::slotWindowClosed(EffectWindow* w)
{
removeThumbnail(w);
}

View file

@ -45,9 +45,9 @@ public:
virtual void paintScreen(int mask, QRegion region, ScreenPaintData& data);
virtual void windowDamaged(EffectWindow* w, const QRect& damage);
virtual void windowGeometryShapeChanged(EffectWindow* w, const QRect& old);
virtual void windowClosed(EffectWindow* w);
private slots:
void toggleCurrentThumbnail();
void slotWindowClosed(EffectWindow *w);
private:
void addThumbnail(EffectWindow* w);
void removeThumbnail(EffectWindow* w);

View file

@ -166,6 +166,7 @@ WobblyWindowsEffect::WobblyWindowsEffect()
{
reconfigure(ReconfigureAll);
connect(effects, SIGNAL(windowAdded(EffectWindow*)), this, SLOT(slotWindowAdded(EffectWindow*)));
connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*)));
}
WobblyWindowsEffect::~WobblyWindowsEffect()
@ -477,7 +478,7 @@ void WobblyWindowsEffect::slotWindowAdded(EffectWindow* w)
}
}
void WobblyWindowsEffect::windowClosed(EffectWindow* w)
void WobblyWindowsEffect::slotWindowClosed(EffectWindow* w)
{
if (windows.contains(w)) {
WindowWobblyInfos& wwi = windows[w];

View file

@ -36,7 +36,6 @@ public:
virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data);
virtual void postPaintScreen();
virtual void windowUserMovedResized(EffectWindow* c, bool first, bool last);
virtual void windowClosed(EffectWindow* w);
// Wobbly model parameters
void setStiffness(qreal stiffness);
@ -60,6 +59,7 @@ public:
public Q_SLOTS:
void slotWindowAdded(EffectWindow *w);
void slotWindowClosed(EffectWindow *w);
private:

View file

@ -131,10 +131,6 @@ void Effect::windowOpacityChanged(EffectWindow*, double)
{
}
void Effect::windowClosed(EffectWindow*)
{
}
void Effect::windowDeleted(EffectWindow*)
{
}

View file

@ -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 windowClosed(EffectWindow* c);
virtual void windowDeleted(EffectWindow* c);
virtual void windowActivated(EffectWindow* c);
virtual void windowMinimized(EffectWindow* c);
@ -844,6 +843,15 @@ Q_SIGNALS:
* @since 4.7
**/
void windowAdded(EffectWindow *w);
/**
* Signal emitted when a window is being removed from the Workspace.
* An effect which wants to animate the window closing should connect
* to this signal and reference the window by using
* @link EffectWindow::refWindow
* @param w The window which is being closed
* @since 4.7
**/
void windowClosed(EffectWindow *w);
protected:
QVector< EffectPair > loaded_effects;

View file

@ -81,8 +81,8 @@ bool Unmanaged::track(Window w)
void Unmanaged::release()
{
Deleted* del = Deleted::create(this);
if (effects) {
static_cast<EffectsHandlerImpl*>(effects)->windowClosed(effectWindow());
emit unmanagedClosed(this);
if (scene) {
scene->windowClosed(this, del);
}
finishCompositing();

View file

@ -46,6 +46,8 @@ public:
protected:
virtual void debug(QDebug& stream) const;
virtual bool shouldUnredirect() const;
Q_SIGNALS:
void unmanagedClosed(KWin::Unmanaged*);
private:
virtual ~Unmanaged(); // use release()
// handlers for X11 events

View file

@ -180,6 +180,19 @@ public:
void reserveElectricBorderActions(bool reserve);
void reserveElectricBorderSwitching(bool reserve);
/**
* @return List of clients currently managed by Workspace
**/
const ClientList &clientList() const {
return clients;
}
/**
* @return List of unmanaged "clients" currently registered in Workspace
**/
const UnmanagedList &unmanagedList() const {
return unmanaged;
}
//-------------------------------------------------
// Tiling
public: