WindowMinimized becomes a signal

This commit is contained in:
Martin Gräßlin 2011-03-06 10:55:27 +01:00
parent edd0950f96
commit 012222037e
10 changed files with 23 additions and 15 deletions

View file

@ -898,8 +898,8 @@ void Client::minimize(bool avoid_animation)
workspace()->updateMinimizedOfTransients(this); workspace()->updateMinimizedOfTransients(this);
updateWindowRules(); updateWindowRules();
workspace()->updateFocusChains(this, Workspace::FocusChainMakeLast); workspace()->updateFocusChains(this, Workspace::FocusChainMakeLast);
if (effects && !avoid_animation) // TODO: Shouldn't it tell effects at least about the change? // TODO: merge signal with s_minimized
static_cast<EffectsHandlerImpl*>(effects)->windowMinimized(effectWindow()); emit clientMinimized(this, !avoid_animation);
// when tiling, request a rearrangement // when tiling, request a rearrangement
workspace()->notifyTilingWindowMinimizeToggled(this); workspace()->notifyTilingWindowMinimizeToggled(this);

View file

@ -496,6 +496,7 @@ signals:
void s_fullScreenSet(bool, bool); void s_fullScreenSet(bool, bool);
void clientClosed(KWin::Client*); void clientClosed(KWin::Client*);
void clientMaximizedStateChanged(KWin::Client*, KDecorationDefines::MaximizeMode); void clientMaximizedStateChanged(KWin::Client*, KDecorationDefines::MaximizeMode);
void clientMinimized(KWin::Client* client, bool animate);
// To make workspace-client calls, a few slots are also // To make workspace-client calls, a few slots are also
// required // required

View file

@ -106,6 +106,7 @@ EffectsHandlerImpl::EffectsHandlerImpl(CompositingType type)
connect(c, SIGNAL(clientClosed(KWin::Client*)), this, SLOT(slotClientClosed(KWin::Client*))); 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(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(opacityChanged(KWin::Toplevel*,qreal)), this, SLOT(slotOpacityChanged(KWin::Toplevel*,qreal)));
connect(c, SIGNAL(clientMinimized(KWin::Client*,bool)), this, SLOT(slotClientMinimized(KWin::Client*,bool)));
} }
foreach (Unmanaged *u, ws->unmanagedList()) { foreach (Unmanaged *u, ws->unmanagedList()) {
connect(u, SIGNAL(unmanagedClosed(KWin::Unmanaged*)), this, SLOT(slotUnmanagedClosed(KWin::Unmanaged*))); connect(u, SIGNAL(unmanagedClosed(KWin::Unmanaged*)), this, SLOT(slotUnmanagedClosed(KWin::Unmanaged*)));
@ -302,6 +303,7 @@ void EffectsHandlerImpl::slotClientAdded(Client *c)
connect(c, SIGNAL(clientClosed(KWin::Client*)), this, SLOT(slotClientClosed(KWin::Client*))); 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(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(opacityChanged(KWin::Toplevel*,qreal)), this, SLOT(slotOpacityChanged(KWin::Toplevel*,qreal)));
connect(c, SIGNAL(clientMinimized(KWin::Client*,bool)), this, SLOT(slotClientMinimized(KWin::Client*,bool)));
emit windowAdded(c->effectWindow()); emit windowAdded(c->effectWindow());
} }
@ -333,10 +335,12 @@ void EffectsHandlerImpl::slotClientActivated(KWin::Client *c)
emit windowActivated(c ? c->effectWindow() : NULL); emit windowActivated(c ? c->effectWindow() : NULL);
} }
void EffectsHandlerImpl::windowMinimized(EffectWindow* c) void EffectsHandlerImpl::slotClientMinimized(Client *c, bool animate)
{ {
foreach (const EffectPair & ep, loaded_effects) // TODO: notify effects even if it should not animate?
ep.second->windowMinimized(c); if (animate) {
emit windowMinimized(c->effectWindow());
}
} }
void EffectsHandlerImpl::windowUnminimized(EffectWindow* c) void EffectsHandlerImpl::windowUnminimized(EffectWindow* c)

View file

@ -159,7 +159,6 @@ public:
// internal (used by kwin core or compositing code) // internal (used by kwin core or compositing code)
void startPaint(); void startPaint();
void windowMoveResizeGeometryUpdate(EffectWindow* c, const QRect& geometry); void windowMoveResizeGeometryUpdate(EffectWindow* c, const QRect& geometry);
void windowMinimized(EffectWindow* c);
void windowUnminimized(EffectWindow* c); void windowUnminimized(EffectWindow* c);
void clientGroupItemSwitched(EffectWindow* from, EffectWindow* to); void clientGroupItemSwitched(EffectWindow* from, EffectWindow* to);
void clientGroupItemAdded(EffectWindow* from, EffectWindow* to); void clientGroupItemAdded(EffectWindow* from, EffectWindow* to);
@ -202,6 +201,7 @@ protected Q_SLOTS:
void slotDeletedRemoved(KWin::Deleted *d); void slotDeletedRemoved(KWin::Deleted *d);
void slotClientMaximized(KWin::Client *c, KDecorationDefines::MaximizeMode maxMode); void slotClientMaximized(KWin::Client *c, KDecorationDefines::MaximizeMode maxMode);
void slotOpacityChanged(KWin::Toplevel *t, qreal oldOpacity); void slotOpacityChanged(KWin::Toplevel *t, qreal oldOpacity);
void slotClientMinimized(KWin::Client *c, bool animate);
protected: protected:
KLibrary* findEffectLibrary(KService* service); KLibrary* findEffectLibrary(KService* service);

View file

@ -35,6 +35,7 @@ MagicLampEffect::MagicLampEffect()
mActiveAnimations = 0; mActiveAnimations = 0;
reconfigure(ReconfigureAll); reconfigure(ReconfigureAll);
connect(effects, SIGNAL(windowDeleted(EffectWindow*)), this, SLOT(slotWindowDeleted(EffectWindow*))); connect(effects, SIGNAL(windowDeleted(EffectWindow*)), this, SLOT(slotWindowDeleted(EffectWindow*)));
connect(effects, SIGNAL(windowMinimized(EffectWindow*)), this, SLOT(slotWindowMinimized(EffectWindow*)));
} }
bool MagicLampEffect::supported() bool MagicLampEffect::supported()
@ -327,7 +328,7 @@ void MagicLampEffect::slotWindowDeleted(EffectWindow* w)
mTimeLineWindows.remove(w); mTimeLineWindows.remove(w);
} }
void MagicLampEffect::windowMinimized(EffectWindow* w) void MagicLampEffect::slotWindowMinimized(EffectWindow* w)
{ {
if (effects->activeFullScreenEffect()) if (effects->activeFullScreenEffect())
return; return;

View file

@ -39,13 +39,13 @@ public:
virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data); virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data);
virtual void postPaintScreen(); virtual void postPaintScreen();
virtual void windowMinimized(EffectWindow* c);
virtual void windowUnminimized(EffectWindow* c); virtual void windowUnminimized(EffectWindow* c);
static bool supported(); static bool supported();
public Q_SLOTS: public Q_SLOTS:
void slotWindowDeleted(EffectWindow *w); void slotWindowDeleted(EffectWindow *w);
void slotWindowMinimized(EffectWindow *w);
private: private:
QHash< EffectWindow*, TimeLine > mTimeLineWindows; QHash< EffectWindow*, TimeLine > mTimeLineWindows;

View file

@ -29,6 +29,7 @@ MinimizeAnimationEffect::MinimizeAnimationEffect()
{ {
mActiveAnimations = 0; mActiveAnimations = 0;
connect(effects, SIGNAL(windowDeleted(EffectWindow*)), this, SLOT(slotWindowDeleted(EffectWindow*))); connect(effects, SIGNAL(windowDeleted(EffectWindow*)), this, SLOT(slotWindowDeleted(EffectWindow*)));
connect(effects, SIGNAL(windowMinimized(EffectWindow*)), this, SLOT(slotWindowMinimized(EffectWindow*)));
} }
@ -114,7 +115,7 @@ void MinimizeAnimationEffect::slotWindowDeleted(EffectWindow* w)
mTimeLineWindows.remove(w); mTimeLineWindows.remove(w);
} }
void MinimizeAnimationEffect::windowMinimized(EffectWindow* w) void MinimizeAnimationEffect::slotWindowMinimized(EffectWindow* w)
{ {
if (effects->activeFullScreenEffect()) if (effects->activeFullScreenEffect())
return; return;

View file

@ -43,11 +43,11 @@ public:
virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data); virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data);
virtual void postPaintScreen(); virtual void postPaintScreen();
virtual void windowMinimized(EffectWindow* c);
virtual void windowUnminimized(EffectWindow* c); virtual void windowUnminimized(EffectWindow* c);
public Q_SLOTS: public Q_SLOTS:
void slotWindowDeleted(EffectWindow *w); void slotWindowDeleted(EffectWindow *w);
void slotWindowMinimized(EffectWindow *w);
private: private:
QHash< EffectWindow*, TimeLine > mTimeLineWindows; QHash< EffectWindow*, TimeLine > mTimeLineWindows;

View file

@ -123,10 +123,6 @@ void Effect::windowMoveResizeGeometryUpdate(EffectWindow* , const QRect&)
{ {
} }
void Effect::windowMinimized(EffectWindow*)
{
}
void Effect::windowUnminimized(EffectWindow*) void Effect::windowUnminimized(EffectWindow*)
{ {
} }

View file

@ -442,7 +442,6 @@ public:
/** called when the geometry changed during moving/resizing. */ /** called when the geometry changed during moving/resizing. */
virtual void windowMoveResizeGeometryUpdate(EffectWindow* c, const QRect& geometry); virtual void windowMoveResizeGeometryUpdate(EffectWindow* c, const QRect& geometry);
virtual void windowMinimized(EffectWindow* c);
virtual void windowUnminimized(EffectWindow* c); virtual void windowUnminimized(EffectWindow* c);
virtual void clientGroupItemSwitched(EffectWindow* from, EffectWindow* to); virtual void clientGroupItemSwitched(EffectWindow* from, EffectWindow* to);
virtual void clientGroupItemAdded(EffectWindow* from, EffectWindow* to); // from merged with to virtual void clientGroupItemAdded(EffectWindow* from, EffectWindow* to); // from merged with to
@ -881,6 +880,12 @@ Q_SIGNALS:
* @since 4.7 * @since 4.7
**/ **/
void windowOpacityChanged(EffectWindow *w, qreal oldOpacity, qreal newOpacity); void windowOpacityChanged(EffectWindow *w, qreal oldOpacity, qreal newOpacity);
/**
* Signal emitted when a window got minimized.
* @param w The window which was minimized
* @since 4.7
**/
void windowMinimized(EffectWindow *w);
protected: protected:
QVector< EffectPair > loaded_effects; QVector< EffectPair > loaded_effects;