+2007-12-18 Øyvind Kolås <pippin@o-hand.com>
+
+ * clutter/clutter-main.c: (generate_enter_leave_events): synthesize
+ enter event (without related) and corresponding leave event when the
+ actor the cursor is over has been destroyed.
+ * clutter/clutter-event.c: (clutter_event_free): only unref the
+ related_actor when it actually is set.
+
2007-12-18 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-main.c:
{
if (G_LIKELY (event))
{
- if (event->type == CLUTTER_LEAVE || event->type == CLUTTER_ENTER)
- g_object_unref (event->crossing.related);
+ if ((event->type == CLUTTER_LEAVE || event->type == CLUTTER_ENTER) &&
+ event->crossing.related)
+ g_object_unref (event->crossing.related);
g_slice_free (ClutterEvent, event);
}
}
if (context->motion_last_actor != motion_current_actor)
{
- if (context->motion_last_actor && motion_current_actor)
+ if (motion_current_actor)
{
ClutterEvent cev;
- cev.crossing.type = CLUTTER_LEAVE;
- cev.crossing.time = event->any.time;
- cev.crossing.flags = 0;
- cev.crossing.x = event->motion.x;
- cev.crossing.y = event->motion.y;
- cev.crossing.source = context->motion_last_actor;
- /* unref in free */
- cev.crossing.related = g_object_ref (motion_current_actor);
-
- g_queue_push_head (context->events_queue,
- clutter_event_copy (&cev));
+ if (context->motion_last_actor)
+ {
+ cev.crossing.type = CLUTTER_LEAVE;
+ cev.crossing.time = event->any.time;
+ cev.crossing.flags = 0;
+ cev.crossing.x = event->motion.x;
+ cev.crossing.y = event->motion.y;
+ cev.crossing.source = context->motion_last_actor;
+ /* unref in free */
+ cev.crossing.related = g_object_ref (motion_current_actor);
+
+ g_queue_push_head (context->events_queue,
+ clutter_event_copy (&cev));
+ }
cev.crossing.type = CLUTTER_ENTER;
cev.crossing.time = event->any.time;
cev.crossing.x = event->motion.x;
cev.crossing.y = event->motion.y;
cev.crossing.source = motion_current_actor;
- cev.crossing.related = g_object_ref (context->motion_last_actor);
+ if (context->motion_last_actor)
+ {
+ cev.crossing.related = g_object_ref (context->motion_last_actor);
+ }
+ else
+ {
+ /* the previous actor we were getting events from seems to have
+ * vanished
+ */
+ cev.crossing.related = NULL;
+ }
g_queue_push_head (context->events_queue,
clutter_event_copy (&cev));