About all my projects
Gnome::Gtk4::GestureSingle

Gnome::Gtk4::GestureSingle

Description

Gnome::Gtk4::GestureSingle is a GtkGestures subclass optimized for singe-touch and mouse gestures.

Under interaction, these gestures stick to the first interacting sequence, which is accessible through .get-current-sequence() while the gesture is being interacted with.

By default gestures react to both GDK_BUTTON_PRIMARY and touch events. .set-touch-only() can be used to change the touch behavior. Callers may also specify a different mouse button number to interact with through .set-button(), or react to any mouse button by setting it to 0. While the gesture is active, the button being currently pressed can be known through .get-current-button().

Class initialization

new

:native-object

Create an object using a native object from elsewhere. See also Gnome::N::TopLevelSupportClass.

multi method new ( N-Object :$native-object! )

Methods

get-button

Returns the button number $gesture listens for.

If this is 0, the gesture reacts to any button press.

method get-button (--> UInt )

Return value; The button number, or 0 for any button.

get-current-button

Returns the button number currently interacting with $gesture, or 0 if there is none.

method get-current-button (--> UInt )

Return value; The current button number.

get-current-sequence

Returns the event sequence currently interacting with $gesture.

This is only meaningful if .is-active() in class Gnome::Gtk4::Gesture returns True.

method get-current-sequence (--> N-Object )

Return value; the current sequence.

get-exclusive

Gets whether a gesture is exclusive.

For more information, see .set-exclusive().

method get-exclusive (--> Bool )

Return value; Whether the gesture is exclusive.

get-touch-only

Returns True if the gesture is only triggered by touch events.

method get-touch-only (--> Bool )

Return value; True if the gesture only handles touch events.

set-button

Sets the button number $gesture listens to.

If non-0, every button press from a different button number will be ignored. Touch events implicitly match with button 1.

method set-button ( UInt() $button )
  • $button; button number to listen to, or 0 for any button.

set-exclusive

Sets whether $gesture is exclusive.

An exclusive gesture will only handle pointer and "pointer emulated" touch events, so at any given time, there is only one sequence able to interact with those.

method set-exclusive ( Bool() $exclusive )
  • $exclusive; True to make $gesture exclusive.

set-touch-only

Sets whether to handle only touch events.

If $touch-only is True, $gesture will only handle events of type GDK_TOUCH_BEGIN, GDK_TOUCH_UPDATE or GDK_TOUCH_END. If False, mouse events will be handled too.

method set-touch-only ( Bool() $touch-only )
  • $touch-only; whether $gesture handles only touch events.