[gtk/wip/matthiasc/popup5: 226/234] fishbowl: Don't pop up popovers too early



commit 9fa3cdf6aa6a5828908e4e9c9de59e98d59e8131
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri May 24 01:54:55 2019 +0000

    fishbowl: Don't pop up popovers too early
    
    Wayland does not like this.

 demos/gtk-demo/fishbowl.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/demos/gtk-demo/fishbowl.c b/demos/gtk-demo/fishbowl.c
index e716a07658..5eaadcde0f 100644
--- a/demos/gtk-demo/fishbowl.c
+++ b/demos/gtk-demo/fishbowl.c
@@ -164,6 +164,12 @@ create_switch (void)
   return w;
 }
 
+static void
+mapped (GtkWidget *w)
+{
+  gtk_menu_button_popup (GTK_MENU_BUTTON (w));
+}
+
 static GtkWidget *
 create_menu_button (void)
 {
@@ -171,8 +177,9 @@ create_menu_button (void)
   GtkWidget *popover = gtk_popover_new (NULL);
 
   gtk_container_add (GTK_CONTAINER (popover), gtk_button_new_with_label ("Hey!"));
+  gtk_popover_set_autohide (GTK_POPOVER (popover), FALSE);
   gtk_menu_button_set_popover (GTK_MENU_BUTTON (w), popover);
-  gtk_menu_button_popup (GTK_MENU_BUTTON (w));
+  g_signal_connect (w, "map", G_CALLBACK (mapped), NULL);
 
   return w;
 }


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