Commit 177ec27c authored by Carlos Garnacho's avatar Carlos Garnacho
Browse files

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
parent 37652ca2
......@@ -72,5 +72,6 @@ MetaSequenceState meta_gesture_tracker_get_sequence_state (MetaGestureTracker
ClutterEventSequence *sequence);
gboolean meta_gesture_tracker_consumes_event (MetaGestureTracker *tracker,
const ClutterEvent *event);
gint meta_gesture_tracker_get_n_current_touches (MetaGestureTracker *tracker);
#endif /* META_GESTURE_TRACKER_PRIVATE_H */
......@@ -565,3 +565,14 @@ meta_gesture_tracker_consumes_event (MetaGestureTracker *tracker,
return (event->type != CLUTTER_TOUCH_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);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment