[gtk+/gtk-2-24] ComboBox: Don’t pile up ::grab-broken handlers
- From: Daniel Boles <dboles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-24] ComboBox: Don’t pile up ::grab-broken handlers
- Date: Fri, 6 Oct 2017 00:44:12 +0000 (UTC)
commit c75c8d0bda8ef8896bb021c1ae481fe608b39ce2
Author: Daniel Boles <dboles src gnome org>
Date: Wed Oct 4 22:49:51 2017 +0100
ComboBox: Don’t pile up ::grab-broken handlers
It was connecting a new handler to do the same thing every time it
popped up, never disconnecting between. Just connect once in init().
gtk/gtkcombobox.c | 34 ++++++++++++++++------------------
1 files changed, 16 insertions(+), 18 deletions(-)
---
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index a4867ef..d5fe00f 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -1524,6 +1524,19 @@ gtk_combo_box_detacher (GtkWidget *widget,
priv->popup_widget = NULL;
}
+static gboolean
+gtk_combo_box_grab_broken_event (GtkWidget *widget,
+ GdkEventGrabBroken *event,
+ gpointer user_data)
+{
+ GtkComboBox *combo_box = GTK_COMBO_BOX (user_data);
+
+ if (event->grab_window == NULL)
+ gtk_combo_box_popdown (combo_box);
+
+ return TRUE;
+}
+
static void
gtk_combo_box_set_popup_widget (GtkComboBox *combo_box,
GtkWidget *popup)
@@ -1583,6 +1596,9 @@ gtk_combo_box_set_popup_widget (GtkComboBox *combo_box,
g_signal_connect (priv->popup_window, "hide",
G_CALLBACK (gtk_combo_box_child_hide),
combo_box);
+ g_signal_connect (priv->popup_window, "grab-broken-event",
+ G_CALLBACK (gtk_combo_box_grab_broken_event),
+ combo_box);
gtk_window_set_resizable (GTK_WINDOW (priv->popup_window), FALSE);
@@ -2024,19 +2040,6 @@ popup_grab_on_window (GdkWindow *window,
return FALSE;
}
-static gboolean
-gtk_combo_box_grab_broken_event (GtkWidget *widget,
- GdkEventGrabBroken *event,
- gpointer user_data)
-{
- GtkComboBox *combo_box = GTK_COMBO_BOX (user_data);
-
- if (event->grab_window == NULL)
- gtk_combo_box_popdown (combo_box);
-
- return TRUE;
-}
-
/**
* gtk_combo_box_popup:
* @combo_box: a #GtkComboBox
@@ -2132,11 +2135,6 @@ gtk_combo_box_real_popup (GtkComboBox *combo_box)
}
gtk_grab_add (priv->popup_window);
-
- g_signal_connect (priv->popup_window,
- "grab-broken-event",
- G_CALLBACK (gtk_combo_box_grab_broken_event),
- combo_box);
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]