From ed7bf6e0910d05e0141ab282209ed66b91b951b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 25 Feb 2016 09:15:41 +0100 Subject: [PATCH] Send leave/enter pointer event when starting/stoping effect mouse interception When starting effect mouse interception the current focused window and or decoration should get a leave event. Similar when the effect mouse interception ends the current pointer position needs to be evaluated and a pointer enter be sent if needed. --- autotests/wayland/pointer_input.cpp | 3 --- input.cpp | 4 ++++ pointer_input.cpp | 4 ++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/autotests/wayland/pointer_input.cpp b/autotests/wayland/pointer_input.cpp index 6e54b70b14..982d575d89 100644 --- a/autotests/wayland/pointer_input.cpp +++ b/autotests/wayland/pointer_input.cpp @@ -909,7 +909,6 @@ void PointerInputTest::testEffectOverrideCursorImage() const QImage openHand = p->cursorImage(); QVERIFY(!openHand.isNull()); QVERIFY(openHand != fallback); - QEXPECT_FAIL("", "Fix me", Continue); QVERIFY(leftSpy.wait()); // let's change to arrow cursor, this should be our fallback @@ -924,7 +923,6 @@ void PointerInputTest::testEffectOverrideCursorImage() Cursor::setPos(800, 800); // and end the override, which should switch to fallback effects->stopMouseInterception(effect.data()); - QEXPECT_FAIL("", "Fix me", Continue); QCOMPARE(p->cursorImage(), fallback); // start mouse interception again @@ -938,7 +936,6 @@ void PointerInputTest::testEffectOverrideCursorImage() // after ending the interception we should get an enter event effects->stopMouseInterception(effect.data()); - QEXPECT_FAIL("", "Fix me", Continue); QVERIFY(enteredSpy.wait()); QVERIFY(p->cursorImage().isNull()); } diff --git a/input.cpp b/input.cpp index 2b9598225e..1118fda195 100644 --- a/input.cpp +++ b/input.cpp @@ -1022,6 +1022,10 @@ Toplevel *InputRedirection::findToplevel(const QPoint &pos) const bool isScreenLocked = waylandServer() && waylandServer()->isScreenLocked(); // TODO: check whether the unmanaged wants input events at all if (!isScreenLocked) { + // if an effect overrides the cursor we don't have a window to focus + if (effects && static_cast(effects)->isMouseInterception()) { + return nullptr; + } const UnmanagedList &unmanaged = Workspace::self()->unmanagedList(); foreach (Unmanaged *u, unmanaged) { if (u->geometry().contains(pos) && acceptsInput(u, pos)) { diff --git a/pointer_input.cpp b/pointer_input.cpp index 729df1ec01..ef2d8145ed 100644 --- a/pointer_input.cpp +++ b/pointer_input.cpp @@ -487,6 +487,8 @@ void PointerInputRedirection::setEffectsOverrideCursor(Qt::CursorShape shape) if (!m_inited) { return; } + // current pointer focus window should get a leave event + update(); m_cursor->setEffectsOverrideCursor(shape); } @@ -495,6 +497,8 @@ void PointerInputRedirection::removeEffectsOverrideCursor() if (!m_inited) { return; } + // cursor position might have changed while there was an effect in place + update(); m_cursor->removeEffectsOverrideCursor(); }