Add an ignore_enter flag and use it as in the menu code to avoid the

Sat Jun  5 23:07:30 2004  Matthias Clasen  <maclas@gmx.de>

	* 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)
This commit is contained in:
Matthias Clasen 2004-06-06 03:17:45 +00:00 committed by Matthias Clasen
parent e47c0d46b1
commit 1640e34c8c
6 changed files with 86 additions and 4 deletions

View File

@ -1,3 +1,13 @@
Sat Jun 5 23:07:30 2004 Matthias Clasen <maclas@gmx.de>
* 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 <sandmann@daimi.au.dk>
* tests/testmerge.c: Add a checkbox to queue an

View File

@ -1,3 +1,13 @@
Sat Jun 5 23:07:30 2004 Matthias Clasen <maclas@gmx.de>
* 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 <sandmann@daimi.au.dk>
* tests/testmerge.c: Add a checkbox to queue an

View File

@ -1,3 +1,13 @@
Sat Jun 5 23:07:30 2004 Matthias Clasen <maclas@gmx.de>
* 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 <sandmann@daimi.au.dk>
* tests/testmerge.c: Add a checkbox to queue an

View File

@ -1,3 +1,13 @@
Sat Jun 5 23:07:30 2004 Matthias Clasen <maclas@gmx.de>
* 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 <sandmann@daimi.au.dk>
* tests/testmerge.c: Add a checkbox to queue an

View File

@ -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);

View File

@ -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);