Gtk.GestureSingle

g GObject.Object GObject.Object Gtk.EventController Gtk.EventController GObject.Object->Gtk.EventController Gtk.Gesture Gtk.Gesture Gtk.EventController->Gtk.Gesture Gtk.GestureSingle Gtk.GestureSingle Gtk.Gesture->Gtk.GestureSingle

Subclasses:

Gtk.GestureDrag, Gtk.GestureLongPress, Gtk.GestureMultiPress, Gtk.GestureStylus, Gtk.GestureSwipe

Methods

Inherited:

Gtk.Gesture (19), Gtk.EventController (5), GObject.Object (37)

Structs:

GObject.ObjectClass (5)

get_button ()

get_current_button ()

get_current_sequence ()

get_exclusive ()

get_touch_only ()

set_button (button)

set_exclusive (exclusive)

set_touch_only (touch_only)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Inherited:

Gtk.Gesture (2), Gtk.EventController (2)

Name

Type

Flags

Short Description

button

int

r/w/en

Button number to listen to

exclusive

bool

r/w/en

Whether the gesture is exclusive

touch-only

bool

r/w/en

Whether the gesture handles only touch events

Signals

Inherited:

Gtk.Gesture (5), GObject.Object (1)

Fields

Inherited:

Gtk.Gesture (5), GObject.Object (1)

Class Details

class Gtk.GestureSingle(**kwargs)
Bases:

Gtk.Gesture

Abstract:

No

Structure:

Gtk.GestureSingleClass

Gtk.GestureSingle is a subclass of Gtk.Gesture, optimized (although not restricted) for dealing with mouse and single-touch gestures. Under interaction, these gestures stick to the first interacting sequence, which is accessible through Gtk.GestureSingle.get_current_sequence() while the gesture is being interacted with.

By default gestures react to both Gdk.BUTTON_PRIMARY and touch events, Gtk.GestureSingle.set_touch_only() can be used to change the touch behavior. Callers may also specify a different mouse button number to interact with through Gtk.GestureSingle.set_button(), or react to any mouse button by setting 0. While the gesture is active, the button being currently pressed can be known through Gtk.GestureSingle.get_current_button().

get_button()[source]
Returns:

The button number, or 0 for any button

Return type:

int

Returns the button number self listens for, or 0 if self reacts to any button press.

New in version 3.14.

get_current_button()[source]
Returns:

The current button number

Return type:

int

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

New in version 3.14.

get_current_sequence()[source]
Returns:

the current sequence

Return type:

Gdk.EventSequence or None

Returns the event sequence currently interacting with self. This is only meaningful if Gtk.Gesture.is_active() returns True.

New in version 3.14.

get_exclusive()[source]
Returns:

Whether the gesture is exclusive

Return type:

bool

Gets whether a gesture is exclusive. For more information, see Gtk.GestureSingle.set_exclusive().

New in version 3.14.

get_touch_only()[source]
Returns:

True if the gesture only handles touch events

Return type:

bool

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

New in version 3.14.

set_button(button)[source]
Parameters:

button (int) – button number to listen to, or 0 for any button

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

New in version 3.14.

set_exclusive(exclusive)[source]
Parameters:

exclusive (bool) – True to make self exclusive

Sets whether self 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.

New in version 3.14.

set_touch_only(touch_only)[source]
Parameters:

touch_only (bool) – whether self handles only touch events

If touch_only is True, self will only handle events of type Gdk.EventType.TOUCH_BEGIN, Gdk.EventType.TOUCH_UPDATE or Gdk.EventType.TOUCH_END. If False, mouse events will be handled too.

New in version 3.14.

Property Details

Gtk.GestureSingle.props.button
Name:

button

Type:

int

Default Value:

1

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Mouse button number to listen to, or 0 to listen for any button.

New in version 3.14.

Gtk.GestureSingle.props.exclusive
Name:

exclusive

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the gesture is exclusive. Exclusive gestures only listen to pointer and pointer emulated events.

New in version 3.14.

Gtk.GestureSingle.props.touch_only
Name:

touch-only

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the gesture handles only touch events.

New in version 3.14.