[gimp/wip/nielsdg/gimptagpopup-transient-for] app: tagpopup: Try to set transient-for property




commit 20a3e522a4442462c28ddbca8b9100bf1677630a
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Tue Dec 29 23:40:16 2020 +0100

    app: tagpopup: Try to set transient-for property
    
    Setting the `"transient-for`" property for popups is important to
    certain window managers (such as Wayland), so that they know what the
    parent surface is and can position the popup accordingly.
    
    This fixes the `GimpTagPopup` in wayland giving a critical message, and
    getting a random position somewhere on the screen.

 app/widgets/gimptagpopup.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/app/widgets/gimptagpopup.c b/app/widgets/gimptagpopup.c
index c2d9b457d9..dbdf009ce0 100644
--- a/app/widgets/gimptagpopup.c
+++ b/app/widgets/gimptagpopup.c
@@ -456,11 +456,16 @@ gimp_tag_popup_get_property (GObject    *object,
 GtkWidget *
 gimp_tag_popup_new (GimpComboTagEntry *combo_entry)
 {
+  GtkWidget *toplevel;
+
   g_return_val_if_fail (GIMP_IS_COMBO_TAG_ENTRY (combo_entry), NULL);
 
+  toplevel = gtk_widget_get_toplevel (GTK_WIDGET (combo_entry));
+
   return g_object_new (GIMP_TYPE_TAG_POPUP,
-                       "type",  GTK_WINDOW_POPUP,
-                       "owner", combo_entry,
+                       "type",          GTK_WINDOW_POPUP,
+                       "owner",         combo_entry,
+                       "transient-for", GTK_IS_WINDOW (toplevel) ? toplevel : NULL,
                        NULL);
 }
 


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