Reset stored window before setting it as focused pointer surface on seat

Updating the focused pointer surface results in the cursor to change.
The CursorImage needs the current focused window to evaluate which cursor
to use, though. Thus we need to make sure that the window reflects the
current state before updating the seat.
This commit is contained in:
Martin Gräßlin 2016-02-24 17:28:27 +01:00
parent d15e94f326
commit b6677ca04e
2 changed files with 2 additions and 7 deletions

View file

@ -811,7 +811,6 @@ void PointerInputTest::testCursorImage()
// move cursor to center of window, this should first set a null pointer
Cursor::setPos(window->geometry().center());
QCOMPARE(p->window().data(), window);
QEXPECT_FAIL("", "Fix me", Continue);
QVERIFY(p->cursorImage().isNull());
QVERIFY(enteredSpy.wait());
@ -854,7 +853,6 @@ void PointerInputTest::testCursorImage()
// move cursor somewhere else, should reset to fallback cursor
Cursor::setPos(window->geometry().bottomLeft() + QPoint(20, 20));
QVERIFY(p->window().isNull());
QEXPECT_FAIL("", "Fix me", Continue);
QVERIFY(!p->cursorImage().isNull());
}

View file

@ -256,6 +256,7 @@ void PointerInputRedirection::update()
}
}
if (t && t->surface()) {
m_window = QPointer<Toplevel>(t);
seat->setFocusedPointerSurface(t->surface(), t->inputTransformation());
m_windowGeometryConnection = connect(t, &Toplevel::geometryChanged, this,
[this] {
@ -275,14 +276,10 @@ void PointerInputRedirection::update()
}
);
} else {
m_window.clear();
seat->setFocusedPointerSurface(nullptr);
t = nullptr;
}
if (!t) {
m_window.clear();
return;
}
m_window = QPointer<Toplevel>(t);
}
void PointerInputRedirection::updateInternalWindow()