diff --git a/ChangeLog b/ChangeLog index bae8eeb080..b36aaafdfc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sun Feb 8 01:44:06 2004 Matthias Clasen + + * gtk/gtkcombobox.c (gtk_combo_box_set_popup_widget): Make popups + come up on the same screen as the combo box. (#133544, + Morten Welinder) + Fri Feb 6 23:40:24 2004 Jonathan Blandford * gtk/gtkfilechooserdefault.c (create_file_list): clean up the diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index bae8eeb080..b36aaafdfc 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,9 @@ +Sun Feb 8 01:44:06 2004 Matthias Clasen + + * gtk/gtkcombobox.c (gtk_combo_box_set_popup_widget): Make popups + come up on the same screen as the combo box. (#133544, + Morten Welinder) + Fri Feb 6 23:40:24 2004 Jonathan Blandford * gtk/gtkfilechooserdefault.c (create_file_list): clean up the diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index bae8eeb080..b36aaafdfc 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,9 @@ +Sun Feb 8 01:44:06 2004 Matthias Clasen + + * gtk/gtkcombobox.c (gtk_combo_box_set_popup_widget): Make popups + come up on the same screen as the combo box. (#133544, + Morten Welinder) + Fri Feb 6 23:40:24 2004 Jonathan Blandford * gtk/gtkfilechooserdefault.c (create_file_list): clean up the diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index bae8eeb080..b36aaafdfc 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,9 @@ +Sun Feb 8 01:44:06 2004 Matthias Clasen + + * gtk/gtkcombobox.c (gtk_combo_box_set_popup_widget): Make popups + come up on the same screen as the combo box. (#133544, + Morten Welinder) + Fri Feb 6 23:40:24 2004 Jonathan Blandford * gtk/gtkfilechooserdefault.c (create_file_list): clean up the diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index bae8eeb080..b36aaafdfc 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,9 @@ +Sun Feb 8 01:44:06 2004 Matthias Clasen + + * gtk/gtkcombobox.c (gtk_combo_box_set_popup_widget): Make popups + come up on the same screen as the combo box. (#133544, + Morten Welinder) + Fri Feb 6 23:40:24 2004 Jonathan Blandford * gtk/gtkfilechooserdefault.c (create_file_list): clean up the diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c index eb1918c40c..fabb8b4aff 100644 --- a/gtk/gtkcombobox.c +++ b/gtk/gtkcombobox.c @@ -631,12 +631,36 @@ gtk_combo_box_menu_hide (GtkWidget *menu, FALSE); } +static void +gtk_combo_box_detacher (GtkWidget *widget, + GtkMenu *menu) +{ + GtkComboBox *combo_box; + + g_return_if_fail (GTK_IS_COMBO_BOX (widget)); + + combo_box = GTK_COMBO_BOX (widget); + g_return_if_fail (combo_box->priv->popup_widget == (GtkWidget*) menu); + + g_signal_handlers_disconnect_by_func (menu, + gtk_combo_box_menu_show, + combo_box); + g_signal_handlers_disconnect_by_func (menu, + gtk_combo_box_menu_hide, + combo_box); + + combo_box->priv->popup_widget = NULL; +} + static void gtk_combo_box_set_popup_widget (GtkComboBox *combo_box, GtkWidget *popup) { if (GTK_IS_MENU (combo_box->priv->popup_widget)) - combo_box->priv->popup_widget = NULL; + { + gtk_menu_detach (GTK_MENU (combo_box->priv->popup_widget)); + combo_box->priv->popup_widget = NULL; + } else if (combo_box->priv->popup_widget) { gtk_container_remove (GTK_CONTAINER (combo_box->priv->popup_frame), @@ -660,14 +684,18 @@ gtk_combo_box_set_popup_widget (GtkComboBox *combo_box, g_signal_connect (popup, "hide", G_CALLBACK (gtk_combo_box_menu_hide), combo_box); - /* FIXME: need to attach to widget? */ + gtk_menu_attach_to_widget (GTK_MENU (popup), + GTK_WIDGET (combo_box), + gtk_combo_box_detacher); } else { if (!combo_box->priv->popup_window) { combo_box->priv->popup_window = gtk_window_new (GTK_WINDOW_POPUP); - + gtk_window_set_screen (combo_box->priv->popup_window, + gtk_widget_get_screen (combo_box)); + combo_box->priv->popup_frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (combo_box->priv->popup_frame), GTK_SHADOW_NONE);