[mutter/wip/carlosg/no-null-preedit-repeat] wayland: Avoid repeated NULL preedit string updates
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/no-null-preedit-repeat] wayland: Avoid repeated NULL preedit string updates
- Date: Sat, 30 Apr 2022 11:55:52 +0000 (UTC)
commit 8b0f5746fe5585b154af8ebe2898f880c7635333
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Apr 30 13:51:28 2022 +0200
wayland: Avoid repeated NULL preedit string updates
Simply signal preedit string changes from/to NULL once, in order
to avoid unwanted activity in the client side. We do still need to
send the preedit once each .done event, if there is one, in order
to behave according to the protocol when it matters the most.
src/wayland/meta-wayland-text-input.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/wayland/meta-wayland-text-input.c b/src/wayland/meta-wayland-text-input.c
index 17e0b683e7..cf40f02183 100644
--- a/src/wayland/meta-wayland-text-input.c
+++ b/src/wayland/meta-wayland-text-input.c
@@ -79,6 +79,7 @@ struct _MetaWaylandTextInput
char *string;
uint32_t cursor;
uint32_t anchor;
+ gboolean changed;
} preedit;
guint done_idle_id;
@@ -136,10 +137,15 @@ clutter_input_focus_send_done (ClutterInputFocus *focus)
wl_resource_for_each (resource, &text_input->focus_resource_list)
{
- zwp_text_input_v3_send_preedit_string (resource,
- text_input->preedit.string,
- text_input->preedit.cursor,
- text_input->preedit.anchor);
+ if (text_input->preedit.string || text_input->preedit.changed)
+ {
+ zwp_text_input_v3_send_preedit_string (resource,
+ text_input->preedit.string,
+ text_input->preedit.cursor,
+ text_input->preedit.anchor);
+ text_input->preedit.changed = FALSE;
+ }
+
zwp_text_input_v3_send_done (resource,
lookup_serial (text_input, resource));
}
@@ -260,6 +266,7 @@ meta_wayland_text_input_focus_set_preedit_text (ClutterInputFocus *focus,
text_input->preedit.cursor = pos;
text_input->preedit.anchor = pos;
+ text_input->preedit.changed = TRUE;
meta_wayland_text_input_focus_defer_done (focus);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]