Don't unnecessarily reset the im context when deleting the selection.

2006-09-01  Matthias Clasen  <mclasen@redhat.com>
        * gtk/gtkentry.c: Don't unnecessarily reset the im context
        when deleting the selection.  (#353803, Alex Larsson)
This commit is contained in:
Matthias Clasen 2006-09-01 14:44:06 +00:00 committed by Matthias Clasen
parent 186bc16e1b
commit c2495e2d62
2 changed files with 17 additions and 13 deletions

View File

@ -1,3 +1,8 @@
2006-09-01 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkentry.c: Don't unnecessarily reset the im context
when deleting the selection. (#353803, Alex Larsson)
2006-09-01 Abel Cheung <abel@oaka.org> 2006-09-01 Abel Cheung <abel@oaka.org>
* configure.in: Added 'ang' 'dz' to ALL_LINGUAS. * configure.in: Added 'ang' 'dz' to ALL_LINGUAS.

View File

@ -2183,29 +2183,22 @@ gtk_entry_get_chars (GtkEditable *editable,
} }
static void static void
gtk_entry_set_position_internal (GtkEntry *entry, gtk_entry_real_set_position (GtkEditable *editable,
gint position, gint position)
gboolean reset_im)
{ {
GtkEntry *entry = GTK_ENTRY (editable);
if (position < 0 || position > entry->text_length) if (position < 0 || position > entry->text_length)
position = entry->text_length; position = entry->text_length;
if (position != entry->current_pos || if (position != entry->current_pos ||
position != entry->selection_bound) position != entry->selection_bound)
{ {
if (reset_im) _gtk_entry_reset_im_context (entry);
_gtk_entry_reset_im_context (entry);
gtk_entry_set_positions (entry, position, position); gtk_entry_set_positions (entry, position, position);
} }
} }
static void
gtk_entry_real_set_position (GtkEditable *editable,
gint position)
{
gtk_entry_set_position_internal (GTK_ENTRY (editable), position, TRUE);
}
static gint static gint
gtk_entry_get_position (GtkEditable *editable) gtk_entry_get_position (GtkEditable *editable)
{ {
@ -2926,6 +2919,10 @@ gtk_entry_enter_text (GtkEntry *entry,
{ {
GtkEditable *editable = GTK_EDITABLE (entry); GtkEditable *editable = GTK_EDITABLE (entry);
gint tmp_pos; gint tmp_pos;
gboolean old_need_im_reset;
old_need_im_reset = entry->need_im_reset;
entry->need_im_reset = FALSE;
if (gtk_editable_get_selection_bounds (editable, NULL, NULL)) if (gtk_editable_get_selection_bounds (editable, NULL, NULL))
gtk_editable_delete_selection (editable); gtk_editable_delete_selection (editable);
@ -2937,7 +2934,9 @@ gtk_entry_enter_text (GtkEntry *entry,
tmp_pos = entry->current_pos; tmp_pos = entry->current_pos;
gtk_editable_insert_text (editable, str, strlen (str), &tmp_pos); gtk_editable_insert_text (editable, str, strlen (str), &tmp_pos);
gtk_entry_set_position_internal (entry, tmp_pos, FALSE); gtk_editable_set_position (editable, tmp_pos);
entry->need_im_reset = old_need_im_reset;
} }
/* All changes to entry->current_pos and entry->selection_bound /* All changes to entry->current_pos and entry->selection_bound