diff --git a/src/inputmethod.cpp b/src/inputmethod.cpp index e2c3494f13..d1bb285aa2 100644 --- a/src/inputmethod.cpp +++ b/src/inputmethod.cpp @@ -141,8 +141,13 @@ void InputMethod::clientAdded(AbstractClient *_client) if (!_client->isInputMethod()) { return; } - const auto client = dynamic_cast(_client); + if (m_inputClient) { + qCWarning(KWIN_VIRTUALKEYBOARD) << "Replacing input client" << m_inputClient; + disconnect(m_inputClient, nullptr, this, nullptr); + } + + const auto client = dynamic_cast(_client); m_inputClient = client; connect(client->surface(), &SurfaceInterface::inputChanged, this, &InputMethod::updateInputPanelState); connect(client, &QObject::destroyed, this, [this] { @@ -545,7 +550,7 @@ void InputMethod::updateInputPanelState() QRect overlap = QRect(0, 0, 0, 0); if (m_trackedClient) { - const bool bottomKeyboard = m_inputClient && m_inputClient->mode() != InputPanelV1Client::Overlay; + const bool bottomKeyboard = m_inputClient && m_inputClient->mode() != InputPanelV1Client::Overlay && m_inputClient->isShown(false); m_trackedClient->setVirtualKeyboardGeometry(bottomKeyboard ? m_inputClient->inputGeometry() : QRect()); if (m_inputClient) {