[gtk+/wip/dboles/combobox-cleanup] combobox: Don’t try to popup() if we’re not mapped



commit 2c81c7e00f7d87887a4a1b3db9e1d6d54cb4f5e0
Author: Daniel Boles <dboles src gnome org>
Date:   Fri Jan 20 04:18:14 2017 +0000

    combobox: Don’t try to popup() if we’re not mapped
    
    Benjamin noted that commit 1e2afb79428d03d42c3cd9e143e476ac04582218
    needs matching code that makes sure popups can’t happen when unmapped.

 gtk/gtkcombobox.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index c2d98c2..8f145f3 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -1679,6 +1679,8 @@ gtk_combo_box_menu_popup (GtkComboBox    *combo_box,
  * This function is mostly intended for use by accessibility technologies;
  * applications should have little use for it.
  *
+ * Before calling this, @combo_box must be mapped, or nothing will happen.
+ *
  * Since: 2.4
  */
 void
@@ -1686,7 +1688,8 @@ gtk_combo_box_popup (GtkComboBox *combo_box)
 {
   g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
 
-  g_signal_emit (combo_box, combo_box_signals[POPUP], 0);
+  if (gtk_widget_get_mapped (GTK_WIDGET (combo_box)))
+    g_signal_emit (combo_box, combo_box_signals[POPUP], 0);
 }
 
 /**
@@ -2953,7 +2956,7 @@ static void gtk_combo_box_unmap (GtkWidget *widget)
 {
   GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
 
-  gtk_menu_popdown (GTK_MENU (combo_box->priv->popup_widget));
+  gtk_combo_box_popdown (combo_box);
 
   GTK_WIDGET_CLASS (gtk_combo_box_parent_class)->unmap (widget);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]