Merge branch 'Plasma/5.9'
commit
c36b79345d
|
@ -59,6 +59,8 @@ private Q_SLOTS:
|
|||
void testTouch();
|
||||
void testOpacity();
|
||||
void testMove();
|
||||
void testSkipCloseAnimation_data();
|
||||
void testSkipCloseAnimation();
|
||||
};
|
||||
|
||||
class HelperWindow : public QRasterWindow
|
||||
|
@ -553,6 +555,39 @@ void InternalWindowTest::testMove()
|
|||
QCOMPARE(win.geometry(), QRect(5, 10, 100, 100));
|
||||
}
|
||||
|
||||
void InternalWindowTest::testSkipCloseAnimation_data()
|
||||
{
|
||||
QTest::addColumn<bool>("initial");
|
||||
|
||||
QTest::newRow("set") << true;
|
||||
QTest::newRow("not set") << false;
|
||||
}
|
||||
|
||||
void InternalWindowTest::testSkipCloseAnimation()
|
||||
{
|
||||
QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded);
|
||||
QVERIFY(clientAddedSpy.isValid());
|
||||
HelperWindow win;
|
||||
win.setOpacity(0.5);
|
||||
win.setGeometry(0, 0, 100, 100);
|
||||
QFETCH(bool, initial);
|
||||
win.setProperty("KWIN_SKIP_CLOSE_ANIMATION", initial);
|
||||
win.show();
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
QCOMPARE(clientAddedSpy.count(), 1);
|
||||
auto internalClient = clientAddedSpy.first().first().value<ShellClient*>();
|
||||
QVERIFY(internalClient);
|
||||
QCOMPARE(internalClient->skipsCloseAnimation(), initial);
|
||||
QSignalSpy skipCloseChangedSpy(internalClient, &Toplevel::skipCloseAnimationChanged);
|
||||
QVERIFY(skipCloseChangedSpy.isValid());
|
||||
win.setProperty("KWIN_SKIP_CLOSE_ANIMATION", !initial);
|
||||
QCOMPARE(skipCloseChangedSpy.count(), 1);
|
||||
QCOMPARE(internalClient->skipsCloseAnimation(), !initial);
|
||||
win.setProperty("KWIN_SKIP_CLOSE_ANIMATION", initial);
|
||||
QCOMPARE(skipCloseChangedSpy.count(), 2);
|
||||
QCOMPARE(internalClient->skipsCloseAnimation(), initial);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
WAYLANDTEST_MAIN(KWin::InternalWindowTest)
|
||||
|
|
|
@ -58,6 +58,7 @@ using namespace KWayland::Server;
|
|||
static const QByteArray s_schemePropertyName = QByteArrayLiteral("KDE_COLOR_SCHEME_PATH");
|
||||
static const QByteArray s_appMenuServiceNamePropertyName = QByteArrayLiteral("KDE_APPMENU_SERVICE_NAME");
|
||||
static const QByteArray s_appMenuObjectPathPropertyName = QByteArrayLiteral("KDE_APPMENU_OBJECT_PATH");
|
||||
static const QByteArray s_skipClosePropertyName = QByteArrayLiteral("KWIN_SKIP_CLOSE_ANIMATION");
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
@ -956,6 +957,10 @@ void ShellClient::findInternalWindow()
|
|||
m_windowType = static_cast<NET::WindowType>(windowType.toInt());
|
||||
}
|
||||
setOpacity(m_internalWindow->opacity());
|
||||
|
||||
// skip close animation support
|
||||
setSkipCloseAnimation(m_internalWindow->property(s_skipClosePropertyName).toBool());
|
||||
m_internalWindow->installEventFilter(this);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1243,6 +1248,12 @@ bool ShellClient::eventFilter(QObject *watched, QEvent *event)
|
|||
updateApplicationMenuObjectPath(m_qtExtendedSurface->property(pe->propertyName().constData()).toString());
|
||||
}
|
||||
}
|
||||
if (watched == m_internalWindow && event->type() == QEvent::DynamicPropertyChange) {
|
||||
QDynamicPropertyChangeEvent *pe = static_cast<QDynamicPropertyChangeEvent*>(event);
|
||||
if (pe->propertyName() == s_skipClosePropertyName) {
|
||||
setSkipCloseAnimation(m_internalWindow->property(s_skipClosePropertyName).toBool());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue