[mutter/wip/carlosg/input-focus-anchor: 3/5] clutter: Make ClutterIMEvent able to store preedit anchor position
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/input-focus-anchor: 3/5] clutter: Make ClutterIMEvent able to store preedit anchor position
- Date: Tue, 19 Jul 2022 11:05:08 +0000 (UTC)
commit 190301f66b56874c33d760340693857ace818868
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Jul 18 14:39:01 2022 +0200
clutter: Make ClutterIMEvent able to store preedit anchor position
This is something that is exported through the protocol, but we don't
pass forward. Make the events able to store this anchor so that we
can do that.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2517>
clutter/clutter/clutter-event.h | 1 +
clutter/clutter/clutter-input-method.c | 9 ++++++---
2 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/clutter/clutter/clutter-event.h b/clutter/clutter/clutter-event.h
index 94595542cd..b9a7d27e8c 100644
--- a/clutter/clutter/clutter-event.h
+++ b/clutter/clutter/clutter-event.h
@@ -578,6 +578,7 @@ struct _ClutterIMEvent
char *text;
int32_t offset;
+ int32_t anchor;
uint32_t len;
ClutterPreeditResetMode mode;
};
diff --git a/clutter/clutter/clutter-input-method.c b/clutter/clutter/clutter-input-method.c
index be1a3c99c0..8b5828773c 100644
--- a/clutter/clutter/clutter-input-method.c
+++ b/clutter/clutter/clutter-input-method.c
@@ -282,6 +282,7 @@ clutter_input_method_put_im_event (ClutterInputMethod *im,
ClutterEventType event_type,
const char *text,
int32_t offset,
+ int32_t anchor,
uint32_t len,
ClutterPreeditResetMode mode)
{
@@ -299,6 +300,7 @@ clutter_input_method_put_im_event (ClutterInputMethod *im,
event = clutter_event_new (event_type);
event->im.text = g_strdup (text);
event->im.offset = offset;
+ event->im.anchor = anchor;
event->im.len = len;
event->im.mode = mode;
clutter_event_set_device (event, keyboard);
@@ -317,7 +319,7 @@ clutter_input_method_commit (ClutterInputMethod *im,
{
g_return_if_fail (CLUTTER_IS_INPUT_METHOD (im));
- clutter_input_method_put_im_event (im, CLUTTER_IM_COMMIT, text, 0, 0,
+ clutter_input_method_put_im_event (im, CLUTTER_IM_COMMIT, text, 0, 0, 0,
CLUTTER_PREEDIT_RESET_CLEAR);
}
@@ -328,7 +330,8 @@ clutter_input_method_delete_surrounding (ClutterInputMethod *im,
{
g_return_if_fail (CLUTTER_IS_INPUT_METHOD (im));
- clutter_input_method_put_im_event (im, CLUTTER_IM_DELETE, NULL, offset, len,
+ clutter_input_method_put_im_event (im, CLUTTER_IM_DELETE, NULL,
+ offset, offset, len,
CLUTTER_PREEDIT_RESET_CLEAR);
}
@@ -361,7 +364,7 @@ clutter_input_method_set_preedit_text (ClutterInputMethod *im,
g_return_if_fail (CLUTTER_IS_INPUT_METHOD (im));
clutter_input_method_put_im_event (im, CLUTTER_IM_PREEDIT, preedit,
- cursor, 0, mode);
+ cursor, cursor, 0, mode);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]