entry completion: Drop another ::button-press-event handler

This one will be replaced by a generic ::event handler.
This commit is contained in:
Matthias Clasen 2018-01-10 19:02:23 -05:00
parent 4b613c2f6a
commit fa0f637268

View File

@ -142,8 +142,8 @@ static gboolean gtk_entry_completion_visible_func (GtkTreeModel *mo
static gboolean gtk_entry_completion_popup_key_event (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_event (GtkWidget *widget,
GdkEventButton *event, GdkEvent *event,
gpointer user_data); gpointer user_data);
static void gtk_entry_completion_list_activated (GtkTreeView *treeview, static void gtk_entry_completion_list_activated (GtkTreeView *treeview,
GtkTreePath *path, GtkTreePath *path,
@ -603,8 +603,8 @@ gtk_entry_completion_constructed (GObject *object)
g_signal_connect (priv->popup_window, "key-release-event", g_signal_connect (priv->popup_window, "key-release-event",
G_CALLBACK (gtk_entry_completion_popup_key_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, "event",
G_CALLBACK (gtk_entry_completion_popup_button_press), G_CALLBACK (gtk_entry_completion_popup_event),
completion); completion);
popup_frame = gtk_frame_new (NULL); popup_frame = gtk_frame_new (NULL);
@ -914,19 +914,22 @@ gtk_entry_completion_popup_key_event (GtkWidget *widget,
} }
static gboolean static gboolean
gtk_entry_completion_popup_button_press (GtkWidget *widget, gtk_entry_completion_popup_event (GtkWidget *widget,
GdkEventButton *event, GdkEvent *event,
gpointer user_data) gpointer user_data)
{ {
GtkEntryCompletion *completion = GTK_ENTRY_COMPLETION (user_data); GtkEntryCompletion *completion = GTK_ENTRY_COMPLETION (user_data);
if (gdk_event_get_event_type (event) != GDK_BUTTON_PRESS)
return GDK_EVENT_PROPAGATE;
if (!gtk_widget_get_mapped (completion->priv->popup_window)) if (!gtk_widget_get_mapped (completion->priv->popup_window))
return FALSE; return GDK_EVENT_PROPAGATE;
/* if we come here, it's usually time to popdown */ /* if we come here, it's usually time to popdown */
_gtk_entry_completion_popdown (completion); _gtk_entry_completion_popdown (completion);
return TRUE; return GDK_EVENT_STOP;
} }
static void static void