[gtk+/wip/dboles/combobox-events] combobox—Always popup menu using current event



commit 0c09e4776dae0c1b1f90d0de3bb16065d9ff7751
Author: Daniel Boles <dboles src gnome org>
Date:   Thu Feb 16 21:33:25 2017 +0000

    combobox—Always popup menu using current event
    
    priv->trigger_event is never set, so it is always NULL. This means the
    gtk_menu_popup*() methods use the current event. The only way to get any
    other event to combobox_menu_popup() was from the button-press-event
    handler I just removed, which would end up being the current one anyway.
    
    So, bin priv->trigger_event & explicitly pass NULL to gtk_menu_popup*().

 gtk/gtkcombobox.c |   19 ++++++-------------
 1 files changed, 6 insertions(+), 13 deletions(-)
---
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index 3bb5d8c..e84520a 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -147,7 +147,6 @@ struct _GtkComboBoxPrivate
   gulong reordered_id;
   gulong changed_id;
   guint popup_idle_id;
-  GdkEvent *trigger_event;
   guint scroll_timer;
   guint resize_idle_id;
 
@@ -293,8 +292,7 @@ static void     gtk_combo_box_update_sensitivity   (GtkComboBox      *combo_box)
 static gboolean gtk_combo_box_menu_key_press       (GtkWidget        *widget,
                                                     GdkEventKey      *event,
                                                     gpointer          data);
-static void     gtk_combo_box_menu_popup           (GtkComboBox      *combo_box,
-                                                    const GdkEvent   *trigger_event);
+static void     gtk_combo_box_menu_popup           (GtkComboBox      *combo_box);
 
 /* cell layout */
 static GtkCellArea *gtk_combo_box_cell_layout_get_area       (GtkCellLayout    *cell_layout);
@@ -1475,8 +1473,7 @@ update_menu_sensitivity (GtkComboBox *combo_box,
 }
 
 static void
-gtk_combo_box_menu_popup (GtkComboBox    *combo_box,
-                          const GdkEvent *trigger_event)
+gtk_combo_box_menu_popup (GtkComboBox    *combo_box)
 {
   GtkComboBoxPrivate *priv = combo_box->priv;
   gint active_item;
@@ -1538,7 +1535,7 @@ gtk_combo_box_menu_popup (GtkComboBox    *combo_box,
                                 gtk_bin_get_child (GTK_BIN (combo_box)),
                                 GDK_GRAVITY_SOUTH_WEST,
                                 GDK_GRAVITY_NORTH_WEST,
-                                trigger_event);
+                                NULL);
     }
   else
     {
@@ -1594,7 +1591,7 @@ gtk_combo_box_menu_popup (GtkComboBox    *combo_box,
                                 GTK_WIDGET (combo_box),
                                 GDK_GRAVITY_WEST,
                                 GDK_GRAVITY_NORTH_WEST,
-                                trigger_event);
+                                NULL);
     }
 
     /* Re-get the active item before selecting it, as a popped-up handler – like
@@ -1660,15 +1657,13 @@ gtk_combo_box_popup_for_device (GtkComboBox *combo_box,
   if (gtk_widget_get_mapped (priv->popup_widget))
     return;
 
-  gtk_combo_box_menu_popup (combo_box, priv->trigger_event);
+  gtk_combo_box_menu_popup (combo_box);
 }
 
 static void
 gtk_combo_box_real_popup (GtkComboBox *combo_box)
 {
-  GtkComboBoxPrivate *priv = combo_box->priv;
-
-  gtk_combo_box_menu_popup (combo_box, priv->trigger_event);
+  gtk_combo_box_menu_popup (combo_box);
 }
 
 static gboolean
@@ -2766,8 +2761,6 @@ gtk_combo_box_destroy (GtkWidget *widget)
       priv->popup_idle_id = 0;
     }
 
-  g_clear_pointer (&priv->trigger_event, gdk_event_free);
-
   if (priv->box)
     {
       /* destroy things (unparent will kill the latest ref from us)


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