[gtk+/gestures: 30/173] gesture: Limit API calls to non-denied sequences



commit b12e4ea7d738538ffa717e49a3e44256cff98dad
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Mar 21 18:09:38 2014 +0100

    gesture: Limit API calls to non-denied sequences
    
    Gestures do track those internally, but information about those
    shouldn't be leaked on calls.

 gtk/gtkgesture.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkgesture.c b/gtk/gtkgesture.c
index e1ba100..c24fc59 100644
--- a/gtk/gtkgesture.c
+++ b/gtk/gtkgesture.c
@@ -915,13 +915,9 @@ gtk_gesture_get_bounding_box_center (GtkGesture *gesture,
 gboolean
 gtk_gesture_is_active (GtkGesture *gesture)
 {
-  GtkGesturePrivate *priv;
-
   g_return_val_if_fail (GTK_IS_GESTURE (gesture), FALSE);
 
-  priv = gtk_gesture_get_instance_private (gesture);
-
-  return g_hash_table_size (priv->points) != 0;
+  return _gtk_gesture_effective_n_points (gesture) != 0;
 }
 
 /**
@@ -989,12 +985,20 @@ gtk_gesture_handles_sequence (GtkGesture       *gesture,
                               GdkEventSequence *sequence)
 {
   GtkGesturePrivate *priv;
+  PointData *data;
 
   g_return_val_if_fail (GTK_IS_GESTURE (gesture), FALSE);
 
   priv = gtk_gesture_get_instance_private (gesture);
+  data = g_hash_table_lookup (priv->points, sequence);
 
-  return g_hash_table_contains (priv->points, sequence);
+  if (!data)
+    return FALSE;
+
+  if (data->state == GTK_EVENT_SEQUENCE_DENIED)
+    return FALSE;
+
+  return TRUE;
 }
 
 /**


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