device: Unset the cursor actor when leaving the stage

When an InputDevice leaves a stage we set the stage member of
InputDevice to NULL. We should also unset the cursor_actor (as the
device is obviously not on an actor any more).

When the device re-enters the Stage the ENTER/LEAVE event generation
machinery will then be able to emit the ENTER event on the Stage.
This commit is contained in:
Emmanuele Bassi 2010-01-14 17:14:33 +00:00
parent 55e4315aa5
commit 8a579838d5

View File

@ -210,22 +210,6 @@ _clutter_input_device_set_time (ClutterInputDevice *device,
device->current_time = time_;
}
/*
* _clutter_input_device_set_stage:
* @device: a #ClutterInputDevice
* @stage: a #ClutterStage
*
* Stores the stage under the device
*/
void
_clutter_input_device_set_stage (ClutterInputDevice *device,
ClutterStage *stage)
{
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
device->stage = stage;
}
/*
* cursor_weak_unref:
*
@ -242,6 +226,35 @@ cursor_weak_unref (gpointer user_data,
device->cursor_actor = NULL;
}
/*
* _clutter_input_device_set_stage:
* @device: a #ClutterInputDevice
* @stage: a #ClutterStage or %NULL
*
* Stores the stage under the device
*/
void
_clutter_input_device_set_stage (ClutterInputDevice *device,
ClutterStage *stage)
{
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
device->stage = stage;
/* if we left the stage then we also need to unset the
* cursor actor (and update its :has-pointer property)
*/
if (device->stage == NULL && device->cursor_actor != NULL)
{
_clutter_actor_set_has_pointer (device->cursor_actor, FALSE);
g_object_weak_unref (G_OBJECT (device->cursor_actor),
cursor_weak_unref,
device);
device->cursor_actor = NULL;
}
}
/*
* _clutter_input_device_set_actor:
* @device: a #ClutterInputDevice