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.
icc-effect-5.14.5
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();
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());
}

View File

@ -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<EffectsHandlerImpl*>(effects)->isMouseInterception()) {
return nullptr;
}
const UnmanagedList &unmanaged = Workspace::self()->unmanagedList();
foreach (Unmanaged *u, unmanaged) {
if (u->geometry().contains(pos) && acceptsInput(u, pos)) {

View File

@ -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();
}