[gtk+/gestures: 49/117] widget: Add gtk_widget_set_gesture_state()



commit 818c604af81e7fd0afadc8c2b30b54d1d890bd2f
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Mar 26 10:49:21 2014 +0100

    widget: Add gtk_widget_set_gesture_state()
    
    This helper function ensures the state is propagated for
    all the active sequences in the given gesture.

 gtk/gtkwidget.c |   21 +++++++++++++++++++++
 gtk/gtkwidget.h |    4 ++++
 2 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 7c8c28b..e422b13 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -16773,3 +16773,24 @@ gtk_widget_set_sequence_state (GtkWidget             *widget,
       event_widget = gtk_widget_get_parent (event_widget);
     }
 }
+
+void
+gtk_widget_set_gesture_state (GtkWidget             *widget,
+                              GtkGesture            *gesture,
+                              GtkEventSequenceState  state)
+{
+  GList *gestures, *l;
+
+  g_return_if_fail (GTK_IS_WIDGET (widget));
+  g_return_if_fail (GTK_IS_GESTURE (gesture));
+  g_return_if_fail (state >= GTK_EVENT_SEQUENCE_NONE &&
+                    state <= GTK_EVENT_SEQUENCE_DENIED);
+  g_return_if_fail (_gtk_widget_has_gesture (widget, gesture));
+
+  gestures = gtk_gesture_get_sequences (gesture);
+
+  for (l = gestures; l; l = l->next)
+    gtk_widget_set_sequence_state (widget, l->data, state);
+
+  g_list_free (gestures);
+}
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index bad8950..685a4c2 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -1488,6 +1488,10 @@ GDK_AVAILABLE_IN_3_14
 void                  gtk_widget_set_sequence_state     (GtkWidget             *widget,
                                                          GdkEventSequence      *sequence,
                                                          GtkEventSequenceState  state);
+GDK_AVAILABLE_IN_3_14
+void                  gtk_widget_set_gesture_state      (GtkWidget             *widget,
+                                                         GtkGesture            *gesture,
+                                                         GtkEventSequenceState  state);
 
 G_END_DECLS
 


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