wayland: Don't emit signals if nothing changed
authorMatthias Clasen <mclasen@redhat.com>
Tue, 27 Mar 2018 01:38:28 +0000 (21:38 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 27 Mar 2018 01:38:28 +0000 (21:38 -0400)
We were emitting a preedit-changed even if the preedit text did
not actually change, causing text views to scroll.

gtk/gtkimcontextwayland.c

index af195581c8ca1300de527178f73787673e4f8154..5bb7ecd04d9f6481ba69857ec30b72b852b76a12 100644 (file)
@@ -84,6 +84,9 @@ static GtkIMContextWaylandGlobal *global = NULL;
 static void
 reset_preedit (GtkIMContextWayland *context)
 {
+  if (context->preedit.text == NULL)
+    return;
+
   g_clear_pointer (&context->preedit.text, g_free);
   context->preedit.cursor_idx = 0;
   g_signal_emit_by_name (context, "preedit-changed");