diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2014-03-03 14:08:45 +0100 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2014-05-23 19:54:22 +0200 |
commit | a9fa0151f1c30f77134e31ac260afa17aa3b273f (patch) | |
tree | 6b1d08a74e4eb4bb003c635b734b11f37d5df3a1 /gtk/gtkgesture.h | |
parent | 4ec1fafe2fe91bbdee9107f52b12958dca257af2 (diff) | |
download | gtk+-a9fa0151f1c30f77134e31ac260afa17aa3b273f.tar.gz |
widget: Implement hierarchy-level mechanism to claim/deny sequences
The policy of sequence states has been made tighter on GtkGesture,
so gestures can never return to a "none" state, nor get out of a
"denied" state, a "claimed" sequence can go "denied" though.
The helper API at the widget level will first emit
GtkWidget::sequence-state-changed on the called widget, and then
notify through the same signal to every other widget in the captured
event chain. So the effect of that signal is twofold, on one hand
it lets the original widget set the state on its attached controllers,
and on the other hand it lets the other widgets freely adapt to the
sequence state changing elsewhere in the event widget chain.
By default, that signal updates every controller on the first usecase,
and propagates the default gesture policy to every other widget in the
chain on the second. This means that, by default:
1) Sequences start out on the "none" state, and get propagated through
all the event widget chain.
2) If a widget in the chain denies the sequence, all other widgets are
unaffected.
3) If a widget in the chain claims the sequence, then:
3.1) Every widget below the claiming widget (ie. towards the event widget)
will get the sequence cancelled.
3.2) Every widget above the claiming widget that had the sequence as "none"
will remain as such, if it was claimed it will go denied, but that should
rarely happen.
This behavior can be tweaked through the GtkWidget::sequence-state-changed and
GtkGesture::event-handled vmethods, although this should be very rarely done.
Diffstat (limited to 'gtk/gtkgesture.h')
-rw-r--r-- | gtk/gtkgesture.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gtk/gtkgesture.h b/gtk/gtkgesture.h index a9296c73fa..1d28000987 100644 --- a/gtk/gtkgesture.h +++ b/gtk/gtkgesture.h @@ -57,6 +57,9 @@ struct _GtkGestureClass void (* end) (GtkGesture *gesture, GdkEventSequence *sequence); + void (* cancel) (GtkGesture *gesture, + GdkEventSequence *sequence); + void (* sequence_state_changed) (GtkGesture *gesture, GdkEventSequence *sequence, GtkEventSequenceState state); @@ -89,7 +92,9 @@ GdkEventSequence * gtk_gesture_get_last_updated_sequence GDK_AVAILABLE_IN_3_14 gboolean gtk_gesture_handles_sequence (GtkGesture *gesture, GdkEventSequence *sequence); - +GDK_AVAILABLE_IN_3_14 +gboolean gtk_gesture_cancel_sequence (GtkGesture *gesture, + GdkEventSequence *sequence); GDK_AVAILABLE_IN_3_14 const GdkEvent * gtk_gesture_get_last_event (GtkGesture *gesture, |