[gtk+/gtk-2-24-quartz: 16/26] Move the retrieval of the NSEvent to the beginning of drag_begin_internal in a (probably vain) effor



commit 609548d995c93ac1d161135be60c012335f125f7
Author: John Ralls <jralls ceridwen us>
Date:   Fri Dec 31 17:33:21 2010 -0800

    Move the retrieval of the NSEvent to the beginning of drag_begin_internal in a (probably vain) effort to reduce the race condition caused by deferring actually starting the drag until idle time.

 gtk/gtkdnd-quartz.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkdnd-quartz.c b/gtk/gtkdnd-quartz.c
index f2fa063..8247f06 100644
--- a/gtk/gtkdnd-quartz.c
+++ b/gtk/gtkdnd-quartz.c
@@ -1126,7 +1126,8 @@ gtk_drag_begin_internal (GtkWidget         *widget,
 {
   GtkDragSourceInfo *info;
   GdkDragContext *context;
-  NSWindow *nswindow;
+  NSWindow *nswindow = get_toplevel_nswindow (widget);
+  NSEvent *nsevent = [nswindow currentEvent];
 
   context = gdk_drag_begin (NULL, NULL);
   g_return_val_if_fail( context != NULL, NULL);
@@ -1134,7 +1135,9 @@ gtk_drag_begin_internal (GtkWidget         *widget,
   context->is_source = TRUE;
 
   info = gtk_drag_get_source_info (context, TRUE);
-  
+  info->nsevent = nsevent;
+  [info->nsevent retain];
+
   info->source_widget = g_object_ref (widget);
   info->widget = g_object_ref (widget);
   info->target_list = target_list;
@@ -1201,9 +1204,6 @@ gtk_drag_begin_internal (GtkWidget         *widget,
 	  }
     }
 
-  nswindow = get_toplevel_nswindow (widget);
-  info->nsevent = [nswindow currentEvent];
-  [info->nsevent retain];
 
   /* drag will begin in an idle handler to avoid nested run loops */
 



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