## GtkGestureSwipe

GtkGestureSwipe — Swipe gesture

## Functions

GtkGesture * | gtk_gesture_swipe_new ()
gboolean | gtk_gesture_swipe_get_velocity ()

## Signals

void | swipe | Run Last

## Types and Values

| GtkGestureSwipe

## Object Hierarchy

        GObject
        ╰── GtkEventController
            ╰── GtkGesture
                ╰── GtkGestureSingle
                    ╰── GtkGestureSwipe

## Includes

    #include <gtk/gtk.h>

## Description

GtkGestureSwipe is a GtkGesture implementation able to recognize swipes, after a press/move/.../move/release sequence happens, the “swipe” signal will be emitted, providing the velocity and directionality of the sequence at the time it was lifted.

If the velocity is desired in intermediate points, `gtk_gesture_swipe_get_velocity()` can be called on eg. a “update” handler.

All velocities are reported in pixels/sec units.

## Functions

### gtk_gesture_swipe_new ()

    GtkGesture *
    gtk_gesture_swipe_new (GtkWidget *widget);

Returns a newly created GtkGesture that recognizes swipes.

#### Parameters

widget | a GtkWidget |

#### Returns

a newly created GtkGestureSwipe

Since: 3.14

### gtk_gesture_swipe_get_velocity ()

    gboolean
    gtk_gesture_swipe_get_velocity (GtkGestureSwipe *gesture,
                                    gdouble *velocity_x,
                                    gdouble *velocity_y);

If the gesture is recognized, this function returns `TRUE` and fill in `velocity_x` and `velocity_y` with the recorded velocity, as per the last event(s) processed.

#### Parameters

gesture | a GtkGestureSwipe |
velocity_x | return value for the velocity in the X axis, in pixels/sec. | [out]
velocity_y | return value for the velocity in the Y axis, in pixels/sec. | [out]

#### Returns

whether velocity could be calculated

Since: 3.14

## Types and Values

### GtkGestureSwipe

    typedef struct _GtkGestureSwipe GtkGestureSwipe;

## Signal Details

### The `“swipe”` signal

    void
    user_function (GtkGestureSwipe *gesture,
                   double           velocity_x,
                   double           velocity_y,
                   gpointer         user_data)

This signal is emitted when the recognized gesture is finished, velocity and direction are a product of previously recorded events.

#### Parameters

gesture | object which received the signal |
velocity_x | velocity in the X axis, in pixels/sec |
velocity_y | velocity in the Y axis, in pixels/sec |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 3.14