[effects/fallapart] Fix flickering problem
Summary: The Fall Apart effect doesn't grab windows so a conflict could happen if an alternative window open/close animation effect is enabled(e.g. Fade, Glide). ### Before {F5912324} //Fall apart and Fade conflict with each other.// ### After {F5912325} //Only Fall apart animates the disappearing of System Settings.// Test Plan: * Enabled fall apart effect and fade effect * Closed a window Reviewers: #kwin, davidedmundson Reviewed By: #kwin, davidedmundson Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13527
This commit is contained in:
parent
3e2ff0e870
commit
5daa612bce
2 changed files with 23 additions and 1 deletions
|
@ -38,6 +38,7 @@ FallApartEffect::FallApartEffect()
|
|||
reconfigure(ReconfigureAll);
|
||||
connect(effects, SIGNAL(windowClosed(KWin::EffectWindow*)), this, SLOT(slotWindowClosed(KWin::EffectWindow*)));
|
||||
connect(effects, SIGNAL(windowDeleted(KWin::EffectWindow*)), this, SLOT(slotWindowDeleted(KWin::EffectWindow*)));
|
||||
connect(effects, SIGNAL(windowDataChanged(KWin::EffectWindow*,int)), this, SLOT(slotWindowDataChanged(KWin::EffectWindow*,int)));
|
||||
}
|
||||
|
||||
void FallApartEffect::reconfigure(ReconfigureFlags)
|
||||
|
@ -157,6 +158,7 @@ void FallApartEffect::slotWindowClosed(EffectWindow* c)
|
|||
const void* e = c->data(WindowClosedGrabRole).value<void*>();
|
||||
if (e && e != this)
|
||||
return;
|
||||
c->setData(WindowClosedGrabRole, QVariant::fromValue(static_cast<void*>(this)));
|
||||
windows[ c ] = 0;
|
||||
c->refWindow();
|
||||
}
|
||||
|
@ -166,6 +168,25 @@ void FallApartEffect::slotWindowDeleted(EffectWindow* c)
|
|||
windows.remove(c);
|
||||
}
|
||||
|
||||
void FallApartEffect::slotWindowDataChanged(EffectWindow* w, int role)
|
||||
{
|
||||
if (role != WindowClosedGrabRole) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (w->data(role).value<void*>() == this) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto it = windows.find(w);
|
||||
if (it == windows.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
it.key()->unrefWindow();
|
||||
windows.erase(it);
|
||||
}
|
||||
|
||||
bool FallApartEffect::isActive() const
|
||||
{
|
||||
return !windows.isEmpty();
|
||||
|
|
|
@ -54,9 +54,10 @@ public:
|
|||
public Q_SLOTS:
|
||||
void slotWindowClosed(KWin::EffectWindow *c);
|
||||
void slotWindowDeleted(KWin::EffectWindow *w);
|
||||
void slotWindowDataChanged(KWin::EffectWindow *w, int role);
|
||||
|
||||
private:
|
||||
QHash< const EffectWindow*, double > windows;
|
||||
QHash< EffectWindow*, double > windows;
|
||||
bool isRealWindow(EffectWindow* w);
|
||||
int blockSize;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue