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.
This commit is contained in:
Aleix Pol 2021-06-07 02:45:57 +02:00 committed by Aleix Pol Gonzalez
parent 6fa96852dc
commit 09f99df1a3

View file

@ -141,8 +141,13 @@ void InputMethod::clientAdded(AbstractClient *_client)
if (!_client->isInputMethod()) {
return;
}
const auto client = dynamic_cast<InputPanelV1Client *>(_client);
if (m_inputClient) {
qCWarning(KWIN_VIRTUALKEYBOARD) << "Replacing input client" << m_inputClient;
disconnect(m_inputClient, nullptr, this, nullptr);
}
const auto client = dynamic_cast<InputPanelV1Client *>(_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) {