gesture-tracker: Add meta_gesture_tracker_get_n_current_touches()

Due to the way the MetaGestureTracker processes every touch event, this
will tell as closely to Clutter as possible the current number of touches
happening on the stage.

Even though, this is subject to windowing behavior, on X11, rejected touches
will be soon followed by a XI_TouchEnd event, so the compositor will stop
seeing touch sequences that are still operating on clients. On wayland, touch
sequences are processed by the compositor during all their lifetime, so these
will stay on the MetaGestureTracker with META_SEQUENCE_PENDING_END state, yet
still tracked.

https://bugzilla.gnome.org/show_bug.cgi?id=733631
This commit is contained in:
Carlos Garnacho 2014-07-24 14:32:28 +02:00
parent 37652ca2cf
commit 177ec27cca
2 changed files with 12 additions and 0 deletions

View File

@ -72,5 +72,6 @@ MetaSequenceState meta_gesture_tracker_get_sequence_state (MetaGestureTracker
ClutterEventSequence *sequence); ClutterEventSequence *sequence);
gboolean meta_gesture_tracker_consumes_event (MetaGestureTracker *tracker, gboolean meta_gesture_tracker_consumes_event (MetaGestureTracker *tracker,
const ClutterEvent *event); const ClutterEvent *event);
gint meta_gesture_tracker_get_n_current_touches (MetaGestureTracker *tracker);
#endif /* META_GESTURE_TRACKER_PRIVATE_H */ #endif /* META_GESTURE_TRACKER_PRIVATE_H */

View File

@ -565,3 +565,14 @@ meta_gesture_tracker_consumes_event (MetaGestureTracker *tracker,
return (event->type != CLUTTER_TOUCH_END && return (event->type != CLUTTER_TOUCH_END &&
(state == META_SEQUENCE_REJECTED || state == META_SEQUENCE_PENDING_END)); (state == META_SEQUENCE_REJECTED || state == META_SEQUENCE_PENDING_END));
} }
gint
meta_gesture_tracker_get_n_current_touches (MetaGestureTracker *tracker)
{
MetaGestureTrackerPrivate *priv;
g_return_val_if_fail (META_IS_GESTURE_TRACKER (tracker), 0);
priv = meta_gesture_tracker_get_instance_private (tracker);
return g_hash_table_size (priv->sequences);
}