[]Struct gtk::Gesture

pub struct Gesture(_, _);

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 None gdk::EventSequence value for these).

The number of touches that a Gesture need to be recognized is controlled by the Gesture:n-points property, if a gesture is keeping track of less or more than that number of sequences, it won't check wether the gesture is recognized.

As soon as the gesture has the expected number of touches, the gesture will run the Gesture::check signal regularly on input events until the gesture is recognized, the criteria to consider a gesture as "recognized" is left to Gesture subclasses.

A recognized gesture will then emit the following signals:

Event propagation

In order to receive events, a gesture needs to either set a propagation phase through EventControllerExt::set_propagation_phase, or feed those manually through EventControllerExt::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 Widget::button-press-event, Widget::button-release-event, Widget::touch-event, etc signals. Gestures with the PropagationPhase::Target phase are fed events from the default Widget::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 sequence # {touch-sequence-states}

Whenever input interaction happens, a single event may trigger a cascade of GtkGestures, 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 GdkEventSequences triggering those.

Within a widget, gestures can be grouped through GestureExt::group, grouped gestures synchronize the state of sequences, so calling GestureExt::set_sequence_state on one will effectively propagate the state throughout the group.

By default, all sequences start out in the EventSequenceState::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 EventSequenceState::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 EventSequenceState::Claimed state, the gesture group will grab all interaction on the sequence, by:

Note: if a sequence is set early to EventSequenceState::Claimed on gdk::EventType::TouchBegin/gdk::EventType::ButtonPress (so those events are captured before reaching the event widget, this implies PropagationPhase::Capture), one similar event will emulated if the sequence changes to EventSequenceState::Denied. This way event coherence is preserved before event propagation is unstopped again.

Sequence states can't be changed freely, see GestureExt::set_sequence_state to know about the possible lifetimes of a gdk::EventSequence.

Touchpad gestures

On the platforms that support it, Gesture will handle transparently touchpad gesture events. The only precautions users of Gesture should do to enable this support are:

Implements

GestureExt, EventControllerExt, glib::object::ObjectExt

Trait Implementations

impl Clone for Gesture

impl Debug for Gesture

impl Display for Gesture[src]

impl Eq for Gesture

impl Hash for Gesture

impl IsA<EventController> for Gesture

impl IsA<Gesture> for GestureDrag

impl IsA<Gesture> for GestureLongPress

impl IsA<Gesture> for GestureMultiPress

impl IsA<Gesture> for GesturePan

impl IsA<Gesture> for GestureRotate

impl IsA<Gesture> for GestureSingle

impl IsA<Gesture> for GestureStylus

impl IsA<Gesture> for GestureSwipe

impl IsA<Gesture> for GestureZoom

impl Ord for Gesture

impl<T: ObjectType> PartialEq<T> for Gesture

impl<T: ObjectType> PartialOrd<T> for Gesture

impl StaticType for Gesture

Auto Trait Implementations

impl RefUnwindSafe for Gesture

impl !Send for Gesture

impl !Sync for Gesture

impl Unpin for Gesture

impl UnwindSafe for Gesture

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Super, Sub> CanDowncast<Sub> for Super where
    Sub: IsA<Super>,
    Super: IsA<Super>, 

impl<T> Cast for T where
    T: ObjectType, 

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ObjectExt for T where
    T: ObjectType, 

impl<'a, T> ToGlibContainerFromSlice<'a, *const GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *const GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<Array>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToSendValue for T where
    T: ToValue + SetValue + Send + ?Sized

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToValue for T where
    T: SetValue + ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.