[gtk+/gtk-2-24-quartz] Use a synthesized mouse nsevent to start a drag instead of grabbing the most recent event from the n



commit c297c31732216be7d60b3b11244855d7f7f98003
Author: John Ralls <jralls ceridwen us>
Date:   Sat Jan 8 10:19:25 2011 -0800

    Use a synthesized mouse nsevent to start a drag instead of grabbing the most recent event from the nswindow (which may well not be the right event).

 gtk/gtkdnd-quartz.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkdnd-quartz.c b/gtk/gtkdnd-quartz.c
index bd97fc0..1ec4a1d 100644
--- a/gtk/gtkdnd-quartz.c
+++ b/gtk/gtkdnd-quartz.c
@@ -1135,7 +1135,17 @@ gtk_drag_begin_internal (GtkWidget         *widget,
   GtkDragSourceInfo *info;
   GdkDragContext *context;
   NSWindow *nswindow = get_toplevel_nswindow (widget);
-  NSEvent *nsevent = [nswindow currentEvent];
+  NSPoint point = {(double)event->motion.x, (double)event->motion.y};
+  NSEvent *nsevent = [NSEvent mouseEventWithType: NSLeftMouseDown
+		      location: point
+		      modifierFlags: 0
+		      timestamp: event->motion.time
+		      windowNumber: [nswindow windowNumber]
+		      context: [nswindow graphicsContext]
+		      eventNumber: 0
+		      clickCount: 1
+		      pressure: 0.0 ];
+  g_return_val_if_fail(nsevent != NULL, NULL);
 
   context = gdk_drag_begin (NULL, NULL);
   g_return_val_if_fail( context != NULL, NULL);



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