Honor input mask set on internal windows

Summary:
This ensures that QWindow::setMask works for KWin internal windows.
Without KWin sends all pointer events to the QWindow, even if the
mask says it shouldn't get events.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1509
This commit is contained in:
Martin Gräßlin 2016-04-29 15:08:22 +02:00
parent 87e5369aed
commit d19690ce98
2 changed files with 15 additions and 0 deletions

View file

@ -191,6 +191,16 @@ void InternalWindowTest::testEnterLeave()
kwinApp()->platform()->pointerMotion(QPoint(101, 50), timestamp++);
QTRY_COMPARE(leaveSpy.count(), 1);
// set a mask on the window
win.setMask(QRegion(10, 20, 30, 40));
// outside the mask we should not get an enter
kwinApp()->platform()->pointerMotion(QPoint(5, 5), timestamp++);
QVERIFY(!enterSpy.wait(100));
QCOMPARE(enterSpy.count(), 1);
// inside the mask we should still get an enter
kwinApp()->platform()->pointerMotion(QPoint(25, 27), timestamp++);
QTRY_COMPARE(enterSpy.count(), 2);
}
void InternalWindowTest::testPointerPressRelease()

View file

@ -314,6 +314,11 @@ void PointerInputRedirection::updateInternalWindow()
continue;
}
if (w->geometry().contains(m_pos.toPoint())) {
// check input mask
const QRegion mask = w->mask().translated(w->geometry().topLeft());
if (!mask.isEmpty() && !mask.contains(m_pos.toPoint())) {
continue;
}
m_internalWindow = QPointer<QWindow>(w);
found = true;
break;