entrycompletion: Realize popup after setting screen
authorJonas Ådahl <jadahl@gmail.com>
Wed, 14 Mar 2018 03:54:02 +0000 (11:54 +0800)
committerJonas Ådahl <jadahl@gmail.com>
Wed, 14 Mar 2018 03:57:00 +0000 (11:57 +0800)
Realization is done as a side effect of calling
_gtk_entry_completion_resize_popup(), but if this is done before the
GdkScreen of the GtkWindow is set up correctly, it may result in the
widget being unrealized when the screen is updated. This may happen
when the file dialog parent window is not using the default GdkDisplay.

To avoid this issue, realize the popup after the screen has been
properly set up.

Fixes #83 in gtk3

gtk/gtkentrycompletion.c

index 2ab53d6bdc465ccd1235ea81fffd4dca70eb82f2..8c80b1c0580ca0d78669cfa3ed8dbdf379118a2a 100644 (file)
@@ -1648,8 +1648,6 @@ gtk_entry_completion_popup (GtkEntryCompletion *completion)
   /* default on no match */
   completion->priv->current_selected = -1;
 
-  _gtk_entry_completion_resize_popup (completion);
-
   toplevel = gtk_widget_get_toplevel (completion->priv->entry);
   if (GTK_IS_WINDOW (toplevel))
     {
@@ -1662,6 +1660,8 @@ gtk_entry_completion_popup (GtkEntryCompletion *completion)
   gtk_window_set_screen (GTK_WINDOW (completion->priv->popup_window),
                          gtk_widget_get_screen (completion->priv->entry));
 
+  _gtk_entry_completion_resize_popup (completion);
+
   if (completion->priv->device)
     {
       gtk_grab_add (completion->priv->popup_window);