diff --git a/src/wayland/keyboard_interface.cpp b/src/wayland/keyboard_interface.cpp index ad1d8e4261..48cb12a163 100644 --- a/src/wayland/keyboard_interface.cpp +++ b/src/wayland/keyboard_interface.cpp @@ -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 keys = pressedKeys(); + const QByteArray keysData = QByteArray::fromRawData(reinterpret_cast(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::keyboardsForClient(ClientConnection *client) const