Fix interaction of GtkEntryCompletion with input methods. (#354495, Diego

2006-10-03  Matthias Clasen  <mclasen@redhat.com>

        Fix interaction of GtkEntryCompletion with input
        methods.  (#354495, Diego Escalante Urrelo)

        * gtk/gtkentry.c (gtk_entry_completion_key_press): Only reset
        the im context if we actually handle the key event.

        * gtk/gtkentrycompletion.c: Also propagate key release events
        to the entry.
This commit is contained in:
Matthias Clasen 2006-10-04 03:26:34 +00:00 committed by Matthias Clasen
parent 7e480bb4b8
commit b46442a5a3
3 changed files with 21 additions and 5 deletions

View File

@ -1,5 +1,15 @@
2006-10-03 Matthias Clasen <mclasen@redhat.com> 2006-10-03 Matthias Clasen <mclasen@redhat.com>
Fix interaction of GtkEntryCompletion with input
methods. (#354495, Diego Escalante Urrelo)
* gtk/gtkentry.c (gtk_entry_completion_key_press): Only reset
the im context if we actually handle the key event.
* gtk/gtkentrycompletion.c: Also propagate key release events
to the entry.
2006-10-03 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkprintsettings.c (gtk_print_settings_get_duplex): * gtk/gtkprintsettings.c (gtk_print_settings_get_duplex):
Fix a typo. (#359052, Ghee Teo) Fix a typo. (#359052, Ghee Teo)

View File

@ -5451,8 +5451,6 @@ gtk_entry_completion_key_press (GtkWidget *widget,
if (!GTK_WIDGET_MAPPED (completion->priv->popup_window)) if (!GTK_WIDGET_MAPPED (completion->priv->popup_window))
return FALSE; return FALSE;
_gtk_entry_reset_im_context (GTK_ENTRY (widget));
matches = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (completion->priv->filter_model), NULL); matches = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (completion->priv->filter_model), NULL);
if (completion->priv->actions) if (completion->priv->actions)
@ -5545,6 +5543,7 @@ gtk_entry_completion_key_press (GtkWidget *widget,
} }
else if (event->keyval == GDK_Escape) else if (event->keyval == GDK_Escape)
{ {
_gtk_entry_reset_im_context (GTK_ENTRY (widget));
_gtk_entry_completion_popdown (completion); _gtk_entry_completion_popdown (completion);
return TRUE; return TRUE;
@ -5556,6 +5555,7 @@ gtk_entry_completion_key_press (GtkWidget *widget,
GtkDirectionType dir = event->keyval == GDK_ISO_Left_Tab ? GtkDirectionType dir = event->keyval == GDK_ISO_Left_Tab ?
GTK_DIR_TAB_BACKWARD : GTK_DIR_TAB_FORWARD; GTK_DIR_TAB_BACKWARD : GTK_DIR_TAB_FORWARD;
_gtk_entry_reset_im_context (GTK_ENTRY (widget));
_gtk_entry_completion_popdown (completion); _gtk_entry_completion_popdown (completion);
gtk_widget_child_focus (gtk_widget_get_toplevel (widget), dir); gtk_widget_child_focus (gtk_widget_get_toplevel (widget), dir);
@ -5566,6 +5566,7 @@ gtk_entry_completion_key_press (GtkWidget *widget,
event->keyval == GDK_KP_Enter || event->keyval == GDK_KP_Enter ||
event->keyval == GDK_Return) event->keyval == GDK_Return)
{ {
_gtk_entry_reset_im_context (GTK_ENTRY (widget));
_gtk_entry_completion_popdown (completion); _gtk_entry_completion_popdown (completion);
if (completion->priv->current_selected < matches) if (completion->priv->current_selected < matches)
@ -5608,6 +5609,8 @@ gtk_entry_completion_key_press (GtkWidget *widget,
{ {
GtkTreePath *path; GtkTreePath *path;
_gtk_entry_reset_im_context (GTK_ENTRY (widget));
path = gtk_tree_path_new_from_indices (completion->priv->current_selected - matches, -1); path = gtk_tree_path_new_from_indices (completion->priv->current_selected - matches, -1);
g_signal_emit_by_name (completion, "action_activated", g_signal_emit_by_name (completion, "action_activated",

View File

@ -101,7 +101,7 @@ static void gtk_entry_completion_reorder (GtkCellLayout
static gboolean gtk_entry_completion_visible_func (GtkTreeModel *model, static gboolean gtk_entry_completion_visible_func (GtkTreeModel *model,
GtkTreeIter *iter, GtkTreeIter *iter,
gpointer data); gpointer data);
static gboolean gtk_entry_completion_popup_key_press (GtkWidget *widget, static gboolean gtk_entry_completion_popup_key_event (GtkWidget *widget,
GdkEventKey *event, GdkEventKey *event,
gpointer user_data); gpointer user_data);
static gboolean gtk_entry_completion_popup_button_press (GtkWidget *widget, static gboolean gtk_entry_completion_popup_button_press (GtkWidget *widget,
@ -436,7 +436,10 @@ gtk_entry_completion_init (GtkEntryCompletion *completion)
priv->popup_window = gtk_window_new (GTK_WINDOW_POPUP); priv->popup_window = gtk_window_new (GTK_WINDOW_POPUP);
gtk_window_set_resizable (GTK_WINDOW (priv->popup_window), FALSE); gtk_window_set_resizable (GTK_WINDOW (priv->popup_window), FALSE);
g_signal_connect (priv->popup_window, "key_press_event", g_signal_connect (priv->popup_window, "key_press_event",
G_CALLBACK (gtk_entry_completion_popup_key_press), G_CALLBACK (gtk_entry_completion_popup_key_event),
completion);
g_signal_connect (priv->popup_window, "key_release_event",
G_CALLBACK (gtk_entry_completion_popup_key_event),
completion); completion);
g_signal_connect (priv->popup_window, "button_press_event", g_signal_connect (priv->popup_window, "button_press_event",
G_CALLBACK (gtk_entry_completion_popup_button_press), G_CALLBACK (gtk_entry_completion_popup_button_press),
@ -749,7 +752,7 @@ gtk_entry_completion_visible_func (GtkTreeModel *model,
} }
static gboolean static gboolean
gtk_entry_completion_popup_key_press (GtkWidget *widget, gtk_entry_completion_popup_key_event (GtkWidget *widget,
GdkEventKey *event, GdkEventKey *event,
gpointer user_data) gpointer user_data)
{ {