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
This commit is contained in:
Carlos Garnacho 2015-06-12 15:05:33 +02:00
parent a0ff35f032
commit a01fe14056

View File

@ -413,8 +413,15 @@ window_set_focus (GtkWindow *window,
if (priv->modal && widget &&
gtk_widget_is_drawable (GTK_WIDGET (popover)) &&
!gtk_widget_is_ancestor (widget, 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
prev_focus_unmap_cb (GtkWidget *widget,
@ -1746,8 +1753,15 @@ _gtk_popover_parent_grab_notify (GtkWidget *widget,
if (priv->modal &&
gtk_widget_is_visible (GTK_WIDGET (popover)) &&
!gtk_widget_has_grab (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
_gtk_popover_parent_unmap (GtkWidget *widget,