[gtk+/gestures: 14/20] widget: Add widget-level handling of touch sequence state.
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gestures: 14/20] widget: Add widget-level handling of touch sequence state.
- Date: Mon, 3 Mar 2014 21:00:31 +0000 (UTC)
commit a7eba9f79f3596d0169efdedc2b9ff05bb3a5866
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Feb 26 13:07:08 2014 +0100
widget: Add widget-level handling of touch sequence state.
These functions ATM do nothing but proxying the controller(s) state
with the given sequence.
gtk/gtkwidget.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
gtk/gtkwidget.h | 8 +++++++
2 files changed, 70 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 83e3c06..6b7563e 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -16407,3 +16407,65 @@ gtk_widget_list_controllers (GtkWidget *widget,
return retval;
}
+
+GtkEventSequenceState
+gtk_widget_get_sequence_state (GtkWidget *widget,
+ GdkEventSequence *sequence)
+{
+ GtkEventSequenceState state;
+ EventControllerData *data;
+ GtkWidgetPrivate *priv;
+ GList *l;
+
+ g_return_val_if_fail (GTK_IS_WIDGET (widget),
+ GTK_EVENT_SEQUENCE_NONE);
+
+ priv = widget->priv;
+
+ for (l = priv->event_controllers; l; l = l->next)
+ {
+ data = l->data;
+
+ if (!GTK_IS_GESTURE (data->controller))
+ continue;
+
+ state = gtk_gesture_get_sequence_state (GTK_GESTURE (data->controller),
+ sequence);
+ if (state != GTK_EVENT_SEQUENCE_NONE)
+ return state;
+ }
+
+ return GTK_EVENT_SEQUENCE_NONE;
+}
+
+void
+gtk_widget_set_sequence_state (GtkWidget *widget,
+ GdkEventSequence *sequence,
+ GtkEventSequenceState state)
+{
+ EventControllerData *data;
+ gboolean handled = FALSE;
+ GtkWidgetPrivate *priv;
+ GList *l;
+
+ g_return_val_if_fail (GTK_IS_WIDGET (widget),
+ GTK_EVENT_SEQUENCE_NONE);
+
+ priv = widget->priv;
+
+ for (l = priv->event_controllers; l; l = l->next)
+ {
+ data = l->data;
+
+ if (!GTK_IS_GESTURE (data->controller))
+ continue;
+
+ handled |= gtk_gesture_set_sequence_state (GTK_GESTURE (data->controller),
+ sequence, state);
+ }
+
+ if (!handled)
+ return;
+
+ /* FIXME: Propagate upwards/downwards */
+}
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index a839c44..b6d1559 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -1480,6 +1480,14 @@ GDK_AVAILABLE_IN_3_14
GList * gtk_widget_list_controllers (GtkWidget *widget,
GtkPropagationPhase phase);
+GDK_AVAILABLE_IN_3_14
+GtkEventSequenceState gtk_widget_get_sequence_state (GtkWidget *widget,
+ GdkEventSequence *sequence);
+GDK_AVAILABLE_IN_3_14
+void gtk_widget_set_sequence_state (GtkWidget *widget,
+ GdkEventSequence *sequence,
+ GtkEventSequenceState state);
+
G_END_DECLS
#endif /* __GTK_WIDGET_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]