CtkGestureSingle

CtkGestureSingle — Base class for mouse/single-touch gestures

Functions

Properties

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

Types and Values

Object Hierarchy

    GObject
    ╰── CtkEventController
        ╰── CtkGesture
            ╰── CtkGestureSingle
                ├── CtkGestureDrag
                ├── CtkGestureLongPress
                ├── CtkGestureMultiPress
                ├── CtkGestureStylus
                ╰── CtkGestureSwipe

Includes

#include <ctk/ctk.h>

Description

CtkGestureSingle is a subclass of CtkGesture, 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 ctk_gesture_single_get_current_sequence() while the gesture is being interacted with.

By default gestures react to both CDK_BUTTON_PRIMARY and touch events, ctk_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 ctk_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 ctk_gesture_single_get_current_button().

Functions

ctk_gesture_single_get_exclusive ()

gboolean
ctk_gesture_single_get_exclusive (CtkGestureSingle *gesture);

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

Parameters

gesture

a CtkGestureSingle

 

Returns

Whether the gesture is exclusive

Since: 3.14


ctk_gesture_single_set_exclusive ()

void
ctk_gesture_single_set_exclusive (CtkGestureSingle *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 CtkGestureSingle

 

exclusive

TRUE to make gesture exclusive

 

Since: 3.14


ctk_gesture_single_get_touch_only ()

gboolean
ctk_gesture_single_get_touch_only (CtkGestureSingle *gesture);

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

Parameters

gesture

a CtkGestureSingle

 

Returns

TRUE if the gesture only handles touch events

Since: 3.14


ctk_gesture_single_set_touch_only ()

void
ctk_gesture_single_set_touch_only (CtkGestureSingle *gesture,
                                   gboolean touch_only);

If touch_only is TRUE, gesture will only handle events of type CDK_TOUCH_BEGIN, CDK_TOUCH_UPDATE or CDK_TOUCH_END. If FALSE, mouse events will be handled too.

Parameters

gesture

a CtkGestureSingle

 

touch_only

whether gesture handles only touch events

 

Since: 3.14


ctk_gesture_single_get_button ()

guint
ctk_gesture_single_get_button (CtkGestureSingle *gesture);

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

Parameters

gesture

a CtkGestureSingle

 

Returns

The button number, or 0 for any button

Since: 3.14


ctk_gesture_single_set_button ()

void
ctk_gesture_single_set_button (CtkGestureSingle *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 CtkGestureSingle

 

button

button number to listen to, or 0 for any button

 

Since: 3.14


ctk_gesture_single_get_current_button ()

guint
ctk_gesture_single_get_current_button (CtkGestureSingle *gesture);

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

Parameters

gesture

a CtkGestureSingle

 

Returns

The current button number

Since: 3.14


ctk_gesture_single_get_current_sequence ()

CdkEventSequence *
ctk_gesture_single_get_current_sequence
                               (CtkGestureSingle *gesture);

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

Parameters

gesture

a CtkGestureSingle

 

Returns

the current sequence.

[nullable]

Since: 3.14

Types and Values

CtkGestureSingle

typedef struct _CtkGestureSingle CtkGestureSingle;

Property Details

The “button” property

  “button”                   guint

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

Owner: CtkGestureSingle

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.

Owner: CtkGestureSingle

Flags: Read / Write

Default value: FALSE

Since: 3.14


The “touch-only” property

  “touch-only”               gboolean

Whether the gesture handles only touch events.

Owner: CtkGestureSingle

Flags: Read / Write

Default value: FALSE

Since: 3.14