Commit 3ef4f994 authored by Xuetian Weng's avatar Xuetian Weng
Browse files

Implemnt preedit_styling for text input v2.

parent a711f90a
......@@ -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);
......
......@@ -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.
*
......
......@@ -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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment