[gtk+/gtk-2-24-quartz: 27/27] Bug 658767: Incorporate Kristian's comments
- From: John Ralls <jralls src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-24-quartz: 27/27] Bug 658767: Incorporate Kristian's comments
- Date: Sun, 25 Sep 2011 21:45:46 +0000 (UTC)
commit e1aa6a22352f3323cb4b94747d81f302e40cb120
Author: John Ralls <jralls ceridwen us>
Date: Sat Sep 24 13:54:45 2011 -0700
Bug 658767: Incorporate Kristian's comments
gtk/gtkdnd-quartz.c | 27 +++++++++++++++++++++------
1 files changed, 21 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkdnd-quartz.c b/gtk/gtkdnd-quartz.c
index b4d8c9c..2b5856c 100644
--- a/gtk/gtkdnd-quartz.c
+++ b/gtk/gtkdnd-quartz.c
@@ -1149,16 +1149,32 @@ gtk_drag_begin_internal (GtkWidget *widget,
GtkDragSourceInfo *info;
GdkDragContext *context;
NSWindow *nswindow = get_toplevel_nswindow (widget);
- NSPoint point = {(double)event->motion.x, (double)event->motion.y};
- NSEvent *nsevent = [NSEvent mouseEventWithType: NSLeftMouseDown
- location: point
+ NSPoint point = {0, 0};
+ gdouble x, y;
+ double time = (double)g_get_real_time ();
+ NSEvent *nsevent;
+ NSTimeInterval nstime;
+
+ if (event)
+ {
+ if (gdk_event_get_coords (event, &x, &y))
+ {
+ point.x = x;
+ point.y = y;
+ }
+ time = (double)gdk_event_get_time (event);
+ }
+ nstime = [[NSDate dateWithTimeIntervalSince1970: time / 1000] timeIntervalSinceReferenceDate];
+ nsevent = [NSEvent mouseEventWithType: NSLeftMouseDown
+ location: point
modifierFlags: 0
- timestamp: event->motion.time
+ timestamp: nstime
windowNumber: [nswindow windowNumber]
context: [nswindow graphicsContext]
eventNumber: 0
clickCount: 1
- pressure: 0.0 ];
+ pressure: 0.0 ];
+
GdkWindow *window = [[nswindow contentView] gdkWindow];
g_return_val_if_fail(nsevent != NULL, NULL);
@@ -1236,7 +1252,6 @@ gtk_drag_begin_internal (GtkWidget *widget,
}
}
-
/* drag will begin in an idle handler to avoid nested run loops */
g_idle_add_full (G_PRIORITY_HIGH_IDLE, gtk_drag_begin_idle, context, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]