diff options
author | Matthias Clasen <mclasen@redhat.com> | 2015-10-15 20:16:54 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2015-10-15 20:18:26 -0400 |
commit | 0731c502626d2b739281f7bb87f5cfd9d8a61ade (patch) | |
tree | 82df8c652f23d8b5fe74f626d6c9e8e098cf70d4 /gtk/gtkentrycompletion.c | |
parent | dd3f4f29047dc87a412e1e4432d39d56bbd01e5d (diff) | |
download | gtk+-0731c502626d2b739281f7bb87f5cfd9d8a61ade.tar.gz |
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.
Diffstat (limited to 'gtk/gtkentrycompletion.c')
-rw-r--r-- | gtk/gtkentrycompletion.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/gtk/gtkentrycompletion.c b/gtk/gtkentrycompletion.c index cee8f250cb..9acae9de70 100644 --- a/gtk/gtkentrycompletion.c +++ b/gtk/gtkentrycompletion.c @@ -1654,15 +1654,18 @@ gtk_entry_completion_popup (GtkEntryCompletion *completion) gtk_widget_show (completion->priv->popup_window); - 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, - GDK_BUTTON_PRESS_MASK | - GDK_BUTTON_RELEASE_MASK | - GDK_POINTER_MOTION_MASK, - NULL, GDK_CURRENT_TIME); - - completion->priv->has_grab = TRUE; + 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, + GDK_BUTTON_PRESS_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_POINTER_MOTION_MASK, + NULL, GDK_CURRENT_TIME); + + completion->priv->has_grab = TRUE; + } } void |