[epiphany] egg-editable-toolbar: set a device to the DnD event
- From: Xan Lopez <xan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] egg-editable-toolbar: set a device to the DnD event
- Date: Sun, 3 Apr 2011 15:38:56 +0000 (UTC)
commit f82ade160f40cb6e05de3fb7a53274762651cc6f
Author: Xan Lopez <xlopez igalia com>
Date: Sat Apr 2 15:05:48 2011 -0700
egg-editable-toolbar: set a device to the DnD event
Otherwise we'll crash inside GTK+.
lib/egg/egg-editable-toolbar.c | 23 ++++++++++++-----------
1 files changed, 12 insertions(+), 11 deletions(-)
---
diff --git a/lib/egg/egg-editable-toolbar.c b/lib/egg/egg-editable-toolbar.c
index 1a756fc..6a686bd 100644
--- a/lib/egg/egg-editable-toolbar.c
+++ b/lib/egg/egg-editable-toolbar.c
@@ -296,17 +296,18 @@ move_item_cb (GtkAction *action,
GtkTargetList *list = gtk_target_list_new (dest_drag_types, G_N_ELEMENTS (dest_drag_types));
GdkEvent *realevent = gtk_get_current_event();
- GdkEventMotion event;
- event.type = GDK_MOTION_NOTIFY;
- event.window = realevent->any.window;
- event.send_event = FALSE;
- event.axes = NULL;
- event.time = gdk_event_get_time (realevent);
- gdk_event_get_state (realevent, &event.state);
- gdk_event_get_coords (realevent, &event.x, &event.y);
- gdk_event_get_root_coords (realevent, &event.x_root, &event.y_root);
-
- gtk_drag_begin (toolitem, list, GDK_ACTION_MOVE, 1, (GdkEvent *)&event);
+ GdkEvent *event = gdk_event_new (GDK_MOTION_NOTIFY);
+ event->motion.window = g_object_ref (realevent->any.window);
+ event->motion.send_event = FALSE;
+ event->motion.axes = NULL;
+ event->motion.time = gdk_event_get_time (realevent);
+ gdk_event_set_device (event, gdk_event_get_device (realevent));
+ gdk_event_get_state (realevent, &event->motion.state);
+ gdk_event_get_coords (realevent, &event->motion.x, &event->motion.y);
+ gdk_event_get_root_coords (realevent, &event->motion.x_root, &event->motion.y_root);
+
+ gtk_drag_begin (toolitem, list, GDK_ACTION_MOVE, 1, event);
+ gdk_event_free (event);
gtk_target_list_unref (list);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]