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.
This commit is contained in:
Martin Gräßlin 2016-02-25 09:15:41 +01:00
parent 6d495f1dc9
commit ed7bf6e091
3 changed files with 8 additions and 3 deletions

View file

@ -909,7 +909,6 @@ void PointerInputTest::testEffectOverrideCursorImage()
const QImage openHand = p->cursorImage(); const QImage openHand = p->cursorImage();
QVERIFY(!openHand.isNull()); QVERIFY(!openHand.isNull());
QVERIFY(openHand != fallback); QVERIFY(openHand != fallback);
QEXPECT_FAIL("", "Fix me", Continue);
QVERIFY(leftSpy.wait()); QVERIFY(leftSpy.wait());
// let's change to arrow cursor, this should be our fallback // let's change to arrow cursor, this should be our fallback
@ -924,7 +923,6 @@ void PointerInputTest::testEffectOverrideCursorImage()
Cursor::setPos(800, 800); Cursor::setPos(800, 800);
// and end the override, which should switch to fallback // and end the override, which should switch to fallback
effects->stopMouseInterception(effect.data()); effects->stopMouseInterception(effect.data());
QEXPECT_FAIL("", "Fix me", Continue);
QCOMPARE(p->cursorImage(), fallback); QCOMPARE(p->cursorImage(), fallback);
// start mouse interception again // start mouse interception again
@ -938,7 +936,6 @@ void PointerInputTest::testEffectOverrideCursorImage()
// after ending the interception we should get an enter event // after ending the interception we should get an enter event
effects->stopMouseInterception(effect.data()); effects->stopMouseInterception(effect.data());
QEXPECT_FAIL("", "Fix me", Continue);
QVERIFY(enteredSpy.wait()); QVERIFY(enteredSpy.wait());
QVERIFY(p->cursorImage().isNull()); QVERIFY(p->cursorImage().isNull());
} }

View file

@ -1022,6 +1022,10 @@ Toplevel *InputRedirection::findToplevel(const QPoint &pos)
const bool isScreenLocked = waylandServer() && waylandServer()->isScreenLocked(); const bool isScreenLocked = waylandServer() && waylandServer()->isScreenLocked();
// TODO: check whether the unmanaged wants input events at all // TODO: check whether the unmanaged wants input events at all
if (!isScreenLocked) { if (!isScreenLocked) {
// if an effect overrides the cursor we don't have a window to focus
if (effects && static_cast<EffectsHandlerImpl*>(effects)->isMouseInterception()) {
return nullptr;
}
const UnmanagedList &unmanaged = Workspace::self()->unmanagedList(); const UnmanagedList &unmanaged = Workspace::self()->unmanagedList();
foreach (Unmanaged *u, unmanaged) { foreach (Unmanaged *u, unmanaged) {
if (u->geometry().contains(pos) && acceptsInput(u, pos)) { if (u->geometry().contains(pos) && acceptsInput(u, pos)) {

View file

@ -487,6 +487,8 @@ void PointerInputRedirection::setEffectsOverrideCursor(Qt::CursorShape shape)
if (!m_inited) { if (!m_inited) {
return; return;
} }
// current pointer focus window should get a leave event
update();
m_cursor->setEffectsOverrideCursor(shape); m_cursor->setEffectsOverrideCursor(shape);
} }
@ -495,6 +497,8 @@ void PointerInputRedirection::removeEffectsOverrideCursor()
if (!m_inited) { if (!m_inited) {
return; return;
} }
// cursor position might have changed while there was an effect in place
update();
m_cursor->removeEffectsOverrideCursor(); m_cursor->removeEffectsOverrideCursor();
} }