Commit 2209f94b authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

Send enter and modifiers events if wl_keyboard is bound by focused client

We need to send out these events; otherwise the client may have
incorrect state for the new wl_keyboard object.
parent ba1f7733
Pipeline #51337 canceled with stage
......@@ -26,12 +26,25 @@ KeyboardInterfacePrivate::KeyboardInterfacePrivate(SeatInterface *s)
void KeyboardInterfacePrivate::keyboard_bind_resource(Resource *resource)
{
const ClientConnection *focusedClient = focusedSurface ? focusedSurface->client() : nullptr;
if (resource->version() >= WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION) {
send_repeat_info(resource->handle, keyRepeat.charactersPerSecond, keyRepeat.delay);
}
if (!keymap.isNull()) {
send_keymap(resource->handle, keymap_format::keymap_format_xkb_v1, keymap->handle(), keymap->size());
}
if (focusedClient && focusedClient->client() == resource->client()) {
const QVector<quint32> keys = pressedKeys();
const QByteArray keysData = QByteArray::fromRawData(reinterpret_cast<const char *>(keys.data()),
sizeof(quint32) * keys.count());
const quint32 serial = seat->display()->nextSerial();
send_enter(resource->handle, serial, focusedSurface->resource(), keysData);
send_modifiers(resource->handle, serial, modifiers.depressed, modifiers.latched,
modifiers.locked, modifiers.group);
}
}
QList<KeyboardInterfacePrivate::Resource *> KeyboardInterfacePrivate::keyboardsForClient(ClientConnection *client) const
......
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