Add preedit styling support for text-input-v2.

This commit is contained in:
Weng Xuetian 2021-12-20 03:33:41 -08:00 committed by Xuetian Weng
parent a18ccb06e6
commit 6d6ce2981e
2 changed files with 9 additions and 0 deletions

View file

@ -457,6 +457,13 @@ void InputMethod::setPreeditCursor(qint32 index)
}
}
void InputMethod::setPreeditStyling(quint32 index, quint32 length, quint32 style)
{
auto t2 = waylandServer()->seat()->textInputV2();
if (t2 && t2->isEnabled()) {
t2->preEditStyling(index, length, style);
}
}
void InputMethod::setPreeditString(uint32_t serial, const QString &text, const QString &commit)
{
@ -524,6 +531,7 @@ void InputMethod::adoptInputMethodContext()
connect(inputContext, &KWaylandServer::InputMethodContextV1Interface::commitString, this, &InputMethod::commitString, Qt::UniqueConnection);
connect(inputContext, &KWaylandServer::InputMethodContextV1Interface::deleteSurroundingText, this, &InputMethod::deleteSurroundingText, Qt::UniqueConnection);
connect(inputContext, &KWaylandServer::InputMethodContextV1Interface::cursorPosition, this, &InputMethod::setCursorPosition, Qt::UniqueConnection);
connect(inputContext, &KWaylandServer::InputMethodContextV1Interface::preeditStyling, this, &InputMethod::setPreeditStyling, Qt::UniqueConnection);
connect(inputContext, &KWaylandServer::InputMethodContextV1Interface::preeditString, this, &InputMethod::setPreeditString, Qt::UniqueConnection);
connect(inputContext, &KWaylandServer::InputMethodContextV1Interface::preeditCursor, this, &InputMethod::setPreeditCursor, Qt::UniqueConnection);
connect(inputContext, &KWaylandServer::InputMethodContextV1Interface::keyboardGrabRequested, this, &InputMethod::installKeyboardGrab, Qt::UniqueConnection);

View file

@ -77,6 +77,7 @@ private Q_SLOTS:
// inputcontext slots
void setPreeditString(uint32_t serial, const QString &text, const QString &commit);
void setPreeditStyling(quint32 index, quint32 length, quint32 style);
void setPreeditCursor(qint32 index);
void key(quint32 serial, quint32 time, quint32 key, bool pressed);
void modifiers(quint32 serial, quint32 mods_depressed, quint32 mods_latched, quint32 mods_locked, quint32 group);