GtkGestureMultiPress

GtkGestureMultiPress — Multipress gesture

Functions

Signals

Types and Values

Object Hierarchy

    GObject
    ╰── GtkEventController
        ╰── GtkGesture
            ╰── GtkGestureSingle
                ╰── GtkGestureMultiPress

Includes

#include <gtk/gtk.h>

Description

GtkGestureMultiPress is a GtkGesture implementation able to recognize multiple clicks on a nearby zone, which can be listened for through the “pressed” signal. Whenever time or distance between clicks exceed the GTK+ defaults, “stopped” is emitted, and the click counter is reset.

Callers may also restrict the area that is considered valid for a >1 touch/button press through gtk_gesture_multi_press_set_area(), so any click happening outside that area is considered to be a first click of its own.

Functions

gtk_gesture_multi_press_new ()

GtkGesture *
gtk_gesture_multi_press_new (GtkWidget *widget);

Returns a newly created GtkGesture that recognizes single and multiple presses.

Parameters

widget

a GtkWidget

 

Returns

a newly created GtkGestureMultiPress

Since: 3.14


gtk_gesture_multi_press_set_area ()

void
gtk_gesture_multi_press_set_area (GtkGestureMultiPress *gesture,
                                  const GdkRectangle *rect);

If rect is non-NULL, the press area will be checked to be confined within the rectangle, otherwise the button count will be reset so the press is seen as being the first one. If rect is NULL, the area will be reset to an unrestricted state.

Note: The rectangle is only used to determine whether any non-first click falls within the expected area. This is not akin to an input shape.

Parameters

gesture

a GtkGestureMultiPress

 

rect

rectangle to receive coordinates on.

[allow-none]

Since: 3.14


gtk_gesture_multi_press_get_area ()

gboolean
gtk_gesture_multi_press_get_area (GtkGestureMultiPress *gesture,
                                  GdkRectangle *rect);

If an area was set through gtk_gesture_multi_press_set_area(), this function will return TRUE and fill in rect with the press area. See gtk_gesture_multi_press_set_area() for more details on what the press area represents.

Parameters

gesture

a GtkGestureMultiPress

 

rect

return location for the press area.

[out]

Returns

TRUE if rect was filled with the press area

Since: 3.14

Types and Values

GtkGestureMultiPress

typedef struct _GtkGestureMultiPress GtkGestureMultiPress;

Signal Details

The “pressed” signal

void
user_function (GtkGestureMultiPress *gesture,
               int                   n_press,
               double                x,
               double                y,
               gpointer              user_data)

This signal is emitted whenever a button or touch press happens.

Parameters

gesture

the object which received the signal

 

n_press

how many touch/button presses happened with this one

 

x

The X coordinate, in widget allocation coordinates

 

y

The Y coordinate, in widget allocation coordinates

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 3.14


The “released” signal

void
user_function (GtkGestureMultiPress *gesture,
               int                   n_press,
               double                x,
               double                y,
               gpointer              user_data)

This signal is emitted when a button or touch is released. n_press will report the number of press that is paired to this event, note that “stopped” may have been emitted between the press and its release, n_press will only start over at the next press.

Parameters

gesture

the object which received the signal

 

n_press

number of press that is paired with this release

 

x

The X coordinate, in widget allocation coordinates

 

y

The Y coordinate, in widget allocation coordinates

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 3.14


The “stopped” signal

void
user_function (GtkGestureMultiPress *gesture,
               gpointer              user_data)

This signal is emitted whenever any time/distance threshold has been exceeded.

Parameters

gesture

the object which received the signal

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 3.14