[gtk+] Fix stuck pointer grab due to passing GDK_CURRENT_TIME to gtk_drag_begin()



commit ccc3d2c69f8faa6eedd6148a0a323e0dc2d924a6
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 |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c
index 2322ec4..52d8eda 100644
--- a/gtk/gtkdnd.c
+++ b/gtk/gtkdnd.c
@@ -2362,6 +2362,9 @@ gtk_drag_begin_internal (GtkWidget         *widget,
   if (event)
     {
       time = gdk_event_get_time (event);
+      if (time == GDK_CURRENT_TIME)
+        time = gtk_get_current_event_time ();
+
       pointer = gdk_event_get_device (event);
 
       if (pointer->source == GDK_SOURCE_KEYBOARD)
@@ -4064,6 +4067,10 @@ gtk_drag_end (GtkDragSourceInfo *info, guint32 time)
   pointer = gdk_drag_context_get_device (info->context);
   keyboard = gdk_device_get_associated_device (pointer);
 
+  /* 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]