Add workaround for touch input offset for decorated windows

Summary:
If a Wayland window is decorated the decoration size was not considered
when passing touch points to the Wayland window. For pointer input this
is considered and implemented through the input transformation matrix
which KWayland::Server::SeatInterface accepts. This should also be done
for Touch. Unfortunately the frameworks version for Plasma 5.9 is already
tagged and done and we cannot depend on new API.

Thus this change tries to workaround by calculating the proper offset
through the input transformation matrix. It isn't nice but fixes the
problem for now.

BUG: 374778

Test Plan: Only in unit test, real test still missing

Reviewers: #plasma_on_wayland, #kwin

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D4074
This commit is contained in:
Martin Gräßlin 2017-01-10 20:29:22 +01:00
parent d38bce776f
commit 7e89c51823
2 changed files with 4 additions and 5 deletions

View file

@ -161,7 +161,6 @@ void TouchInputTest::testMultipleTouchPoints()
QCOMPARE(sequenceStartedSpy.count(), 1);
QCOMPARE(m_touch->sequence().count(), 1);
QCOMPARE(m_touch->sequence().first()->isDown(), true);
QEXPECT_FAIL("decorated", "BUG 374778", Continue);
QCOMPARE(m_touch->sequence().first()->position(), QPointF(25, 25));
QCOMPARE(pointAddedSpy.count(), 0);
QCOMPARE(pointMovedSpy.count(), 0);
@ -172,7 +171,6 @@ void TouchInputTest::testMultipleTouchPoints()
QCOMPARE(pointAddedSpy.count(), 1);
QCOMPARE(m_touch->sequence().count(), 2);
QCOMPARE(m_touch->sequence().at(1)->isDown(), true);
QEXPECT_FAIL("decorated", "BUG 374778", Continue);
QCOMPARE(m_touch->sequence().at(1)->position(), QPointF(-100, -100));
QCOMPARE(pointMovedSpy.count(), 0);
@ -182,7 +180,6 @@ void TouchInputTest::testMultipleTouchPoints()
QCOMPARE(pointMovedSpy.count(), 1);
QCOMPARE(m_touch->sequence().count(), 2);
QCOMPARE(m_touch->sequence().at(1)->isDown(), true);
QEXPECT_FAIL("decorated", "BUG 374778", Continue);
QCOMPARE(m_touch->sequence().at(1)->position(), QPointF(0, 0));
kwinApp()->platform()->touchUp(1, timestamp++);

View file

@ -102,7 +102,8 @@ void TouchInputRedirection::update(const QPointF &pos)
m_windowGeometryConnection = QMetaObject::Connection();
}
if (t && t->surface()) {
seat->setFocusedTouchSurface(t->surface(), t->pos());
// FIXME: add input transformation API to KWayland::Server::SeatInterface for touch input
seat->setFocusedTouchSurface(t->surface(), -1 * t->inputTransformation().map(t->pos()) + t->pos());
m_windowGeometryConnection = connect(t, &Toplevel::geometryChanged, this,
[this] {
if (m_window.isNull()) {
@ -112,7 +113,8 @@ void TouchInputRedirection::update(const QPointF &pos)
if (m_window.data()->surface() != seat->focusedTouchSurface()) {
return;
}
seat->setFocusedTouchSurfacePosition(m_window.data()->pos());
auto t = m_window.data();
seat->setFocusedTouchSurfacePosition(-1 * t->inputTransformation().map(t->pos()) + t->pos());
}
);
} else {