From 09f99df1a30f71f88dcfba3c78fc459419f85ad8 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Mon, 7 Jun 2021 02:45:57 +0200 Subject: [PATCH] inputmethod: Be more assertive towards the input panel visibility If a new input client has taken over, don't override the trackedClient's geometry. Only consider the input geometry of a visible keyboard. --- src/inputmethod.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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) {