diff --git a/clutter/clutter-event.c b/clutter/clutter-event.c index 9f4588dd7..a5908a473 100644 --- a/clutter/clutter-event.c +++ b/clutter/clutter-event.c @@ -676,12 +676,22 @@ ClutterEvent * clutter_event_copy (const ClutterEvent *event) { ClutterEvent *new_event; + ClutterEventPrivate *new_real_event; g_return_val_if_fail (event != NULL, NULL); new_event = clutter_event_new (CLUTTER_NOTHING); + new_real_event = (ClutterEventPrivate *) new_event; + *new_event = *event; + if (is_event_allocated (event)) + { + ClutterEventPrivate *real_event = (ClutterEventPrivate *) event; + + new_real_event->source_device = real_event->source_device; + } + switch (event->type) { case CLUTTER_BUTTON_PRESS: @@ -696,6 +706,17 @@ clutter_event_copy (const ClutterEvent *event) } break; + case CLUTTER_SCROLL: + if (event->scroll.device != NULL && event->scroll.axes != NULL) + { + gint n_axes; + + n_axes = clutter_input_device_get_n_axes (event->scroll.device); + new_event->scroll.axes = g_memdup (event->scroll.axes, + sizeof (gdouble) * n_axes); + } + break; + case CLUTTER_MOTION: if (event->motion.device != NULL && event->motion.axes != NULL) { @@ -743,6 +764,10 @@ clutter_event_free (ClutterEvent *event) g_free (event->motion.axes); break; + case CLUTTER_SCROLL: + g_free (event->scroll.axes); + break; + default: break; }