Get event timestamp from SeatInterface in KeyboardInterface
This commit is contained in:
parent
c6281ac64e
commit
d7a9be72ea
4 changed files with 12 additions and 19 deletions
|
@ -529,11 +529,11 @@ void TestWaylandSeat::testKeyboard()
|
|||
wl_display_flush(m_connection->display());
|
||||
QTest::qWait(100);
|
||||
|
||||
serverKeyboard->updateTimestamp(1);
|
||||
m_seatInterface->setTimestamp(1);
|
||||
serverKeyboard->keyPressed(KEY_K);
|
||||
serverKeyboard->updateTimestamp(2);
|
||||
m_seatInterface->setTimestamp(2);
|
||||
serverKeyboard->keyPressed(KEY_D);
|
||||
serverKeyboard->updateTimestamp(3);
|
||||
m_seatInterface->setTimestamp(3);
|
||||
serverKeyboard->keyPressed(KEY_E);
|
||||
|
||||
QSignalSpy modifierSpy(keyboard, SIGNAL(modifiersChanged(quint32,quint32,quint32,quint32)));
|
||||
|
@ -554,19 +554,19 @@ void TestWaylandSeat::testKeyboard()
|
|||
QSignalSpy keyChangedSpy(keyboard, SIGNAL(keyChanged(quint32,KWayland::Client::Keyboard::KeyState,quint32)));
|
||||
QVERIFY(keyChangedSpy.isValid());
|
||||
|
||||
serverKeyboard->updateTimestamp(4);
|
||||
m_seatInterface->setTimestamp(4);
|
||||
serverKeyboard->keyReleased(KEY_E);
|
||||
QVERIFY(keyChangedSpy.wait());
|
||||
serverKeyboard->updateTimestamp(5);
|
||||
m_seatInterface->setTimestamp(5);
|
||||
serverKeyboard->keyReleased(KEY_D);
|
||||
QVERIFY(keyChangedSpy.wait());
|
||||
serverKeyboard->updateTimestamp(6);
|
||||
m_seatInterface->setTimestamp(6);
|
||||
serverKeyboard->keyReleased(KEY_K);
|
||||
QVERIFY(keyChangedSpy.wait());
|
||||
serverKeyboard->updateTimestamp(7);
|
||||
m_seatInterface->setTimestamp(7);
|
||||
serverKeyboard->keyPressed(KEY_F1);
|
||||
QVERIFY(keyChangedSpy.wait());
|
||||
serverKeyboard->updateTimestamp(8);
|
||||
m_seatInterface->setTimestamp(8);
|
||||
serverKeyboard->keyReleased(KEY_F1);
|
||||
QVERIFY(keyChangedSpy.wait());
|
||||
|
||||
|
|
|
@ -76,7 +76,6 @@ public:
|
|||
};
|
||||
FocusedSurface focusedSurface;
|
||||
QHash<quint32, KeyState> keyStates;
|
||||
quint32 eventTime = 0;
|
||||
QMetaObject::Connection destroyConnection;
|
||||
|
||||
private:
|
||||
|
@ -246,7 +245,7 @@ void KeyboardInterface::keyPressed(quint32 key)
|
|||
{
|
||||
d->updateKey(key, Private::KeyState::Pressed);
|
||||
if (d->focusedSurface.surface && d->focusedSurface.keyboard) {
|
||||
wl_keyboard_send_key(d->focusedSurface.keyboard, d->seat->display()->nextSerial(), d->eventTime, key, WL_KEYBOARD_KEY_STATE_PRESSED);
|
||||
wl_keyboard_send_key(d->focusedSurface.keyboard, d->seat->display()->nextSerial(), d->seat->timestamp(), key, WL_KEYBOARD_KEY_STATE_PRESSED);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -254,7 +253,7 @@ void KeyboardInterface::keyReleased(quint32 key)
|
|||
{
|
||||
d->updateKey(key, Private::KeyState::Released);
|
||||
if (d->focusedSurface.surface && d->focusedSurface.keyboard) {
|
||||
wl_keyboard_send_key(d->focusedSurface.keyboard, d->seat->display()->nextSerial(), d->eventTime, key, WL_KEYBOARD_KEY_STATE_RELEASED);
|
||||
wl_keyboard_send_key(d->focusedSurface.keyboard, d->seat->display()->nextSerial(), d->seat->timestamp(), key, WL_KEYBOARD_KEY_STATE_RELEASED);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -268,11 +267,6 @@ void KeyboardInterface::Private::updateKey(quint32 key, KeyState state)
|
|||
it.value() = state;
|
||||
}
|
||||
|
||||
void KeyboardInterface::updateTimestamp(quint32 time)
|
||||
{
|
||||
d->eventTime = time;
|
||||
}
|
||||
|
||||
void KeyboardInterface::updateModifiers(quint32 depressed, quint32 latched, quint32 locked, quint32 group)
|
||||
{
|
||||
d->modifiers.depressed = depressed;
|
||||
|
|
|
@ -44,7 +44,6 @@ public:
|
|||
|
||||
void createInterfae(wl_client *client, wl_resource *parentResource, uint32_t id);
|
||||
|
||||
void updateTimestamp(quint32 time);
|
||||
void setKeymap(int fd, quint32 size);
|
||||
void keyPressed(quint32 key);
|
||||
void keyReleased(quint32 key);
|
||||
|
|
|
@ -115,7 +115,7 @@ void CompositorWindow::keyPressEvent(QKeyEvent *event)
|
|||
keyboard->setFocusedSurface(m_stackingOrder.last()->surface());
|
||||
}
|
||||
}
|
||||
keyboard->updateTimestamp(event->timestamp());
|
||||
m_seat->setTimestamp(event->timestamp());
|
||||
keyboard->keyPressed(event->nativeScanCode() - 8);
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ void CompositorWindow::keyReleaseEvent(QKeyEvent *event)
|
|||
return;
|
||||
}
|
||||
const auto keyboard = m_seat->keyboard();
|
||||
keyboard->updateTimestamp(event->timestamp());
|
||||
m_seat->setTimestamp(event->timestamp());
|
||||
keyboard->keyReleased(event->nativeScanCode() - 8);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue