Merge branch 'wip/carlosg/shuffle-reset-take2' into 'main'

gtkimcontextwayland: Shuffle full resets after IM changes

Closes #5200

See merge request GNOME/gtk!5050
This commit is contained in:
Matthias Clasen 2022-09-28 01:39:49 +00:00
commit aa9a7a931d
3 changed files with 22 additions and 9 deletions

View File

@ -262,9 +262,14 @@ text_input_delete_surrounding_text_apply (GtkIMContextWaylandGlobal *global)
len = context->pending_surrounding_delete.after_length len = context->pending_surrounding_delete.after_length
+ context->pending_surrounding_delete.before_length; + context->pending_surrounding_delete.before_length;
if (len > 0) if (len > 0)
{
g_signal_emit_by_name (global->current, "delete-surrounding", g_signal_emit_by_name (global->current, "delete-surrounding",
-context->pending_surrounding_delete.before_length, -context->pending_surrounding_delete.before_length,
len, &retval); len, &retval);
notify_im_change (GTK_IM_CONTEXT_WAYLAND (context),
ZWP_TEXT_INPUT_V3_CHANGE_CAUSE_INPUT_METHOD);
}
context->pending_surrounding_delete = defaults; context->pending_surrounding_delete = defaults;
} }
@ -957,6 +962,17 @@ gtk_im_context_wayland_get_surrounding (GtkIMContext *context,
return TRUE; return TRUE;
} }
static void
gtk_im_context_wayland_commit (GtkIMContext *context,
const gchar *str)
{
if (GTK_IM_CONTEXT_CLASS (gtk_im_context_wayland_parent_class)->commit)
GTK_IM_CONTEXT_CLASS (gtk_im_context_wayland_parent_class)->commit (context, str);
notify_im_change (GTK_IM_CONTEXT_WAYLAND (context),
ZWP_TEXT_INPUT_V3_CHANGE_CAUSE_INPUT_METHOD);
}
static void static void
gtk_im_context_wayland_class_init (GtkIMContextWaylandClass *klass) gtk_im_context_wayland_class_init (GtkIMContextWaylandClass *klass)
{ {
@ -975,6 +991,7 @@ gtk_im_context_wayland_class_init (GtkIMContextWaylandClass *klass)
im_context_class->set_use_preedit = gtk_im_context_wayland_set_use_preedit; im_context_class->set_use_preedit = gtk_im_context_wayland_set_use_preedit;
im_context_class->set_surrounding_with_selection = gtk_im_context_wayland_set_surrounding; im_context_class->set_surrounding_with_selection = gtk_im_context_wayland_set_surrounding;
im_context_class->get_surrounding_with_selection = gtk_im_context_wayland_get_surrounding; im_context_class->get_surrounding_with_selection = gtk_im_context_wayland_get_surrounding;
im_context_class->commit = gtk_im_context_wayland_commit;
} }
static void static void

View File

@ -4241,7 +4241,6 @@ gtk_text_commit_cb (GtkIMContext *context,
{ {
gtk_text_enter_text (self, str); gtk_text_enter_text (self, str);
gtk_text_obscure_mouse_cursor (self); gtk_text_obscure_mouse_cursor (self);
gtk_im_context_reset (context);
} }
} }
@ -4302,7 +4301,6 @@ gtk_text_delete_surrounding_cb (GtkIMContext *context,
gtk_editable_delete_text (GTK_EDITABLE (self), gtk_editable_delete_text (GTK_EDITABLE (self),
priv->current_pos + offset, priv->current_pos + offset,
priv->current_pos + offset + n_chars); priv->current_pos + offset + n_chars);
gtk_im_context_reset (context);
} }
return TRUE; return TRUE;

View File

@ -8485,7 +8485,6 @@ gtk_text_view_commit_handler (GtkIMContext *context,
gtk_text_view_commit_text (text_view, str); gtk_text_view_commit_text (text_view, str);
gtk_text_view_reset_blink_time (text_view); gtk_text_view_reset_blink_time (text_view);
gtk_text_view_pend_cursor_blink (text_view); gtk_text_view_pend_cursor_blink (text_view);
gtk_im_context_reset (context);
} }
static void static void
@ -8695,9 +8694,8 @@ gtk_text_view_delete_surrounding_handler (GtkIMContext *context,
gtk_text_iter_forward_chars (&start, offset); gtk_text_iter_forward_chars (&start, offset);
gtk_text_iter_forward_chars (&end, offset + n_chars); gtk_text_iter_forward_chars (&end, offset + n_chars);
if (gtk_text_buffer_delete_interactive (priv->buffer, &start, &end, gtk_text_buffer_delete_interactive (priv->buffer, &start, &end,
priv->editable)) priv->editable);
gtk_im_context_reset (context);
return TRUE; return TRUE;
} }