[gtk+/gtk-2-22] Fix stuck pointer grab due to passing GDK_CURRENT_TIME to gtk_drag_begin()



commit 13dba0a461d7fe5b3763c92d27c93a64a8c842b7
Author: Stanislav Brabec <sbrabec suse cz>
Date:   Thu Jul 22 16:19:49 2010 -0500

    Fix stuck pointer grab due to passing GDK_CURRENT_TIME to gtk_drag_begin()
    
    If gtk_drag_begin() gets passed GDK_CURRENT_TIME, try to use
    gtk_get_current_event_time().  If it fails, use GDK_CURRENT_TIME when
    ungrabbing in gtk_drag_end().
    
    For more see https://bugzilla.gnome.org/show_bug.cgi?id=623865

 gtk/gtkdnd.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c
index 70b6628..0859c45 100644
--- a/gtk/gtkdnd.c
+++ b/gtk/gtkdnd.c
@@ -2335,7 +2335,11 @@ gtk_drag_begin_internal (GtkWidget         *widget,
 				NULL);
   
   if (event)
-    time = gdk_event_get_time (event);
+    {
+      time = gdk_event_get_time (event);
+      if (time == GDK_CURRENT_TIME)
+        time = gtk_get_current_event_time ();
+    }
 
   if (gdk_pointer_grab (ipc_widget->window, FALSE,
 			GDK_POINTER_MOTION_MASK |
@@ -4056,6 +4060,10 @@ gtk_drag_end (GtkDragSourceInfo *info, guint32 time)
   GtkWidget *source_widget = info->widget;
   GdkDisplay *display = gtk_widget_get_display (source_widget);
 
+  /* Prevent ungrab before grab (see bug 623865) */
+  if (info->grab_time == GDK_CURRENT_TIME)
+    time = GDK_CURRENT_TIME;
+
   if (info->update_idle)
     {
       g_source_remove (info->update_idle);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]