From 5ed4732737202c3051044455a91dc70c213fb800 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Mon, 22 Feb 2010 11:30:14 +0000 Subject: [PATCH] device: Force ENTER on Stage with overlapping Actors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If an actor is on the boundary of a Stage and the pointer for a device enters the Stage over that actor, the sequence of events currently is: ➔ ENTER (source: actor, related: NULL) ➔ MOTION Thus the Stage never gets an ENTER event. This is a regression from Clutter 1.0. The correct sequence is: ➔ ENTER (source: stage, related: NULL) ➔ ENTER (source: actor, related: stage) ➔ MOTION This also maps to the sequence of events sythesized by Clutter when leaving the Stage through an actor overlapping the Stage boundary. http://bugzilla.moblin.org/show_bug.cgi?id=9781 --- clutter/clutter-input-device.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/clutter/clutter-input-device.c b/clutter/clutter-input-device.c index 833367db9..3c1d84691 100644 --- a/clutter/clutter-input-device.c +++ b/clutter/clutter-input-device.c @@ -286,8 +286,8 @@ _clutter_input_device_set_stage (ClutterInputDevice *device, cev.crossing.y = device->current_y; cev.crossing.device = device; cev.crossing.related = device->stage != NULL - ? CLUTTER_ACTOR (device->stage) - : CLUTTER_ACTOR (old_stage); + ? CLUTTER_ACTOR (device->stage) + : CLUTTER_ACTOR (old_stage); _clutter_stage_queue_event (old_stage, &cev); @@ -363,11 +363,30 @@ _clutter_input_device_set_actor (ClutterInputDevice *device, cev.crossing.time = device->current_time; cev.crossing.flags = 0; cev.crossing.stage = device->stage; - cev.crossing.source = actor; cev.crossing.x = device->current_x; cev.crossing.y = device->current_y; cev.crossing.device = device; - cev.crossing.related = old_actor; + + /* if there is an actor overlapping the Stage boundary and we + * don't do this check then we'll emit an ENTER event only on + * the actor instead of emitting it on the Stage *and* the + * actor + */ + if (old_actor == NULL && actor != CLUTTER_ACTOR (device->stage)) + { + cev.crossing.source = CLUTTER_ACTOR (device->stage); + cev.crossing.related = NULL; + + _clutter_process_event (&cev); + + cev.crossing.source = actor; + cev.crossing.related = CLUTTER_ACTOR (device->stage); + } + else + { + cev.crossing.source = actor; + cev.crossing.related = old_actor; + } /* as above: we need to make sure that this event is processed * before any other event we might have queued up until now, so