textInputV3: Prevent recursive update calls

If a 'done' which the compositor sends doesn't make any
update in the client side, an additional event and
updates will be skipped.

Fixes: QTBUG-126275
Pick-to: 6.8
Change-Id: I86bebb3cc645f46ec2bfc6ef587ff86b76d44c9e
Reviewed-by: David Edmundson <davidedmundson@kde.org>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
Inho Lee 2024-10-03 09:51:03 +02:00
parent 8784a01787
commit 62f4289cde
2 changed files with 13 additions and 0 deletions

View File

@ -129,6 +129,14 @@ void QWaylandTextInputv3::zwp_text_input_v3_done(uint32_t serial)
return;
}
if ((m_pendingPreeditString == m_currentPreeditString)
&& (m_pendingCommitString.isEmpty() && m_pendingDeleteBeforeText == 0
&& m_pendingDeleteAfterText == 0)) {
// Current done doesn't need additional updates
m_pendingPreeditString.clear();
return;
}
qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << "PREEDIT" << m_pendingPreeditString.text << m_pendingPreeditString.cursorBegin;
QList<QInputMethodEvent::Attribute> attributes;

View File

@ -74,6 +74,11 @@ private:
cursorBegin = 0;
cursorEnd = 0;
}
friend bool operator==(const PreeditInfo& lhs, const PreeditInfo& rhs) {
return (lhs.text == rhs.text)
&& (lhs.cursorBegin == rhs.cursorBegin)
&& (lhs.cursorEnd == rhs.cursorEnd);
}
};
PreeditInfo m_pendingPreeditString;