diff --git a/src/wayland/textinput_v2_interface.cpp b/src/wayland/textinput_v2_interface.cpp index 004567ee7b..c5d43f1ae6 100644 --- a/src/wayland/textinput_v2_interface.cpp +++ b/src/wayland/textinput_v2_interface.cpp @@ -180,6 +180,18 @@ void TextInputV2InterfacePrivate::preEdit(const QString &text, const QString &co } } +void TextInputV2InterfacePrivate::preEditStyling(uint32_t index, uint32_t length, uint32_t style) +{ + if (!surface) { + return; + } + + const auto clientResources = textInputsForClient(surface->client()); + for (auto resource : clientResources) { + send_preedit_styling(resource->handle, index, length, style); + } +} + void TextInputV2InterfacePrivate::commitString(const QString &text) { if (!surface) { @@ -444,6 +456,11 @@ void TextInputV2Interface::preEdit(const QString &text, const QString &commit) d->preEdit(text, commit); } +void TextInputV2Interface::preEditStyling(uint32_t index, uint32_t length, uint32_t style) +{ + d->preEditStyling(index, length, style); +} + void TextInputV2Interface::commitString(const QString &text) { d->commitString(text); diff --git a/src/wayland/textinput_v2_interface.h b/src/wayland/textinput_v2_interface.h index f0c3530b22..5481f078b0 100644 --- a/src/wayland/textinput_v2_interface.h +++ b/src/wayland/textinput_v2_interface.h @@ -169,6 +169,17 @@ public: */ void setPreEditCursor(qint32 index); + /** + * Sets the style for a range of text for the composing text (as byte offset). + * + * The Client applies the @p index together with {@link preEdit}. + * @param index The position relative to the start of the composing text + * @param length The length of the style to apply on + * @param style style flag + * @see preEdit + */ + void preEditStyling(uint32_t index, uint32_t length, uint32_t style); + /** * Notify when the text around the current cursor position should be deleted. * diff --git a/src/wayland/textinput_v2_interface_p.h b/src/wayland/textinput_v2_interface_p.h index 1498989e75..f39a549b21 100644 --- a/src/wayland/textinput_v2_interface_p.h +++ b/src/wayland/textinput_v2_interface_p.h @@ -37,6 +37,7 @@ public: void sendEnter(SurfaceInterface *surface, quint32 serial); void sendLeave(quint32 serial, SurfaceInterface *surface); void preEdit(const QString &text, const QString &commit); + void preEditStyling(uint32_t index, uint32_t length, uint32_t style); void commitString(const QString &text); void deleteSurroundingText(quint32 beforeLength, quint32 afterLength); void setTextDirection(Qt::LayoutDirection direction);