[gtk+/gtk-3-22] ComboBox: Really set list-mode popup transient-for
- From: Daniel Boles <dboles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-22] ComboBox: Really set list-mode popup transient-for
- Date: Mon, 28 Aug 2017 19:04:39 +0000 (UTC)
commit c789bf7718342b37464bc0d3beef6cb9449f0edc
Author: Daniel Boles <dboles src gnome org>
Date: Mon Aug 28 00:12:02 2017 +0100
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.)
gtk/gtkcombobox.c | 19 ++++++-------------
1 files changed, 6 insertions(+), 13 deletions(-)
---
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index 743aa49..fa1e26c 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]