entry completion: Only grab the device if we have one

When the entry completion is popped up from a timeout, we may
not have a device. In that case, don't call gdk_device_grab,
do avoid criticals.
This commit is contained in:
Matthias Clasen 2015-10-15 20:16:54 -04:00
parent dd3f4f2904
commit 0731c50262

View File

@ -1654,6 +1654,8 @@ gtk_entry_completion_popup (GtkEntryCompletion *completion)
gtk_widget_show (completion->priv->popup_window);
if (completion->priv->device)
{
gtk_device_grab_add (completion->priv->popup_window, completion->priv->device, TRUE);
gdk_device_grab (completion->priv->device, gtk_widget_get_window (completion->priv->popup_window),
GDK_OWNERSHIP_WINDOW, TRUE,
@ -1663,6 +1665,7 @@ gtk_entry_completion_popup (GtkEntryCompletion *completion)
NULL, GDK_CURRENT_TIME);
completion->priv->has_grab = TRUE;
}
}
void