[effects] Adjust SlidingPopups to new windowShown and windowHidden signals
Summary: With this change SlidingPopups is able to animate Wayland clients properly, though windowHidden does not yet work for OpenGL based windows (buffer seems to get lost somewhere). Reviewers: #kwin, #plasma_on_wayland Subscribers: plasma-devel, kwin Tags: #plasma_on_wayland, #kwin Differential Revision: https://phabricator.kde.org/D2085icc-effect-5.14.5
parent
5ee958ca7e
commit
c6b2562710
|
@ -45,6 +45,8 @@ SlidingPopupsEffect::SlidingPopupsEffect()
|
||||||
connect(effects, SIGNAL(windowClosed(KWin::EffectWindow*)), this, SLOT(slotWindowClosed(KWin::EffectWindow*)));
|
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(windowDeleted(KWin::EffectWindow*)), this, SLOT(slotWindowDeleted(KWin::EffectWindow*)));
|
||||||
connect(effects, SIGNAL(propertyNotify(KWin::EffectWindow*,long)), this, SLOT(slotPropertyNotify(KWin::EffectWindow*,long)));
|
connect(effects, SIGNAL(propertyNotify(KWin::EffectWindow*,long)), this, SLOT(slotPropertyNotify(KWin::EffectWindow*,long)));
|
||||||
|
connect(effects, &EffectsHandler::windowShown, this, &SlidingPopupsEffect::startForShow);
|
||||||
|
connect(effects, &EffectsHandler::windowHidden, this, &SlidingPopupsEffect::slotWindowClosed);
|
||||||
reconfigure(ReconfigureAll);
|
reconfigure(ReconfigureAll);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,11 +109,15 @@ void SlidingPopupsEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& da
|
||||||
|
|
||||||
if (progress != 1.0) {
|
if (progress != 1.0) {
|
||||||
data.setTransformed();
|
data.setTransformed();
|
||||||
w->enablePainting(EffectWindow::PAINT_DISABLED_BY_DELETE);
|
w->enablePainting(EffectWindow::PAINT_DISABLED | EffectWindow::PAINT_DISABLED_BY_DELETE);
|
||||||
} else {
|
} else {
|
||||||
delete mDisappearingWindows.take(w);
|
delete mDisappearingWindows.take(w);
|
||||||
w->addRepaintFull();
|
w->addRepaintFull();
|
||||||
|
if (w->isDeleted()) {
|
||||||
w->unrefWindow();
|
w->unrefWindow();
|
||||||
|
} else {
|
||||||
|
w->unreferencePreviousWindowPixmap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (progress != 1.0) {
|
if (progress != 1.0) {
|
||||||
|
@ -191,7 +197,7 @@ void SlidingPopupsEffect::paintWindow(EffectWindow* w, int mask, QRegion region,
|
||||||
if (mAppearingWindows.contains(w)) {
|
if (mAppearingWindows.contains(w)) {
|
||||||
appearing = true;
|
appearing = true;
|
||||||
animating = true;
|
animating = true;
|
||||||
} else if (mDisappearingWindows.contains(w) && w->isDeleted()) {
|
} else if (mDisappearingWindows.contains(w)) {
|
||||||
appearing = false;
|
appearing = false;
|
||||||
animating = true;
|
animating = true;
|
||||||
}
|
}
|
||||||
|
@ -278,11 +284,26 @@ void SlidingPopupsEffect::slotWindowAdded(EffectWindow *w)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
startForShow(w);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SlidingPopupsEffect::startForShow(EffectWindow *w)
|
||||||
|
{
|
||||||
if (w->isOnCurrentDesktop() && mWindowsData.contains(w)) {
|
if (w->isOnCurrentDesktop() && mWindowsData.contains(w)) {
|
||||||
if (!w->data(WindowForceBackgroundContrastRole).isValid() && w->hasAlpha()) {
|
if (!w->data(WindowForceBackgroundContrastRole).isValid() && w->hasAlpha()) {
|
||||||
w->setData(WindowForceBackgroundContrastRole, QVariant(true));
|
w->setData(WindowForceBackgroundContrastRole, QVariant(true));
|
||||||
m_backgroundContrastForced.append(w);
|
m_backgroundContrastForced.append(w);
|
||||||
}
|
}
|
||||||
|
auto it = mDisappearingWindows.find(w);
|
||||||
|
if (it != mDisappearingWindows.end()) {
|
||||||
|
delete it.value();
|
||||||
|
mDisappearingWindows.erase(it);
|
||||||
|
}
|
||||||
|
it = mAppearingWindows.find(w);
|
||||||
|
if (it != mAppearingWindows.end()) {
|
||||||
|
delete it.value();
|
||||||
|
mAppearingWindows.erase(it);
|
||||||
|
}
|
||||||
mAppearingWindows.insert(w, new QTimeLine(mWindowsData[ w ].fadeInDuration, this));
|
mAppearingWindows.insert(w, new QTimeLine(mWindowsData[ w ].fadeInDuration, this));
|
||||||
mAppearingWindows[ w ]->setCurveShape(QTimeLine::EaseInOutCurve);
|
mAppearingWindows[ w ]->setCurveShape(QTimeLine::EaseInOutCurve);
|
||||||
|
|
||||||
|
@ -298,8 +319,20 @@ void SlidingPopupsEffect::slotWindowAdded(EffectWindow *w)
|
||||||
void SlidingPopupsEffect::slotWindowClosed(EffectWindow* w)
|
void SlidingPopupsEffect::slotWindowClosed(EffectWindow* w)
|
||||||
{
|
{
|
||||||
if (w->isOnCurrentDesktop() && !w->isMinimized() && mWindowsData.contains(w)) {
|
if (w->isOnCurrentDesktop() && !w->isMinimized() && mWindowsData.contains(w)) {
|
||||||
|
if (w->isDeleted()) {
|
||||||
w->refWindow();
|
w->refWindow();
|
||||||
delete mAppearingWindows.take(w);
|
} else {
|
||||||
|
w->referencePreviousWindowPixmap();
|
||||||
|
}
|
||||||
|
auto it = mAppearingWindows.find(w);
|
||||||
|
if (it != mAppearingWindows.end()) {
|
||||||
|
delete it.value();
|
||||||
|
mAppearingWindows.erase(it);
|
||||||
|
}
|
||||||
|
// could be already running, better check
|
||||||
|
if (mDisappearingWindows.contains(w)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
mDisappearingWindows.insert(w, new QTimeLine(mWindowsData[ w ].fadeOutDuration, this));
|
mDisappearingWindows.insert(w, new QTimeLine(mWindowsData[ w ].fadeOutDuration, this));
|
||||||
mDisappearingWindows[ w ]->setCurveShape(QTimeLine::EaseInOutCurve);
|
mDisappearingWindows[ w ]->setCurveShape(QTimeLine::EaseInOutCurve);
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,7 @@ public Q_SLOTS:
|
||||||
void slotWaylandSlideOnShowChanged(EffectWindow* w);
|
void slotWaylandSlideOnShowChanged(EffectWindow* w);
|
||||||
private:
|
private:
|
||||||
void setupAnimData(EffectWindow *w);
|
void setupAnimData(EffectWindow *w);
|
||||||
|
void startForShow(EffectWindow *w);
|
||||||
|
|
||||||
enum Position {
|
enum Position {
|
||||||
West = 0,
|
West = 0,
|
||||||
|
|
Loading…
Reference in New Issue