[clutter/pick-each-frame] Update the devices inside a stage on every frame
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter/pick-each-frame] Update the devices inside a stage on every frame
- Date: Wed, 20 Jul 2011 11:12:27 +0000 (UTC)
commit 9d9c78a60a265e600ddf76d533bf88c755b49d15
Author: Emmanuele Bassi <ebassi linux intel com>
Date: Wed Jul 20 12:09:54 2011 +0100
Update the devices inside a stage on every frame
This will update the actor underneath the pointer each time a new frame
is started, thus allowing the emission of crossing event pairs if the
scene changes without the pointer devices moving.
http://bugzilla.clutter-project.org/show_bug.cgi?id=1273
clutter/clutter-main.c | 6 +++---
clutter/clutter-master-clock.c | 5 ++++-
clutter/clutter-stage.c | 19 +++++++++++++++++++
3 files changed, 26 insertions(+), 4 deletions(-)
---
diff --git a/clutter/clutter-main.c b/clutter/clutter-main.c
index 3a6bb11..49009e5 100644
--- a/clutter/clutter-main.c
+++ b/clutter/clutter-main.c
@@ -2085,7 +2085,7 @@ _clutter_process_event_details (ClutterActor *stage,
emit_pointer_event (event, device);
- actor = _clutter_input_device_update (device, FALSE);
+ actor = device->cursor_actor;
if (actor != stage)
{
ClutterEvent *crossing;
@@ -2218,8 +2218,8 @@ _clutter_process_event_details (ClutterActor *stage,
* already have everything we need to update it and
* get the actor underneath
*/
- if (device != NULL)
- actor = _clutter_input_device_update (device, TRUE);
+ if (G_LIKELY (device != NULL))
+ actor = device->cursor_actor;
else
{
CLUTTER_NOTE (EVENT, "No device found: picking");
diff --git a/clutter/clutter-master-clock.c b/clutter/clutter-master-clock.c
index 1d67924..5f9112d 100644
--- a/clutter/clutter-master-clock.c
+++ b/clutter/clutter-master-clock.c
@@ -357,7 +357,10 @@ clutter_clock_dispatch (GSource *source,
* motion compression, and avoid multiple picks per frame.
*/
if (_clutter_stage_get_pending_swaps (l->data) == 0)
- _clutter_stage_process_queued_events (l->data);
+ {
+ _clutter_stage_update_input_devices (l->data);
+ _clutter_stage_process_queued_events (l->data);
+ }
}
CLUTTER_TIMER_STOP (_clutter_uprof_context, master_event_process);
diff --git a/clutter/clutter-stage.c b/clutter/clutter-stage.c
index 7e9beb3..1739153 100644
--- a/clutter/clutter-stage.c
+++ b/clutter/clutter-stage.c
@@ -4022,6 +4022,25 @@ _clutter_stage_has_device (ClutterStage *stage,
return g_hash_table_lookup (priv->devices, device) != NULL;
}
+void
+_clutter_stage_update_input_devices (ClutterStage *stage)
+{
+ ClutterStagePrivate *priv = stage->priv;
+ GHashTableIter iter;
+ gpointer key, value;
+
+ if (!priv->motion_events_enabled)
+ return;
+
+ g_hash_table_iter_init (&iter, priv->devices);
+ while (g_hash_table_iter_next (&iter, &key, &value))
+ {
+ ClutterInputDevice *device = key;
+
+ _clutter_input_device_update (device, TRUE);
+ }
+}
+
/**
* clutter_stage_set_motion_events_enabled:
* @stage: a #ClutterStage
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]