diff --git a/src/wayland/seat_interface.cpp b/src/wayland/seat_interface.cpp index 9508ecc222..8125e91520 100644 --- a/src/wayland/seat_interface.cpp +++ b/src/wayland/seat_interface.cpp @@ -916,6 +916,9 @@ void SeatInterface::setFocusedKeyboardSurface(SurfaceInterface *surface) } d->globalKeyboard.focus = SeatInterfacePrivate::Keyboard::Focus(); d->globalKeyboard.focus.surface = surface; + + d->keyboard->setFocusedSurface(surface, serial); + if (d->globalKeyboard.focus.surface) { d->globalKeyboard.focus.destroyConnection = connect(surface, &QObject::destroyed, this, [this]() { d->globalKeyboard.focus = SeatInterfacePrivate::Keyboard::Focus(); @@ -949,8 +952,6 @@ void SeatInterface::setFocusedKeyboardSurface(SurfaceInterface *surface) } } - d->keyboard->setFocusedSurface(surface, serial); - // focused text input surface follows keyboard if (hasKeyboard()) { setFocusedTextInputSurface(surface);