[gtk+/gtk-3-18] entry completion: Only grab the device if we have one
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-18] entry completion: Only grab the device if we have one
- Date: Mon, 2 Nov 2015 22:58:15 +0000 (UTC)
commit 879630b83292ad13c558f3f2a374e30ac3e85919
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Oct 15 20:16:54 2015 -0400
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.
gtk/gtkentrycompletion.c | 21 ++++++++++++---------
1 files changed, 12 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtkentrycompletion.c b/gtk/gtkentrycompletion.c
index cee8f25..9acae9d 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]