popover: Only give back focus to drawable widgets

If the previous focus widget is not drawable anymore, don't even
bother in transmitting the focus grab to it.
This commit is contained in:
Carlos Garnacho 2014-03-06 20:38:11 +01:00
parent aa7e00fcb8
commit 08e9c93b17

View File

@ -275,10 +275,12 @@ gtk_popover_apply_modality (GtkPopover *popover,
{ {
gtk_grab_remove (GTK_WIDGET (popover)); gtk_grab_remove (GTK_WIDGET (popover));
/* Let prev_focus_widget regain focus */
if (priv->prev_focus_widget) if (priv->prev_focus_widget)
{ {
gtk_widget_grab_focus (priv->prev_focus_widget); /* Let prev_focus_widget regain focus */
if (gtk_widget_is_drawable (priv->prev_focus_widget))
gtk_widget_grab_focus (priv->prev_focus_widget);
g_object_unref (priv->prev_focus_widget); g_object_unref (priv->prev_focus_widget);
priv->prev_focus_widget = NULL; priv->prev_focus_widget = NULL;
} }