summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/input/imwayland.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/modules/input/imwayland.c b/modules/input/imwayland.c
index 91d27ca407..9b738208d9 100644
--- a/modules/input/imwayland.c
+++ b/modules/input/imwayland.c
@@ -876,6 +876,13 @@ gtk_im_context_wayland_set_surrounding (GtkIMContext *context,
context_wayland = GTK_IM_CONTEXT_WAYLAND (context);
+ if (context_wayland->surrounding.text && text &&
+ (len < 0 || len == strlen (context_wayland->surrounding.text)) &&
+ strncmp (context_wayland->surrounding.text, text, len) == 0 &&
+ context_wayland->surrounding.cursor_idx == cursor_index &&
+ context_wayland->surrounding.anchor_idx == cursor_index)
+ return;
+
g_free (context_wayland->surrounding.text);
context_wayland->surrounding.text = g_strndup (text, len);
context_wayland->surrounding.cursor_idx = cursor_index;
@@ -883,11 +890,7 @@ gtk_im_context_wayland_set_surrounding (GtkIMContext *context,
context_wayland->surrounding.anchor_idx = cursor_index;
notify_surrounding_text (context_wayland);
- /* State changes coming from reset don't have any other opportunity to get
- * committed. */
- if (context_wayland->surrounding_change !=
- ZWP_TEXT_INPUT_V3_CHANGE_CAUSE_INPUT_METHOD)
- commit_state (context_wayland);
+ commit_state (context_wayland);
}
static gboolean