Merge branch 'Plasma/5.8'
commit
002d667436
|
@ -222,10 +222,6 @@ void SlidingPopupsTest::testWithOtherEffect()
|
||||||
// sliding popups should be active
|
// sliding popups should be active
|
||||||
QVERIFY(windowAddedSpy.wait());
|
QVERIFY(windowAddedSpy.wait());
|
||||||
QTRY_VERIFY(slidingPoupus->isActive());
|
QTRY_VERIFY(slidingPoupus->isActive());
|
||||||
QEXPECT_FAIL("scale, slide", "bug 336866", Continue);
|
|
||||||
QEXPECT_FAIL("fade, slide", "bug 336866", Continue);
|
|
||||||
QEXPECT_FAIL("wobblywindows, slide", "bug 336866", Continue);
|
|
||||||
QEXPECT_FAIL("slide, wobblywindows", "bug 336866", Continue);
|
|
||||||
QVERIFY(!otherEffect->isActive());
|
QVERIFY(!otherEffect->isActive());
|
||||||
|
|
||||||
// wait till effect ends
|
// wait till effect ends
|
||||||
|
@ -246,8 +242,6 @@ void SlidingPopupsTest::testWithOtherEffect()
|
||||||
|
|
||||||
// again we should have the sliding popups active
|
// again we should have the sliding popups active
|
||||||
QVERIFY(slidingPoupus->isActive());
|
QVERIFY(slidingPoupus->isActive());
|
||||||
QEXPECT_FAIL("wobblywindows, slide", "bug 336866", Continue);
|
|
||||||
QEXPECT_FAIL("slide, wobblywindows", "bug 336866", Continue);
|
|
||||||
QVERIFY(!otherEffect->isActive());
|
QVERIFY(!otherEffect->isActive());
|
||||||
|
|
||||||
QVERIFY(windowDeletedSpy.wait());
|
QVERIFY(windowDeletedSpy.wait());
|
||||||
|
@ -347,10 +341,6 @@ void SlidingPopupsTest::testWithOtherEffectWayland()
|
||||||
// sliding popups should be active
|
// sliding popups should be active
|
||||||
QCOMPARE(windowAddedSpy.count(), 1);
|
QCOMPARE(windowAddedSpy.count(), 1);
|
||||||
QTRY_VERIFY(slidingPoupus->isActive());
|
QTRY_VERIFY(slidingPoupus->isActive());
|
||||||
QEXPECT_FAIL("scale, slide", "bug 336866", Continue);
|
|
||||||
QEXPECT_FAIL("fade, slide", "bug 336866", Continue);
|
|
||||||
QEXPECT_FAIL("wobblywindows, slide", "bug 336866", Continue);
|
|
||||||
QEXPECT_FAIL("slide, wobblywindows", "bug 336866", Continue);
|
|
||||||
QVERIFY(!otherEffect->isActive());
|
QVERIFY(!otherEffect->isActive());
|
||||||
|
|
||||||
// wait till effect ends
|
// wait till effect ends
|
||||||
|
@ -371,8 +361,6 @@ void SlidingPopupsTest::testWithOtherEffectWayland()
|
||||||
|
|
||||||
// again we should have the sliding popups active
|
// again we should have the sliding popups active
|
||||||
QVERIFY(slidingPoupus->isActive());
|
QVERIFY(slidingPoupus->isActive());
|
||||||
QEXPECT_FAIL("wobblywindows, slide", "bug 336866", Continue);
|
|
||||||
QEXPECT_FAIL("slide, wobblywindows", "bug 336866", Continue);
|
|
||||||
QVERIFY(!otherEffect->isActive());
|
QVERIFY(!otherEffect->isActive());
|
||||||
|
|
||||||
QVERIFY(windowDeletedSpy.wait());
|
QVERIFY(windowDeletedSpy.wait());
|
||||||
|
|
|
@ -1703,6 +1703,7 @@ void EffectWindowImpl::setData(int role, const QVariant &data)
|
||||||
dataMap[ role ] = data;
|
dataMap[ role ] = data;
|
||||||
else
|
else
|
||||||
dataMap.remove(role);
|
dataMap.remove(role);
|
||||||
|
emit effects->windowDataChanged(this, role);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant EffectWindowImpl::data(int role) const
|
QVariant EffectWindowImpl::data(int role) const
|
||||||
|
|
|
@ -43,12 +43,12 @@ effect.configChanged.connect(function() {
|
||||||
});
|
});
|
||||||
effects.windowAdded.connect(function(w) {
|
effects.windowAdded.connect(function(w) {
|
||||||
if (fadeWindows && isFadeWindow(w)) {
|
if (fadeWindows && isFadeWindow(w)) {
|
||||||
effect.animate(w, Effect.Opacity, fadeInTime, 1.0, 0.0);
|
w.fadeInWindowTypeAnimation = effect.animate(w, Effect.Opacity, fadeInTime, 1.0, 0.0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
effects.windowClosed.connect(function(w) {
|
effects.windowClosed.connect(function(w) {
|
||||||
if (fadeWindows && isFadeWindow(w)) {
|
if (fadeWindows && isFadeWindow(w)) {
|
||||||
animate({
|
w.fadeOutWindowTypeAnimation = animate({
|
||||||
window: w,
|
window: w,
|
||||||
duration: fadeOutTime,
|
duration: fadeOutTime,
|
||||||
animations: [{
|
animations: [{
|
||||||
|
@ -59,3 +59,20 @@ effects.windowClosed.connect(function(w) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
effects.windowDataChanged.connect(function (window, role) {
|
||||||
|
if (role == Effect.WindowAddedGrabRole) {
|
||||||
|
if (effect.isGrabbed(window, Effect.WindowAddedGrabRole)) {
|
||||||
|
if (window.fadeInWindowTypeAnimation !== undefined) {
|
||||||
|
cancel(window.fadeInWindowTypeAnimation);
|
||||||
|
window.fadeInWindowTypeAnimation = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (role == Effect.WindowClosedGrabRole) {
|
||||||
|
if (effect.isGrabbed(window, Effect.WindowClosedGrabRole)) {
|
||||||
|
if (window.fadeOutWindowTypeAnimation !== undefined) {
|
||||||
|
cancel(window.fadeOutWindowTypeAnimation);
|
||||||
|
window.fadeOutWindowTypeAnimation = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
|
@ -34,7 +34,7 @@ var scaleInEffect = {
|
||||||
},
|
},
|
||||||
scaleIn: function (window) {
|
scaleIn: function (window) {
|
||||||
"use strict";
|
"use strict";
|
||||||
animate({
|
window.scaleInWindowTypeAnimation = animate({
|
||||||
window: window,
|
window: window,
|
||||||
duration: scaleInEffect.duration,
|
duration: scaleInEffect.duration,
|
||||||
curve: QEasingCurve.InOutQuad,
|
curve: QEasingCurve.InOutQuad,
|
||||||
|
@ -56,10 +56,22 @@ var scaleInEffect = {
|
||||||
}
|
}
|
||||||
scaleInEffect.scaleIn(window);
|
scaleInEffect.scaleIn(window);
|
||||||
},
|
},
|
||||||
|
dataChanged: function (window, role) {
|
||||||
|
"use strict";
|
||||||
|
if (role == Effect.WindowAddedGrabRole) {
|
||||||
|
if (effect.isGrabbed(window, Effect.WindowAddedGrabRole)) {
|
||||||
|
if (window.scaleInWindowTypeAnimation !== undefined) {
|
||||||
|
cancel(window.scaleInWindowTypeAnimation);
|
||||||
|
window.scaleInWindowTypeAnimation = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
init: function () {
|
init: function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
effect.configChanged.connect(scaleInEffect.loadConfig);
|
effect.configChanged.connect(scaleInEffect.loadConfig);
|
||||||
effects.windowAdded.connect(scaleInEffect.added);
|
effects.windowAdded.connect(scaleInEffect.added);
|
||||||
|
effects.windowDataChanged.connect(scaleInEffect.dataChanged);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
scaleInEffect.init();
|
scaleInEffect.init();
|
||||||
|
|
|
@ -305,7 +305,6 @@ void SlidingPopupsEffect::startForShow(EffectWindow *w)
|
||||||
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);
|
||||||
|
|
||||||
// Tell other windowAdded() and windowClosed() effects to ignore this window
|
|
||||||
w->setData(WindowAddedGrabRole, QVariant::fromValue(static_cast<void*>(this)));
|
w->setData(WindowAddedGrabRole, QVariant::fromValue(static_cast<void*>(this)));
|
||||||
w->setData(WindowClosedGrabRole, QVariant::fromValue(static_cast<void*>(this)));
|
w->setData(WindowClosedGrabRole, QVariant::fromValue(static_cast<void*>(this)));
|
||||||
w->setData(WindowForceBlurRole, true);
|
w->setData(WindowForceBlurRole, true);
|
||||||
|
|
|
@ -153,6 +153,8 @@ WobblyWindowsEffect::WobblyWindowsEffect()
|
||||||
connect(effects, SIGNAL(windowStepUserMovedResized(KWin::EffectWindow*,QRect)), this, SLOT(slotWindowStepUserMovedResized(KWin::EffectWindow*,QRect)));
|
connect(effects, SIGNAL(windowStepUserMovedResized(KWin::EffectWindow*,QRect)), this, SLOT(slotWindowStepUserMovedResized(KWin::EffectWindow*,QRect)));
|
||||||
connect(effects, SIGNAL(windowFinishUserMovedResized(KWin::EffectWindow*)), this, SLOT(slotWindowFinishUserMovedResized(KWin::EffectWindow*)));
|
connect(effects, SIGNAL(windowFinishUserMovedResized(KWin::EffectWindow*)), this, SLOT(slotWindowFinishUserMovedResized(KWin::EffectWindow*)));
|
||||||
connect(effects, SIGNAL(windowMaximizedStateChanged(KWin::EffectWindow*,bool,bool)), this, SLOT(slotWindowMaximizeStateChanged(KWin::EffectWindow*,bool,bool)));
|
connect(effects, SIGNAL(windowMaximizedStateChanged(KWin::EffectWindow*,bool,bool)), this, SLOT(slotWindowMaximizeStateChanged(KWin::EffectWindow*,bool,bool)));
|
||||||
|
|
||||||
|
connect(effects, &EffectsHandler::windowDataChanged, this, &WobblyWindowsEffect::cancelWindowGrab);
|
||||||
}
|
}
|
||||||
|
|
||||||
WobblyWindowsEffect::~WobblyWindowsEffect()
|
WobblyWindowsEffect::~WobblyWindowsEffect()
|
||||||
|
@ -472,7 +474,7 @@ void WobblyWindowsEffect::stepMovedResized(EffectWindow* w)
|
||||||
|
|
||||||
void WobblyWindowsEffect::slotWindowAdded(EffectWindow* w)
|
void WobblyWindowsEffect::slotWindowAdded(EffectWindow* w)
|
||||||
{
|
{
|
||||||
if (m_openEffectEnabled && w->data(WindowAddedGrabRole).value<void*>() != this) {
|
if (m_openEffectEnabled && w->data(WindowAddedGrabRole).value<void*>() == nullptr) {
|
||||||
if (windows.contains(w)) {
|
if (windows.contains(w)) {
|
||||||
// could this happen ??
|
// could this happen ??
|
||||||
WindowWobblyInfos& wwi = windows[w];
|
WindowWobblyInfos& wwi = windows[w];
|
||||||
|
@ -499,7 +501,7 @@ void WobblyWindowsEffect::slotWindowClosed(EffectWindow* w)
|
||||||
if (windows.isEmpty())
|
if (windows.isEmpty())
|
||||||
effects->addRepaintFull();
|
effects->addRepaintFull();
|
||||||
}
|
}
|
||||||
} else if (m_closeEffectEnabled && w->data(WindowAddedGrabRole).value<void*>() != this) {
|
} else if (m_closeEffectEnabled && w->data(WindowClosedGrabRole).value<void*>() == nullptr) {
|
||||||
WindowWobblyInfos new_wwi;
|
WindowWobblyInfos new_wwi;
|
||||||
initWobblyInfo(new_wwi, w->geometry());
|
initWobblyInfo(new_wwi, w->geometry());
|
||||||
wobblyCloseInit(new_wwi, w);
|
wobblyCloseInit(new_wwi, w);
|
||||||
|
@ -1200,6 +1202,31 @@ void WobblyWindowsEffect::heightRingLinearMean(Pair** data_pointer, WindowWobbly
|
||||||
wwi.buffer = tmp;
|
wwi.buffer = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void WobblyWindowsEffect::cancelWindowGrab(KWin::EffectWindow *w, int grabRole)
|
||||||
|
{
|
||||||
|
if (grabRole == WindowAddedGrabRole) {
|
||||||
|
if (w->data(WindowAddedGrabRole).value<void*>() != this) {
|
||||||
|
auto it = windows.find(w);
|
||||||
|
if (it != windows.end()) {
|
||||||
|
freeWobblyInfo(it.value());
|
||||||
|
windows.erase(it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (grabRole == WindowClosedGrabRole) {
|
||||||
|
if (w->data(WindowClosedGrabRole).value<void*>() != this) {
|
||||||
|
auto it = windows.find(w);
|
||||||
|
if (it != windows.end()) {
|
||||||
|
if (it.value().status == Closing) {
|
||||||
|
w->unrefWindow();
|
||||||
|
}
|
||||||
|
freeWobblyInfo(it.value());
|
||||||
|
windows.erase(it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool WobblyWindowsEffect::isActive() const
|
bool WobblyWindowsEffect::isActive() const
|
||||||
{
|
{
|
||||||
return !windows.isEmpty();
|
return !windows.isEmpty();
|
||||||
|
|
|
@ -136,6 +136,7 @@ public Q_SLOTS:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
void cancelWindowGrab(KWin::EffectWindow *w, int grabRole);
|
||||||
void startMovedResized(EffectWindow* w);
|
void startMovedResized(EffectWindow* w);
|
||||||
void stepMovedResized(EffectWindow* w);
|
void stepMovedResized(EffectWindow* w);
|
||||||
bool updateWindowWobblyDatas(EffectWindow* w, qreal time);
|
bool updateWindowWobblyDatas(EffectWindow* w, qreal time);
|
||||||
|
|
|
@ -1558,6 +1558,21 @@ Q_SIGNALS:
|
||||||
**/
|
**/
|
||||||
void windowHidden(KWin::EffectWindow *w);
|
void windowHidden(KWin::EffectWindow *w);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This signal gets emitted when the data on EffectWindow @p w for @p role changed.
|
||||||
|
*
|
||||||
|
* An Effect can connect to this signal to read the new value and react on it.
|
||||||
|
* E.g. an Effect which does not operate on windows grabbed by another Effect wants
|
||||||
|
* to cancel the already scheduled animation if another Effect adds a grab.
|
||||||
|
*
|
||||||
|
* @param w The EffectWindow for which the data changed
|
||||||
|
* @param role The data role which changed
|
||||||
|
* @see EffectWindow::setData
|
||||||
|
* @see EffectWindow::data
|
||||||
|
* @since 5.8.4
|
||||||
|
**/
|
||||||
|
void windowDataChanged(KWin::EffectWindow *w, int role);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QVector< EffectPair > loaded_effects;
|
QVector< EffectPair > loaded_effects;
|
||||||
//QHash< QString, EffectFactory* > effect_factories;
|
//QHash< QString, EffectFactory* > effect_factories;
|
||||||
|
@ -2038,6 +2053,9 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can be used to by effects to store arbitrary data in the EffectWindow.
|
* Can be used to by effects to store arbitrary data in the EffectWindow.
|
||||||
|
*
|
||||||
|
* Invoking this method will emit the signal EffectsHandler::windowDataChanged.
|
||||||
|
* @see EffectsHandler::windowDataChanged
|
||||||
*/
|
*/
|
||||||
Q_SCRIPTABLE virtual void setData(int role, const QVariant &data) = 0;
|
Q_SCRIPTABLE virtual void setData(int role, const QVariant &data) = 0;
|
||||||
Q_SCRIPTABLE virtual QVariant data(int role) const = 0;
|
Q_SCRIPTABLE virtual QVariant data(int role) const = 0;
|
||||||
|
|
Loading…
Reference in New Issue