GtkGestureSingle

GtkGestureSingle — Base class for mouse/single-touch gestures

Properties

guint button Read / Write
gboolean exclusive Read / Write
gboolean touch-only Read / Write

Types and Values

Object Hierarchy

    GObject
    ╰── GtkEventController
        ╰── GtkGesture
            ╰── GtkGestureSingle
                ├── GtkGestureDrag
                ├── GtkGestureLongPress
                ├── GtkGestureMultiPress
                ╰── GtkGestureSwipe

Includes

#include <gtk/gtk.h>

Description

GtkGestureSingle is a subclass of GtkGesture, 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_gesture_single_get_current_sequence() while the gesture is being interacted with.

By default gestures react to both GDK_BUTTON_PRIMARY and touch events, gtk_gesture_single_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_gesture_single_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_gesture_single_get_current_button().

Functions

gtk_gesture_single_get_exclusive ()

gboolean
gtk_gesture_single_get_exclusive (GtkGestureSingle *gesture);

Gets whether a gesture is exclusive. For more information, see gtk_gesture_single_set_exclusive().

Parameters

gesture

a GtkGestureSingle

 

Returns

Whether the gesture is exclusive

Since: 3.14


gtk_gesture_single_set_exclusive ()

void
gtk_gesture_single_set_exclusive (GtkGestureSingle *gesture,
                                  gboolean 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.

Parameters

gesture

a GtkGestureSingle

 

exclusive

TRUE to make gesture exclusive

 

Since: 3.14


gtk_gesture_single_get_touch_only ()

gboolean
gtk_gesture_single_get_touch_only (GtkGestureSingle *gesture);

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

Parameters

gesture

a GtkGestureSingle

 

Returns

TRUE if the gesture only handles touch events

Since: 3.14


gtk_gesture_single_set_touch_only ()

void
gtk_gesture_single_set_touch_only (GtkGestureSingle *gesture,
                                   gboolean touch_only);

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.

Parameters

gesture

a GtkGestureSingle

 

touch_only

whether gesture handles only touch events

 

Since: 3.14


gtk_gesture_single_get_button ()

guint
gtk_gesture_single_get_button (GtkGestureSingle *gesture);

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

Parameters

gesture

a GtkGestureSingle

 

Returns

The button number, or 0 for any button

Since: 3.14


gtk_gesture_single_set_button ()

void
gtk_gesture_single_set_button (GtkGestureSingle *gesture,
                               guint 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.

Parameters

gesture

a GtkGestureSingle

 

button

button number to listen to, or 0 for any button

 

Since: 3.14


gtk_gesture_single_get_current_button ()

guint
gtk_gesture_single_get_current_button (GtkGestureSingle *gesture);

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

Parameters

gesture

a GtkGestureSingle

 

Returns

The current button number

Since: 3.14


gtk_gesture_single_get_current_sequence ()

GdkEventSequence *
gtk_gesture_single_get_current_sequence
                               (GtkGestureSingle *gesture);

Returns the event sequence currently interacting with gesture . This is only meaningful if gtk_gesture_is_active() returns TRUE.

Parameters

gesture

a GtkGestureSingle

 

Returns

the current sequence.

[nullable]

Since: 3.14

Types and Values

GtkGestureSingle

typedef struct _GtkGestureSingle GtkGestureSingle;

Property Details

The “button” property

  “button”                   guint

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

Flags: Read / Write

Default value: 1

Since: 3.14


The “exclusive” property

  “exclusive”                gboolean

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

Flags: Read / Write

Default value: FALSE

Since: 3.14


The “touch-only” property

  “touch-only”               gboolean

Whether the gesture handles only touch events.

Flags: Read / Write

Default value: FALSE

Since: 3.14