[gtk+] popover: Avoid hiding modal popovers if another popover is taking focus



commit a01fe140565f0af0838714daa6a99308f164d11c
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Jun 12 15:05:33 2015 +0200

    popover: Avoid hiding modal popovers if another popover is taking focus
    
    Due to popover modality itself, there's quite high chances the popover
    stealing focus has been triggered from within, so stay friendly to it.
    Hiding the popover here will only hide the grabbing popover too if this
    happens.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=750741

 gtk/gtkpopover.c |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index 1807d65..da4e1c1 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -413,7 +413,14 @@ window_set_focus (GtkWindow  *window,
   if (priv->modal && widget &&
       gtk_widget_is_drawable (GTK_WIDGET (popover)) &&
       !gtk_widget_is_ancestor (widget, GTK_WIDGET (popover)))
-    gtk_widget_hide (GTK_WIDGET (popover));
+    {
+      GtkWidget *grab_widget;
+
+      grab_widget = gtk_grab_get_current ();
+
+      if (!grab_widget || !GTK_IS_POPOVER (grab_widget))
+        gtk_widget_hide (GTK_WIDGET (popover));
+    }
 }
 
 static void
@@ -1746,7 +1753,14 @@ _gtk_popover_parent_grab_notify (GtkWidget  *widget,
   if (priv->modal &&
       gtk_widget_is_visible (GTK_WIDGET (popover)) &&
       !gtk_widget_has_grab (GTK_WIDGET (popover)))
-    gtk_widget_hide (GTK_WIDGET (popover));
+    {
+      GtkWidget *grab_widget;
+
+      grab_widget = gtk_grab_get_current ();
+
+      if (!grab_widget || !GTK_IS_POPOVER (grab_widget))
+        gtk_widget_hide (GTK_WIDGET (popover));
+    }
 }
 
 static void


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