Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
KWin
Commits
3ef4f994
Commit
3ef4f994
authored
Dec 19, 2021
by
Xuetian Weng
Browse files
Implemnt preedit_styling for text input v2.
parent
a711f90a
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/wayland/textinput_v2_interface.cpp
View file @
3ef4f994
...
...
@@ -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
);
...
...
src/wayland/textinput_v2_interface.h
View file @
3ef4f994
...
...
@@ -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.
*
...
...
src/wayland/textinput_v2_interface_p.h
View file @
3ef4f994
...
...
@@ -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
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment