Merge branch 'Plasma/5.12'
commit
119c64839d
|
@ -76,6 +76,8 @@ private Q_SLOTS:
|
||||||
void testModifierClickUnrestrictedMove();
|
void testModifierClickUnrestrictedMove();
|
||||||
void testModifierScrollOpacity_data();
|
void testModifierScrollOpacity_data();
|
||||||
void testModifierScrollOpacity();
|
void testModifierScrollOpacity();
|
||||||
|
void testTouchEvents_data();
|
||||||
|
void testTouchEvents();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AbstractClient *showWindow(Test::ShellSurfaceType type);
|
AbstractClient *showWindow(Test::ShellSurfaceType type);
|
||||||
|
@ -757,6 +759,81 @@ void DecorationInputTest::testModifierScrollOpacity()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DecorationInputTest::testTouchEvents_data()
|
||||||
|
{
|
||||||
|
QTest::addColumn<Test::ShellSurfaceType>("type");
|
||||||
|
|
||||||
|
QTest::newRow("wlShell") << Test::ShellSurfaceType::WlShell;
|
||||||
|
QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5;
|
||||||
|
QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6;
|
||||||
|
}
|
||||||
|
|
||||||
|
class EventHelper : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
EventHelper() : QObject() {}
|
||||||
|
~EventHelper() override = default;
|
||||||
|
|
||||||
|
bool eventFilter(QObject *watched, QEvent *event) override
|
||||||
|
{
|
||||||
|
Q_UNUSED(watched)
|
||||||
|
if (event->type() == QEvent::HoverMove) {
|
||||||
|
emit hoverMove();
|
||||||
|
} else if (event->type() == QEvent::HoverLeave) {
|
||||||
|
emit hoverLeave();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_SIGNALS:
|
||||||
|
void hoverMove();
|
||||||
|
void hoverLeave();
|
||||||
|
};
|
||||||
|
|
||||||
|
void DecorationInputTest::testTouchEvents()
|
||||||
|
{
|
||||||
|
// this test verifies that the decoration gets a hover leave event on touch release
|
||||||
|
// see BUG 386231
|
||||||
|
QFETCH(Test::ShellSurfaceType, type);
|
||||||
|
AbstractClient *c = showWindow(type);
|
||||||
|
QVERIFY(c);
|
||||||
|
QVERIFY(c->isDecorated());
|
||||||
|
QVERIFY(!c->noBorder());
|
||||||
|
|
||||||
|
EventHelper helper;
|
||||||
|
c->decoration()->installEventFilter(&helper);
|
||||||
|
QSignalSpy hoverMoveSpy(&helper, &EventHelper::hoverMove);
|
||||||
|
QVERIFY(hoverMoveSpy.isValid());
|
||||||
|
QSignalSpy hoverLeaveSpy(&helper, &EventHelper::hoverLeave);
|
||||||
|
QVERIFY(hoverLeaveSpy.isValid());
|
||||||
|
|
||||||
|
quint32 timestamp = 1;
|
||||||
|
const QPoint tapPoint(c->geometry().center().x(), c->clientPos().y() / 2);
|
||||||
|
|
||||||
|
QVERIFY(!input()->touch()->decoration());
|
||||||
|
kwinApp()->platform()->touchDown(0, tapPoint, timestamp++);
|
||||||
|
QVERIFY(input()->touch()->decoration());
|
||||||
|
QCOMPARE(input()->touch()->decoration()->decoration(), c->decoration());
|
||||||
|
QCOMPARE(hoverMoveSpy.count(), 1);
|
||||||
|
QCOMPARE(hoverLeaveSpy.count(), 0);
|
||||||
|
kwinApp()->platform()->touchUp(0, timestamp++);
|
||||||
|
QCOMPARE(hoverMoveSpy.count(), 1);
|
||||||
|
QCOMPARE(hoverLeaveSpy.count(), 1);
|
||||||
|
|
||||||
|
QCOMPARE(c->isMove(), false);
|
||||||
|
|
||||||
|
// let's check that a hover motion is sent if the pointer is on deco, when touch release
|
||||||
|
Cursor::setPos(tapPoint);
|
||||||
|
QCOMPARE(hoverMoveSpy.count(), 2);
|
||||||
|
kwinApp()->platform()->touchDown(0, tapPoint, timestamp++);
|
||||||
|
QCOMPARE(hoverMoveSpy.count(), 3);
|
||||||
|
QCOMPARE(hoverLeaveSpy.count(), 1);
|
||||||
|
kwinApp()->platform()->touchUp(0, timestamp++);
|
||||||
|
QCOMPARE(hoverMoveSpy.count(), 4);
|
||||||
|
QCOMPARE(hoverLeaveSpy.count(), 1);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WAYLANDTEST_MAIN(KWin::DecorationInputTest)
|
WAYLANDTEST_MAIN(KWin::DecorationInputTest)
|
||||||
|
|
|
@ -211,6 +211,7 @@ void InternalWindowTest::testEnterLeave()
|
||||||
QVERIFY(!workspace()->activeClient());
|
QVERIFY(!workspace()->activeClient());
|
||||||
ShellClient *c = clientAddedSpy.first().first().value<ShellClient*>();
|
ShellClient *c = clientAddedSpy.first().first().value<ShellClient*>();
|
||||||
QVERIFY(c->isInternal());
|
QVERIFY(c->isInternal());
|
||||||
|
QCOMPARE(c->icon().name(), QStringLiteral("wayland"));
|
||||||
QCOMPARE(workspace()->findToplevel(&win), c);
|
QCOMPARE(workspace()->findToplevel(&win), c);
|
||||||
QCOMPARE(c->geometry(), QRect(0, 0, 100, 100));
|
QCOMPARE(c->geometry(), QRect(0, 0, 100, 100));
|
||||||
QVERIFY(c->isShown(false));
|
QVERIFY(c->isShown(false));
|
||||||
|
|
|
@ -560,7 +560,7 @@ void QuickTilingTest::testQuickTilingTouchMoveXdgShell()
|
||||||
QCOMPARE(quickTileChangedSpy.count(), 1);
|
QCOMPARE(quickTileChangedSpy.count(), 1);
|
||||||
QTEST(c->quickTileMode(), "expectedMode");
|
QTEST(c->quickTileMode(), "expectedMode");
|
||||||
QVERIFY(configureRequestedSpy.wait());
|
QVERIFY(configureRequestedSpy.wait());
|
||||||
QCOMPARE(configureRequestedSpy.count(), 5);
|
QTRY_COMPARE(configureRequestedSpy.count(), 5);
|
||||||
QCOMPARE(false, configureRequestedSpy.last().first().toSize().isEmpty());
|
QCOMPARE(false, configureRequestedSpy.last().first().toSize().isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -162,6 +162,7 @@ void TestShellClient::testMapUnmapMap()
|
||||||
QCOMPARE(client->readyForPainting(), true);
|
QCOMPARE(client->readyForPainting(), true);
|
||||||
QCOMPARE(client->depth(), 32);
|
QCOMPARE(client->depth(), 32);
|
||||||
QVERIFY(client->hasAlpha());
|
QVERIFY(client->hasAlpha());
|
||||||
|
QCOMPARE(client->icon().name(), QStringLiteral("wayland"));
|
||||||
QCOMPARE(workspace()->activeClient(), client);
|
QCOMPARE(workspace()->activeClient(), client);
|
||||||
QVERIFY(effectsWindowShownSpy.isEmpty());
|
QVERIFY(effectsWindowShownSpy.isEmpty());
|
||||||
QVERIFY(client->isMaximizable());
|
QVERIFY(client->isMaximizable());
|
||||||
|
|
10
input.cpp
10
input.cpp
|
@ -1126,6 +1126,16 @@ public:
|
||||||
e.setAccepted(false);
|
e.setAccepted(false);
|
||||||
QCoreApplication::sendEvent(decoration->decoration(), &e);
|
QCoreApplication::sendEvent(decoration->decoration(), &e);
|
||||||
decoration->client()->processDecorationButtonRelease(&e);
|
decoration->client()->processDecorationButtonRelease(&e);
|
||||||
|
if (input()->pointer()->decoration() == decoration) {
|
||||||
|
// send motion to current pointer position
|
||||||
|
const QPointF p = input()->pointer()->pos() - decoration->client()->pos();
|
||||||
|
QHoverEvent event(QEvent::HoverMove, p, p);
|
||||||
|
QCoreApplication::instance()->sendEvent(decoration->decoration(), &event);
|
||||||
|
} else {
|
||||||
|
// send leave
|
||||||
|
QHoverEvent event(QEvent::HoverLeave, QPointF(), QPointF());
|
||||||
|
QCoreApplication::instance()->sendEvent(decoration->decoration(), &event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_lastGlobalTouchPos = QPointF();
|
m_lastGlobalTouchPos = QPointF();
|
||||||
|
|
|
@ -197,6 +197,7 @@ void ShellClient::init()
|
||||||
findInternalWindow();
|
findInternalWindow();
|
||||||
createWindowId();
|
createWindowId();
|
||||||
setupCompositing();
|
setupCompositing();
|
||||||
|
updateIcon();
|
||||||
SurfaceInterface *s = surface();
|
SurfaceInterface *s = surface();
|
||||||
Q_ASSERT(s);
|
Q_ASSERT(s);
|
||||||
if (s->buffer()) {
|
if (s->buffer()) {
|
||||||
|
|
Loading…
Reference in New Issue