diff --git a/autotests/wayland/internal_window.cpp b/autotests/wayland/internal_window.cpp index f252b9a580..4085f8a675 100644 --- a/autotests/wayland/internal_window.cpp +++ b/autotests/wayland/internal_window.cpp @@ -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() diff --git a/pointer_input.cpp b/pointer_input.cpp index 1c5b92eb37..b92ce3110f 100644 --- a/pointer_input.cpp +++ b/pointer_input.cpp @@ -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(w); found = true; break;