WindowOpacityChanged becomes a signal
This commit is contained in:
parent
eeb10c69d5
commit
edd0950f96
9 changed files with 26 additions and 20 deletions
14
effects.cpp
14
effects.cpp
|
@ -105,9 +105,11 @@ EffectsHandlerImpl::EffectsHandlerImpl(CompositingType type)
|
|||
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)));
|
||||
}
|
||||
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)));
|
||||
}
|
||||
reconfigure();
|
||||
}
|
||||
|
@ -287,26 +289,26 @@ void EffectsHandlerImpl::windowMoveResizeGeometryUpdate(EffectWindow* c, const Q
|
|||
ep.second->windowMoveResizeGeometryUpdate(c, geometry);
|
||||
}
|
||||
|
||||
void EffectsHandlerImpl::windowOpacityChanged(EffectWindow* c, double old_opacity)
|
||||
void EffectsHandlerImpl::slotOpacityChanged(Toplevel *t, qreal oldOpacity)
|
||||
{
|
||||
if (!c)
|
||||
if (t->opacity() == oldOpacity) {
|
||||
return;
|
||||
if (static_cast<EffectWindowImpl*>(c)->window()->opacity() == old_opacity)
|
||||
return;
|
||||
foreach (const EffectPair & ep, loaded_effects)
|
||||
ep.second->windowOpacityChanged(c, old_opacity);
|
||||
}
|
||||
emit windowOpacityChanged(t->effectWindow(), oldOpacity, (qreal)t->opacity());
|
||||
}
|
||||
|
||||
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)));
|
||||
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)));
|
||||
emit windowAdded(u->effectWindow());
|
||||
}
|
||||
|
||||
|
|
|
@ -159,7 +159,6 @@ public:
|
|||
// internal (used by kwin core or compositing code)
|
||||
void startPaint();
|
||||
void windowMoveResizeGeometryUpdate(EffectWindow* c, const QRect& geometry);
|
||||
void windowOpacityChanged(EffectWindow* c, double old_opacity);
|
||||
void windowMinimized(EffectWindow* c);
|
||||
void windowUnminimized(EffectWindow* c);
|
||||
void clientGroupItemSwitched(EffectWindow* from, EffectWindow* to);
|
||||
|
@ -202,6 +201,7 @@ protected Q_SLOTS:
|
|||
void slotClientActivated(KWin::Client *c);
|
||||
void slotDeletedRemoved(KWin::Deleted *d);
|
||||
void slotClientMaximized(KWin::Client *c, KDecorationDefines::MaximizeMode maxMode);
|
||||
void slotOpacityChanged(KWin::Toplevel *t, qreal oldOpacity);
|
||||
|
||||
protected:
|
||||
KLibrary* findEffectLibrary(KService* service);
|
||||
|
|
|
@ -33,6 +33,7 @@ FadeEffect::FadeEffect()
|
|||
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*)));
|
||||
connect(effects, SIGNAL(windowOpacityChanged(EffectWindow*,qreal,qreal)), this, SLOT(slotWindowOpacityChanged(EffectWindow*,qreal)));
|
||||
}
|
||||
|
||||
void FadeEffect::reconfigure(ReconfigureFlags)
|
||||
|
@ -147,7 +148,7 @@ void FadeEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPa
|
|||
effects->paintWindow(w, mask, region, data);
|
||||
}
|
||||
|
||||
void FadeEffect::windowOpacityChanged(EffectWindow* w, double old_opacity)
|
||||
void FadeEffect::slotWindowOpacityChanged(EffectWindow* w, qreal old_opacity)
|
||||
{
|
||||
if (!windows.contains(w))
|
||||
windows[ w ].opacity = old_opacity;
|
||||
|
|
|
@ -38,7 +38,6 @@ public:
|
|||
virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data);
|
||||
|
||||
// TODO react also on virtual desktop changes
|
||||
virtual void windowOpacityChanged(EffectWindow* c, double old_opacity);
|
||||
|
||||
bool isFadeWindow(EffectWindow* w);
|
||||
|
||||
|
@ -46,6 +45,7 @@ public Q_SLOTS:
|
|||
void slotWindowAdded(EffectWindow* c);
|
||||
void slotWindowClosed(EffectWindow *c);
|
||||
void slotWindowDeleted(EffectWindow *w);
|
||||
void slotWindowOpacityChanged(EffectWindow *w, qreal oldOpacity);
|
||||
private:
|
||||
class WindowInfo;
|
||||
QHash< const EffectWindow*, WindowInfo > windows;
|
||||
|
|
|
@ -576,9 +576,8 @@ bool Client::windowEvent(XEvent* e)
|
|||
if (dirty[ WinInfo::PROTOCOLS2 ] & NET::WM2Opacity) {
|
||||
if (compositing()) {
|
||||
addRepaintFull();
|
||||
emit opacityChanged(this, old_opacity);
|
||||
scene->windowOpacityChanged(this);
|
||||
if (effects)
|
||||
static_cast<EffectsHandlerImpl*>(effects)->windowOpacityChanged(effectWindow(), old_opacity);
|
||||
} else {
|
||||
// forward to the frame if there's possibly another compositing manager running
|
||||
NETWinInfo2 i(display(), frameId(), rootWindow(), 0);
|
||||
|
@ -1613,9 +1612,8 @@ bool Unmanaged::windowEvent(XEvent* e)
|
|||
if (dirty[ NETWinInfo::PROTOCOLS2 ] & NET::WM2Opacity) {
|
||||
if (compositing()) {
|
||||
addRepaintFull();
|
||||
emit opacityChanged(this, old_opacity);
|
||||
scene->windowOpacityChanged(this);
|
||||
if (effects)
|
||||
static_cast<EffectsHandlerImpl*>(effects)->windowOpacityChanged(effectWindow(), old_opacity);
|
||||
}
|
||||
}
|
||||
switch(e->type) {
|
||||
|
|
|
@ -123,10 +123,6 @@ void Effect::windowMoveResizeGeometryUpdate(EffectWindow* , const QRect&)
|
|||
{
|
||||
}
|
||||
|
||||
void Effect::windowOpacityChanged(EffectWindow*, double)
|
||||
{
|
||||
}
|
||||
|
||||
void Effect::windowMinimized(EffectWindow*)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -442,7 +442,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 windowMinimized(EffectWindow* c);
|
||||
virtual void windowUnminimized(EffectWindow* c);
|
||||
virtual void clientGroupItemSwitched(EffectWindow* from, EffectWindow* to);
|
||||
|
@ -874,6 +873,14 @@ Q_SIGNALS:
|
|||
* @since 4.7
|
||||
**/
|
||||
void windowUserMovedResized(EffectWindow *w, bool first, bool last);
|
||||
/**
|
||||
* Signal emitted when the windows opacity is changed.
|
||||
* @param w The window whose opacity level is changed.
|
||||
* @param oldOpacity The previous opacity level
|
||||
* @param newOpacity The new opacity level
|
||||
* @since 4.7
|
||||
**/
|
||||
void windowOpacityChanged(EffectWindow *w, qreal oldOpacity, qreal newOpacity);
|
||||
|
||||
protected:
|
||||
QVector< EffectPair > loaded_effects;
|
||||
|
|
|
@ -318,9 +318,8 @@ void Toplevel::setOpacity(double new_opacity)
|
|||
info->setOpacity(static_cast< unsigned long >(new_opacity * 0xffffffff));
|
||||
if (compositing()) {
|
||||
addRepaintFull();
|
||||
emit opacityChanged(this, old_opacity);
|
||||
scene->windowOpacityChanged(this);
|
||||
if (effects)
|
||||
static_cast<EffectsHandlerImpl*>(effects)->windowOpacityChanged(effectWindow(), old_opacity);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -135,6 +135,9 @@ public:
|
|||
void resetDamage(const QRect& r);
|
||||
EffectWindowImpl* effectWindow();
|
||||
|
||||
signals:
|
||||
void opacityChanged(KWin::Toplevel* toplevel, qreal oldOpacity);
|
||||
|
||||
protected:
|
||||
virtual ~Toplevel();
|
||||
void setWindowHandles(Window client, Window frame);
|
||||
|
|
Loading…
Reference in a new issue