diff --git a/autotests/wayland/internal_window.cpp b/autotests/wayland/internal_window.cpp --- a/autotests/wayland/internal_window.cpp +++ b/autotests/wayland/internal_window.cpp @@ -191,6 +191,16 @@ 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() diff --git a/pointer_input.cpp b/pointer_input.cpp --- a/pointer_input.cpp +++ b/pointer_input.cpp @@ -314,6 +314,11 @@ 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(w); found = true; break;