[mutter] gesture-tracker: Add meta_gesture_tracker_get_n_current_touches()



commit 177ec27cca10298db1997554d48f8f0f8452ffbe
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Jul 24 14:32:28 2014 +0200

    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

 src/core/meta-gesture-tracker-private.h |    1 +
 src/core/meta-gesture-tracker.c         |   11 +++++++++++
 2 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/src/core/meta-gesture-tracker-private.h b/src/core/meta-gesture-tracker-private.h
index 94625aa..6f38274 100644
--- a/src/core/meta-gesture-tracker-private.h
+++ b/src/core/meta-gesture-tracker-private.h
@@ -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 */
diff --git a/src/core/meta-gesture-tracker.c b/src/core/meta-gesture-tracker.c
index 10d9ca6..75a961c 100644
--- a/src/core/meta-gesture-tracker.c
+++ b/src/core/meta-gesture-tracker.c
@@ -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);
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]