Commit 03fc51ef authored by Andrey Butirsky's avatar Andrey Butirsky Committed by David Edmundson
Browse files

keyboard_interface: Always update modifiers cache

We send modifiers to the active client when they change, and when we
focus an existing client we send the cached state.

For this reason it's important we always update our internal store of
modifiers regardless of whether a surface is currently active.

Unit test is adopted accordingly.

BUG: 429930
parent 09e079b7
......@@ -1489,6 +1489,9 @@ void TestWaylandSeat::testKeyboard()
// update modifiers before any surface focused
m_seatInterface->keyboard()->updateModifiers(4, 3, 2, 1);
// create the surface
QSignalSpy surfaceCreatedSpy(m_compositorInterface, SIGNAL(surfaceCreated(KWaylandServer::SurfaceInterface*)));
......@@ -1552,10 +1555,10 @@ void TestWaylandSeat::testKeyboard()
// we get the modifiers sent after the enter
QCOMPARE(modifierSpy.count(), 1);
QCOMPARE(modifierSpy.first().at(0).value<quint32>(), quint32(0));
QCOMPARE(modifierSpy.first().at(1).value<quint32>(), quint32(0));
QCOMPARE(modifierSpy.first().at(2).value<quint32>(), quint32(0));
QCOMPARE(modifierSpy.first().at(3).value<quint32>(), quint32(0));
QCOMPARE(modifierSpy.first().at(0).value<quint32>(), quint32(4));
QCOMPARE(modifierSpy.first().at(1).value<quint32>(), quint32(3));
QCOMPARE(modifierSpy.first().at(2).value<quint32>(), quint32(2));
QCOMPARE(modifierSpy.first().at(3).value<quint32>(), quint32(1));
QCOMPARE(enteredSpy.count(), 1);
// TODO: get through API
QCOMPARE(enteredSpy.first().first().value<quint32>(), m_display->serial() - 1);
......@@ -220,9 +220,6 @@ void KeyboardInterface::keyReleased(quint32 key)
void KeyboardInterface::updateModifiers(quint32 depressed, quint32 latched, quint32 locked, quint32 group)
if (!d->focusedSurface) {
bool changed = false;
#define UPDATE( value ) \
if (d->modifiers.value != value) { \
......@@ -236,6 +233,11 @@ void KeyboardInterface::updateModifiers(quint32 depressed, quint32 latched, quin
if (!changed) {
if (!d->focusedSurface) {
d->modifiers.serial = d->seat->d_func()->nextSerial();
d->sendModifiers(depressed, latched, locked, group, d->modifiers.serial);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment