summaryrefslogtreecommitdiff
path: root/gtk/gtkgesture.c
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2014-05-26 14:02:30 +0200
committerCarlos Garnacho <carlosg@gnome.org>2014-05-27 17:47:12 +0200
commitd05a9f9a7b2371b13bf9ec766482f1bb15a3853e (patch)
treeccd7f5092eeeba5af262d490fcbe5a3682906c09 /gtk/gtkgesture.c
parentad6606e8af05875e60260903c071b6cc7e135194 (diff)
downloadgtk+-d05a9f9a7b2371b13bf9ec766482f1bb15a3853e.tar.gz
gesture: Replace gtk_gesture_attach/detach with event controller API
Event controllers now auto-attach, and the GtkCapturePhase only determines when are events dispatched, but all controllers are managed by the widget wrt grabs. All callers have been updated.
Diffstat (limited to 'gtk/gtkgesture.c')
-rw-r--r--gtk/gtkgesture.c60
1 files changed, 4 insertions, 56 deletions
diff --git a/gtk/gtkgesture.c b/gtk/gtkgesture.c
index d4b400d1e2..315fffc33b 100644
--- a/gtk/gtkgesture.c
+++ b/gtk/gtkgesture.c
@@ -46,9 +46,9 @@
*
* ## Event propagation
*
- * To receive events, a gesture needs to first be attached to its widget with
- * gtk_gesture_attach(). The phase passed to this call determines at which
- * point in the event processing a gesture operates.
+ * In order to receive events, a gesture needs to either set a propagation phase
+ * through gtk_event_controller_set_propagation_phase(), or feed those manually
+ * through gtk_event_controller_handle_event().
*
* In the capture phase, events are propagated from the toplevel down to the
* target widget, and gestures that are attached to containers above the widget
@@ -56,17 +56,13 @@
*
* After the capture phase, GTK+ emits the traditional #GtkWidget::button-press,
* #GtkWidget::button-release, #GtkWidget::touch-event, etc signals. Gestures
- * with the target phase are fed events from the default #GtkWidget::event
+ * with the %GTK_PHASE_TARGET phase are fed events from the default #GtkWidget::event
* handlers.
*
* In the bubble phase, events are propagated up from the target widget to the
* toplevel, and gestures that are attached to containers above the widget get
* a chance to interact with events that have not been handled yet.
*
- * Gestures attached with the phase 'none' are not receiving any events
- * automatically, but events can be passed to them with
- * gtk_event_controller_handle_event().
- *
* ## States of a sequence # {#touch-sequence-states}
*
* Whenever input interaction happens, a single event may trigger a cascade of
@@ -1547,51 +1543,3 @@ _gtk_gesture_get_pointer_emulating_sequence (GtkGesture *gesture,
return FALSE;
}
-
-/**
- * gtk_gesture_attach:
- * @gesture: a #GtkGesture
- * @phase: phase at which events are handled
- *
- * Attaches @gesture to its widget, so @gesture is able to receive
- * and manage the events that are emitted on the #GtkWidget. This call
- * will also make sure that the gesture state is maintained properly
- * whenever input is grabbed elsewhere.
- *
- * If @phase is %GTK_PHASE_NONE, no automatical event handling will be
- * performed, but other additional gesture maintenance will. The events
- * can be managed by calling gtk_event_controller_handle_event().
- *
- * Since: 3.14
- **/
-void
-gtk_gesture_attach (GtkGesture *gesture,
- GtkPropagationPhase phase)
-{
- GtkWidget *widget;
-
- g_return_if_fail (GTK_IS_GESTURE (gesture));
- g_return_if_fail (phase >= GTK_PHASE_NONE && phase <= GTK_PHASE_TARGET);
-
- widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
- _gtk_widget_add_controller (widget, GTK_EVENT_CONTROLLER (gesture), phase);
-}
-
-/**
- * gtk_gesture_detach:
- * @gesture: a #GtkGesture
- *
- * Detaches @gesture from its widget.
- *
- * Since: 3.14
- **/
-void
-gtk_gesture_detach (GtkGesture *gesture)
-{
- GtkWidget *widget;
-
- g_return_if_fail (GTK_IS_GESTURE (gesture));
-
- widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
- _gtk_widget_remove_controller (widget, GTK_EVENT_CONTROLLER (gesture));
-}