ComboBox: Really set list-mode popup transient-for

set_transient_for(toplevel) was only called in list_setup(). It was easy
to make a test showing a NULL :transient-for instead of the correct one.

So, move the call from list_setup() to popup_for_device(). Also do that
for window_group_add_window(), which means not calling it redundantly.

(I tried using a ComboBox:parent-set handler, but the Inspector’s CB
didn’t like that: it calls popup_for_device() twice and closes on button
release. Anyway, using popup() is much more concise than a new handler.)
This commit is contained in:
Daniel Boles 2017-08-28 00:12:02 +01:00
parent 70534de382
commit c789bf7718

View File

@ -1855,8 +1855,6 @@ gtk_combo_box_set_popup_widget (GtkComboBox *combo_box,
{
if (!priv->popup_window)
{
GtkWidget *toplevel;
priv->popup_window = gtk_window_new (GTK_WINDOW_POPUP);
gtk_widget_set_name (priv->popup_window, "gtk-combobox-popup-window");
@ -1870,15 +1868,6 @@ gtk_combo_box_set_popup_widget (GtkComboBox *combo_box,
G_CALLBACK (gtk_combo_box_child_hide),
combo_box);
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (combo_box));
if (GTK_IS_WINDOW (toplevel))
{
gtk_window_group_add_window (gtk_window_get_group (GTK_WINDOW (toplevel)),
GTK_WINDOW (priv->popup_window));
gtk_window_set_transient_for (GTK_WINDOW (priv->popup_window),
GTK_WINDOW (toplevel));
}
gtk_window_set_resizable (GTK_WINDOW (priv->popup_window), FALSE);
priv->scrolled_window = gtk_scrolled_window_new (NULL, NULL);
@ -2335,8 +2324,12 @@ gtk_combo_box_popup_for_device (GtkComboBox *combo_box,
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (combo_box));
if (GTK_IS_WINDOW (toplevel))
gtk_window_group_add_window (gtk_window_get_group (GTK_WINDOW (toplevel)),
GTK_WINDOW (priv->popup_window));
{
gtk_window_group_add_window (gtk_window_get_group (GTK_WINDOW (toplevel)),
GTK_WINDOW (priv->popup_window));
gtk_window_set_transient_for (GTK_WINDOW (priv->popup_window),
GTK_WINDOW (toplevel));
}
gtk_widget_show_all (priv->scrolled_window);
gtk_combo_box_list_position (combo_box, &x, &y, &width, &height);