gboolean focused;
guint serial;
+ guint done_serial;
};
struct _GtkIMContextWaylandClass
}
static void
-text_input_commit_apply (GtkIMContextWaylandGlobal *global, gboolean valid)
+text_input_commit_apply (GtkIMContextWaylandGlobal *global)
{
GtkIMContextWayland *context;
context = GTK_IM_CONTEXT_WAYLAND (global->current);
- if (context->pending_commit && valid)
+ if (context->pending_commit)
g_signal_emit_by_name (global->current, "commit", context->pending_commit);
g_free (context->pending_commit);
context->pending_commit = NULL;
}
static void
-text_input_delete_surrounding_text_apply (GtkIMContextWaylandGlobal *global,
- gboolean valid)
+text_input_delete_surrounding_text_apply (GtkIMContextWaylandGlobal *global)
{
GtkIMContextWayland *context;
gboolean retval;
len = context->pending_surrounding_delete.after_length
+ context->pending_surrounding_delete.before_length;
- if (len > 0 && valid)
+ if (len > 0)
g_signal_emit_by_name (global->current, "delete-surrounding",
-context->pending_surrounding_delete.before_length,
len, &retval);
{
GtkIMContextWaylandGlobal *global = data;
gboolean result;
- gboolean valid;
-
+
+ global->done_serial = serial;
+
if (!global->current)
return;
- valid = serial == global->serial;
- text_input_delete_surrounding_text_apply(global, valid);
- text_input_commit_apply(global, valid);
+ text_input_delete_surrounding_text_apply (global);
+ text_input_commit_apply (global);
g_signal_emit_by_name (global->current, "retrieve-surrounding", &result);
- text_input_preedit_apply(global);
+ text_input_preedit_apply (global);
}
static void
global = gtk_im_context_wayland_get_global (context);
if (global == NULL)
return;
+ if (global->done_serial != global->serial)
+ return;
len = strlen (context->surrounding.text);
cursor = context->surrounding.cursor_idx;
global = gtk_im_context_wayland_get_global (context);
if (global == NULL)
return;
+ if (global->done_serial != global->serial)
+ return;
rect = context->cursor_rect;
gtk_widget_translate_coordinates (context->widget,
global = gtk_im_context_wayland_get_global (context);
if (global == NULL)
return;
+ if (global->done_serial != global->serial)
+ return;
g_object_get (context,
"input-hints", &hints,