Package: gtk
Class gtk-gesture
Superclassesgtk-event-controller, g-object, common-lisp:standard-object, common-lisp:t Documented SubclassesDirect SlotsDetails gtk-gesture is the base object for gesture recognition, although this
object is quite generalized to serve as a base for multi-touch gestures, it
is suitable to implement single-touch and pointer-based gestures (using the special nil gdk-event-sequence value for these). The number of touches that a gtk-gesture need to be recognized is controlled by the n-points property, if a gesture is keeping track of less or more than that number of sequences, it won't check whether the gesture is recognized. As soon as the gesture has the expected number of touches, the gesture will run the "check" signal regularly on input events until the gesture is recognized, the criteria to consider a gesture as "recognized" is left to gtk-gesture subclasses. A recognized gesture will then emit the following signals:
Event propagationIn order to receive events, a gesture needs to either set a propagation phase through the function gtk-event-controller-propagation-phase, or feed those manually through the function 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 get a chance to interact with the event before it reaches the target. After the capture phase, GTK emits the traditional "button-press-event", "button-release-event", "touch-event", etc signals. Gestures with the :phase-target phase are fed events from the default "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. States of a sequenceWhenever input interaction happens, a single event may trigger a cascade of gtk-gestures, both across the parents of the widget receiving the event and in parallel within an individual widget. It is a responsibility of the widgets using those gestures to set the state of touch sequences accordingly in order to enable cooperation of gestures around the gdk-event-sequences triggering those.Within a widget, gestures can be grouped through the function gtk-gesture-group, grouped gestures synchronize the state of sequences, so calling the function gtk-gesture-set-sequence-state on one will effectively propagate the state throughout the group. By default, all sequences start out in the :none state, sequences in this state trigger the gesture event handler, but event propagation will continue unstopped by gestures. If a sequence enters into the :denied state, the gesture group will effectively ignore the sequence, letting events go unstopped through the gesture, but the "slot" will still remain occupied while the touch is active. If a sequence enters in the :claimed state, the gesture group will grab all interaction on the sequence, by:
Sequence states can't be changed freely, see gtk-gesture-set-sequence-state to know about the possible lifetimes of a gdk-event-sequence. Touchpad gesturesOn the platforms that support it, gtk-gesture will handle transparently touchpad gesture events. The only precautions users of gtk-gesture should do to enable this support are:
Signal DetailsThe "begin" signallambda (gesture sequence) :run-lastThe signal is emitted when the gesture is recognized. This means the number of touch sequences matches n-points, and the "check" handler(s) returned true. Note: These conditions may also happen when an extra touch, e.g. a third touch on a 2-touches gesture, is lifted, in that situation sequence will not pertain to the current set of active touches, so do not rely on this being true.
The "cancel" signallambda (gesture sequence) :run-lastThe signal is emitted whenever a sequence is cancelled. This usually happens on active touches when the gtk-event-controller-reset function is called on gesture, manually, due to grabs ..., or the individual sequence was claimed by controllers of the parent widgets, see the gtk-gesture-set-sequence-state) function. The gesture argument must forget everything about sequence as a reaction to the signal.
The "end" signallambda (gesture sequence) :run-lastThe signal is emitted when gesture either stopped recognizing the event sequences as something to be handled, the "check" handler returned false, or the number of touch sequences became higher or lower than n-points. Note: The sequence argument might not pertain to the group of sequences that were previously triggering recognition on gesture, i.e. a just pressed touch sequence that exceeds n-points. This situation may be detected by checking through the gtk-gesture-handles-sequence function.
The "sequence-state-changed" signallambda (gesture sequence state) :run-lastThe signal is emitted whenever a sequence state changes. See the gtk-gesture-set-sequence-state function to know more about the expectable sequence lifetimes.
The "update" signallambda (gesture sequence) :run-lastThe signal is emitted whenever an event is handled while the gesture is recognized. The sequence argument is guaranteed to pertain to the set of active touches.
| Slot Access FunctionsInherited Slot Access Functions
See also |
2020-9-10