aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXan Lopez <xlopez@igalia.com>2011-04-03 06:05:48 +0800
committerXan Lopez <xlopez@igalia.com>2011-04-03 23:38:49 +0800
commitf82ade160f40cb6e05de3fb7a53274762651cc6f (patch)
treef76ea4c3d6e5824af751cac1ce67486c4fe37bdf
parent6a4d6f0769186bb42546725327916b3a30ae06a0 (diff)
downloadgsoc2013-epiphany-f82ade160f40cb6e05de3fb7a53274762651cc6f.tar
gsoc2013-epiphany-f82ade160f40cb6e05de3fb7a53274762651cc6f.tar.gz
gsoc2013-epiphany-f82ade160f40cb6e05de3fb7a53274762651cc6f.tar.bz2
gsoc2013-epiphany-f82ade160f40cb6e05de3fb7a53274762651cc6f.tar.lz
gsoc2013-epiphany-f82ade160f40cb6e05de3fb7a53274762651cc6f.tar.xz
gsoc2013-epiphany-f82ade160f40cb6e05de3fb7a53274762651cc6f.tar.zst
gsoc2013-epiphany-f82ade160f40cb6e05de3fb7a53274762651cc6f.zip
egg-editable-toolbar: set a device to the DnD event
Otherwise we'll crash inside GTK+.
-rw-r--r--lib/egg/egg-editable-toolbar.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/lib/egg/egg-editable-toolbar.c b/lib/egg/egg-editable-toolbar.c
index 1a756fc75..6a686bd35 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);
}