diff --git a/ChangeLog b/ChangeLog index 4ffac1967d..0bd49283a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Sat Jun 5 23:07:30 2004 Matthias Clasen + + * gtk/gtkentrycompletion.c: (gtk_entry_completion_init), + (gtk_entry_completion_list_enter_notify), + (gtk_entry_completion_list_motion_notify), + (_gtk_entry_completion_popup), (_gtk_entry_completion_popdown): + * gtk/gtkentryprivate.h: Add an ignore_enter flag and + use it as in the menu code to avoid the initial selection if + the window pops up under the pointer. (Anders Carlsson) + Sat Jun 5 20:05:39 2004 Soeren Sandmann * tests/testmerge.c: Add a checkbox to queue an diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 4ffac1967d..0bd49283a7 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,13 @@ +Sat Jun 5 23:07:30 2004 Matthias Clasen + + * gtk/gtkentrycompletion.c: (gtk_entry_completion_init), + (gtk_entry_completion_list_enter_notify), + (gtk_entry_completion_list_motion_notify), + (_gtk_entry_completion_popup), (_gtk_entry_completion_popdown): + * gtk/gtkentryprivate.h: Add an ignore_enter flag and + use it as in the menu code to avoid the initial selection if + the window pops up under the pointer. (Anders Carlsson) + Sat Jun 5 20:05:39 2004 Soeren Sandmann * tests/testmerge.c: Add a checkbox to queue an diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 4ffac1967d..0bd49283a7 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,13 @@ +Sat Jun 5 23:07:30 2004 Matthias Clasen + + * gtk/gtkentrycompletion.c: (gtk_entry_completion_init), + (gtk_entry_completion_list_enter_notify), + (gtk_entry_completion_list_motion_notify), + (_gtk_entry_completion_popup), (_gtk_entry_completion_popdown): + * gtk/gtkentryprivate.h: Add an ignore_enter flag and + use it as in the menu code to avoid the initial selection if + the window pops up under the pointer. (Anders Carlsson) + Sat Jun 5 20:05:39 2004 Soeren Sandmann * tests/testmerge.c: Add a checkbox to queue an diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 4ffac1967d..0bd49283a7 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,13 @@ +Sat Jun 5 23:07:30 2004 Matthias Clasen + + * gtk/gtkentrycompletion.c: (gtk_entry_completion_init), + (gtk_entry_completion_list_enter_notify), + (gtk_entry_completion_list_motion_notify), + (_gtk_entry_completion_popup), (_gtk_entry_completion_popdown): + * gtk/gtkentryprivate.h: Add an ignore_enter flag and + use it as in the menu code to avoid the initial selection if + the window pops up under the pointer. (Anders Carlsson) + Sat Jun 5 20:05:39 2004 Soeren Sandmann * tests/testmerge.c: Add a checkbox to queue an diff --git a/gtk/gtkentrycompletion.c b/gtk/gtkentrycompletion.c index 4747cb3a81..3d6f15a889 100644 --- a/gtk/gtkentrycompletion.c +++ b/gtk/gtkentrycompletion.c @@ -109,7 +109,12 @@ static gboolean gtk_entry_completion_action_button_press (GtkWidget gpointer user_data); static void gtk_entry_completion_selection_changed (GtkTreeSelection *selection, gpointer data); - +static gboolean gtk_entry_completion_list_enter_notify (GtkWidget *widget, + GdkEventCrossing *event, + gpointer data); +static gboolean gtk_entry_completion_list_motion_notify (GtkWidget *widget, + GdkEventMotion *event, + gpointer data); static void gtk_entry_completion_insert_action (GtkEntryCompletion *completion, gint index, const gchar *string, @@ -292,6 +297,12 @@ gtk_entry_completion_init (GtkEntryCompletion *completion) g_signal_connect (priv->tree_view, "button_press_event", G_CALLBACK (gtk_entry_completion_list_button_press), completion); + g_signal_connect (priv->tree_view, "enter_notify_event", + G_CALLBACK (gtk_entry_completion_list_enter_notify), + completion); + g_signal_connect (priv->tree_view, "motion_notify_event", + G_CALLBACK (gtk_entry_completion_list_motion_notify), + completion); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (priv->tree_view), FALSE); gtk_tree_view_set_hover_selection (GTK_TREE_VIEW (priv->tree_view), TRUE); @@ -324,6 +335,12 @@ gtk_entry_completion_init (GtkEntryCompletion *completion) g_signal_connect (priv->action_view, "button_press_event", G_CALLBACK (gtk_entry_completion_action_button_press), completion); + g_signal_connect (priv->action_view, "enter_notify_event", + G_CALLBACK (gtk_entry_completion_list_enter_notify), + completion); + g_signal_connect (priv->action_view, "motion_notify_event", + G_CALLBACK (gtk_entry_completion_list_motion_notify), + completion); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (priv->action_view), FALSE); gtk_tree_view_set_hover_selection (GTK_TREE_VIEW (priv->action_view), TRUE); @@ -1127,6 +1144,29 @@ get_borders (GtkEntry *entry, } } +static gboolean +gtk_entry_completion_list_enter_notify (GtkWidget *widget, + GdkEventCrossing *event, + gpointer data) +{ + GtkEntryCompletion *completion = GTK_ENTRY_COMPLETION (data); + + return completion->priv->ignore_enter; +} + +static gboolean +gtk_entry_completion_list_motion_notify (GtkWidget *widget, + GdkEventMotion *event, + gpointer data) +{ + GtkEntryCompletion *completion = GTK_ENTRY_COMPLETION (data); + + completion->priv->ignore_enter = FALSE; + + return FALSE; +} + + /* some nasty size requisition */ gboolean _gtk_entry_completion_resize_popup (GtkEntryCompletion *completion) @@ -1227,8 +1267,8 @@ _gtk_entry_completion_popup (GtkEntryCompletion *completion) if (GTK_WIDGET_MAPPED (completion->priv->popup_window)) return; - completion->priv->may_wrap = TRUE; - + completion->priv->ignore_enter = TRUE; + column = gtk_tree_view_get_column (GTK_TREE_VIEW (completion->priv->action_view), 0); renderers = gtk_tree_view_column_get_cell_renderers (column); gtk_widget_ensure_style (completion->priv->tree_view); @@ -1254,6 +1294,8 @@ _gtk_entry_completion_popup (GtkEntryCompletion *completion) void _gtk_entry_completion_popdown (GtkEntryCompletion *completion) { + completion->priv->ignore_enter = FALSE; + gdk_pointer_ungrab (GDK_CURRENT_TIME); gtk_grab_remove (completion->priv->popup_window); diff --git a/gtk/gtkentryprivate.h b/gtk/gtkentryprivate.h index 7816c8784e..aed129e027 100644 --- a/gtk/gtkentryprivate.h +++ b/gtk/gtkentryprivate.h @@ -58,7 +58,7 @@ struct _GtkEntryCompletionPrivate gulong key_press_id; gulong key_release_id; - gboolean may_wrap; + gboolean ignore_enter; }; gboolean _gtk_entry_completion_resize_popup (GtkEntryCompletion *completion);