inputmethod: Make sure we send a state commit
Detach from the serials that the client send us, since they don't really matter to the input method and track our own. Also issue a commit state whenever we adopt a new input context. This can happen for reasons that don't come from the client, like for example the input method has just been enabled. In practice, this solves an issue that we can easily see with maliit where it would be left in a half-initialised state and would show autocorrection fields on terminal applications when unnecessary and possibly similar problems every now and then.
This commit is contained in:
parent
b31ef46576
commit
184e53e5c2
2 changed files with 3 additions and 6 deletions
|
@ -230,6 +230,7 @@ void InputMethod::textInputInterfaceV2StateUpdated(quint32 serial, KWaylandServe
|
|||
if (!m_enabled) {
|
||||
return;
|
||||
}
|
||||
Q_UNUSED(serial);
|
||||
|
||||
auto t2 = waylandServer()->seat()->textInputV2();
|
||||
auto inputContext = waylandServer()->inputMethod()->context();
|
||||
|
@ -241,19 +242,13 @@ void InputMethod::textInputInterfaceV2StateUpdated(quint32 serial, KWaylandServe
|
|||
}
|
||||
switch (reason) {
|
||||
case KWaylandServer::TextInputV2Interface::UpdateReason::StateChange:
|
||||
inputContext->sendCommitState(serial);
|
||||
break;
|
||||
case KWaylandServer::TextInputV2Interface::UpdateReason::StateEnter:
|
||||
waylandServer()->inputMethod()->sendActivate();
|
||||
inputContext->sendCommitState(serial);
|
||||
break;
|
||||
case KWaylandServer::TextInputV2Interface::UpdateReason::StateFull:
|
||||
adoptInputMethodContext();
|
||||
inputContext->sendCommitState(serial);
|
||||
break;
|
||||
case KWaylandServer::TextInputV2Interface::UpdateReason::StateReset:
|
||||
inputContext->sendReset();
|
||||
inputContext->sendCommitState(serial);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -486,6 +481,7 @@ void InputMethod::adoptInputMethodContext()
|
|||
inputContext->sendSurroundingText(t3->surroundingText(), t3->surroundingTextCursorPosition(), t3->surroundingTextSelectionAnchor());
|
||||
inputContext->sendContentType(t3->contentHints(), t3->contentPurpose());
|
||||
}
|
||||
inputContext->sendCommitState(m_serial++);
|
||||
|
||||
connect(inputContext, &KWaylandServer::InputMethodContextV1Interface::keysym, this, &InputMethod::keysymReceived, Qt::UniqueConnection);
|
||||
connect(inputContext, &KWaylandServer::InputMethodContextV1Interface::commitString, this, &InputMethod::commitString, Qt::UniqueConnection);
|
||||
|
|
|
@ -91,6 +91,7 @@ private:
|
|||
|
||||
bool m_enabled = false;
|
||||
bool m_active = false;
|
||||
quint32 m_serial = 0;
|
||||
QScopedPointer<KStatusNotifierItem> m_sni;
|
||||
QPointer<AbstractClient> m_inputClient;
|
||||
QPointer<AbstractClient> m_trackedClient;
|
||||
|
|
Loading…
Reference in a new issue