2013-01-17 22:57:06 +00:00
|
|
|
/* GTK - The GIMP Toolkit
|
|
|
|
* Copyright (C) 2012, One Laptop Per Child.
|
|
|
|
* Copyright (C) 2014, Red Hat, Inc.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* Author(s): Carlos Garnacho <carlosg@gnome.org>
|
|
|
|
*/
|
2014-04-09 16:28:12 +00:00
|
|
|
|
|
|
|
/**
|
2021-03-01 06:40:43 +00:00
|
|
|
* GtkGestureLongPress:
|
2014-04-09 16:28:12 +00:00
|
|
|
*
|
2021-03-01 06:40:43 +00:00
|
|
|
* `GtkGestureLongPress` is a `GtkGesture` for long presses.
|
2014-04-09 16:28:12 +00:00
|
|
|
*
|
2021-03-01 06:40:43 +00:00
|
|
|
* This gesture is also known as “Press and Hold”.
|
|
|
|
*
|
|
|
|
* When the timeout is exceeded, the gesture is triggering the
|
|
|
|
* [signal@Gtk.GestureLongPress::pressed] signal.
|
|
|
|
*
|
|
|
|
* If the touchpoint is lifted before the timeout passes, or if
|
|
|
|
* it drifts too far of the initial press point, the
|
|
|
|
* [signal@Gtk.GestureLongPress::cancelled] signal will be emitted.
|
|
|
|
*
|
|
|
|
* How long the timeout is before the ::pressed signal gets emitted is
|
|
|
|
* determined by the [property@Gtk.Settings:gtk-long-press-time] setting.
|
|
|
|
* It can be modified by the [property@Gtk.GestureLongPress:delay-factor]
|
|
|
|
* property.
|
2014-04-09 16:28:12 +00:00
|
|
|
*/
|
|
|
|
|
2013-01-17 22:57:06 +00:00
|
|
|
#include "config.h"
|
2014-05-06 02:40:18 +00:00
|
|
|
#include "gtkgesturelongpress.h"
|
|
|
|
#include "gtkgesturelongpressprivate.h"
|
2014-05-06 16:04:25 +00:00
|
|
|
#include "gtkgestureprivate.h"
|
2013-01-17 22:57:06 +00:00
|
|
|
#include "gtkmarshalers.h"
|
2020-12-25 17:57:48 +00:00
|
|
|
#include "gtkdragsourceprivate.h"
|
2013-01-17 22:57:06 +00:00
|
|
|
#include "gtkprivate.h"
|
|
|
|
#include "gtkintl.h"
|
2019-06-02 21:07:27 +00:00
|
|
|
#include "gtkmarshalers.h"
|
2013-01-17 22:57:06 +00:00
|
|
|
|
|
|
|
typedef struct _GtkGestureLongPressPrivate GtkGestureLongPressPrivate;
|
|
|
|
|
|
|
|
enum {
|
|
|
|
PRESSED,
|
|
|
|
CANCELLED,
|
|
|
|
N_SIGNALS
|
|
|
|
};
|
|
|
|
|
2015-02-22 22:48:39 +00:00
|
|
|
enum {
|
2020-12-26 08:43:08 +00:00
|
|
|
PROP_DELAY_FACTOR = 1,
|
|
|
|
LAST_PROP
|
2015-02-22 22:48:39 +00:00
|
|
|
};
|
|
|
|
|
2013-01-17 22:57:06 +00:00
|
|
|
struct _GtkGestureLongPressPrivate
|
|
|
|
{
|
2020-07-24 20:32:16 +00:00
|
|
|
double initial_x;
|
|
|
|
double initial_y;
|
2013-01-17 22:57:06 +00:00
|
|
|
|
2020-07-24 20:32:16 +00:00
|
|
|
double delay_factor;
|
2013-01-17 22:57:06 +00:00
|
|
|
guint timeout_id;
|
|
|
|
guint delay;
|
|
|
|
guint cancelled : 1;
|
|
|
|
guint triggered : 1;
|
|
|
|
};
|
|
|
|
|
|
|
|
static guint signals[N_SIGNALS] = { 0 };
|
2020-12-26 08:43:08 +00:00
|
|
|
static GParamSpec *props[LAST_PROP] = { NULL, };
|
2013-01-17 22:57:06 +00:00
|
|
|
|
2014-03-21 17:57:32 +00:00
|
|
|
G_DEFINE_TYPE_WITH_PRIVATE (GtkGestureLongPress, gtk_gesture_long_press, GTK_TYPE_GESTURE_SINGLE)
|
2013-01-17 22:57:06 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_gesture_long_press_init (GtkGestureLongPress *gesture)
|
|
|
|
{
|
2020-12-26 08:44:36 +00:00
|
|
|
GtkGestureLongPressPrivate *priv = gtk_gesture_long_press_get_instance_private (gesture);
|
2015-02-22 22:48:39 +00:00
|
|
|
priv->delay_factor = 1.0;
|
2013-01-17 22:57:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gtk_gesture_long_press_check (GtkGesture *gesture)
|
|
|
|
{
|
|
|
|
GtkGestureLongPressPrivate *priv;
|
|
|
|
|
|
|
|
priv = gtk_gesture_long_press_get_instance_private (GTK_GESTURE_LONG_PRESS (gesture));
|
|
|
|
|
|
|
|
if (priv->cancelled)
|
|
|
|
return FALSE;
|
|
|
|
|
2014-04-08 19:11:27 +00:00
|
|
|
return GTK_GESTURE_CLASS (gtk_gesture_long_press_parent_class)->check (gesture);
|
2013-01-17 22:57:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
_gtk_gesture_long_press_timeout (gpointer user_data)
|
|
|
|
{
|
|
|
|
GtkGestureLongPress *gesture = user_data;
|
|
|
|
GtkGestureLongPressPrivate *priv;
|
|
|
|
GdkEventSequence *sequence;
|
2020-07-24 20:32:16 +00:00
|
|
|
double x, y;
|
2013-01-17 22:57:06 +00:00
|
|
|
|
|
|
|
priv = gtk_gesture_long_press_get_instance_private (gesture);
|
|
|
|
sequence = gtk_gesture_get_last_updated_sequence (GTK_GESTURE (gesture));
|
|
|
|
gtk_gesture_get_point (GTK_GESTURE (gesture), sequence, &x, &y);
|
|
|
|
|
|
|
|
priv->timeout_id = 0;
|
|
|
|
priv->triggered = TRUE;
|
|
|
|
g_signal_emit (gesture, signals[PRESSED], 0, x, y);
|
|
|
|
|
2017-11-19 13:29:37 +00:00
|
|
|
return G_SOURCE_REMOVE;
|
2013-01-17 22:57:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_gesture_long_press_begin (GtkGesture *gesture,
|
|
|
|
GdkEventSequence *sequence)
|
|
|
|
{
|
|
|
|
GtkGestureLongPressPrivate *priv;
|
2020-02-16 16:09:02 +00:00
|
|
|
GdkEvent *event;
|
2017-08-25 14:47:11 +00:00
|
|
|
GdkEventType event_type;
|
2014-03-31 10:27:43 +00:00
|
|
|
GtkWidget *widget;
|
2020-07-24 13:54:49 +00:00
|
|
|
int delay;
|
2013-01-17 22:57:06 +00:00
|
|
|
|
|
|
|
priv = gtk_gesture_long_press_get_instance_private (GTK_GESTURE_LONG_PRESS (gesture));
|
2014-03-21 17:57:32 +00:00
|
|
|
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
|
2013-01-17 22:57:06 +00:00
|
|
|
event = gtk_gesture_get_last_event (gesture, sequence);
|
|
|
|
|
2017-08-25 14:47:11 +00:00
|
|
|
if (!event)
|
|
|
|
return;
|
|
|
|
|
|
|
|
event_type = gdk_event_get_event_type (event);
|
|
|
|
|
|
|
|
if (event_type != GDK_BUTTON_PRESS &&
|
|
|
|
event_type != GDK_TOUCH_BEGIN)
|
2013-01-17 22:57:06 +00:00
|
|
|
return;
|
|
|
|
|
2014-03-31 10:27:43 +00:00
|
|
|
widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
|
|
|
|
g_object_get (gtk_widget_get_settings (widget),
|
2015-02-22 22:48:39 +00:00
|
|
|
"gtk-long-press-time", &delay,
|
|
|
|
NULL);
|
|
|
|
|
2020-07-24 13:54:49 +00:00
|
|
|
delay = (int)(priv->delay_factor * delay);
|
2014-03-31 10:27:43 +00:00
|
|
|
|
2013-01-17 22:57:06 +00:00
|
|
|
gtk_gesture_get_point (gesture, sequence,
|
|
|
|
&priv->initial_x, &priv->initial_y);
|
2018-02-02 14:51:47 +00:00
|
|
|
priv->timeout_id = g_timeout_add (delay, _gtk_gesture_long_press_timeout, gesture);
|
2021-07-26 21:03:15 +00:00
|
|
|
gdk_source_set_static_name_by_id (priv->timeout_id, "[gtk] _gtk_gesture_long_press_timeout");
|
2013-01-17 22:57:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_gesture_long_press_update (GtkGesture *gesture,
|
|
|
|
GdkEventSequence *sequence)
|
|
|
|
{
|
|
|
|
GtkGestureLongPressPrivate *priv;
|
|
|
|
GtkWidget *widget;
|
2020-07-24 20:32:16 +00:00
|
|
|
double x, y;
|
2013-01-17 22:57:06 +00:00
|
|
|
|
|
|
|
widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
|
|
|
|
priv = gtk_gesture_long_press_get_instance_private (GTK_GESTURE_LONG_PRESS (gesture));
|
|
|
|
gtk_gesture_get_point (gesture, sequence, &x, &y);
|
|
|
|
|
2020-12-25 17:57:48 +00:00
|
|
|
if (gtk_drag_check_threshold_double (widget, priv->initial_x, priv->initial_y, x, y))
|
2013-01-17 22:57:06 +00:00
|
|
|
{
|
|
|
|
if (priv->timeout_id)
|
|
|
|
{
|
|
|
|
g_source_remove (priv->timeout_id);
|
|
|
|
priv->timeout_id = 0;
|
2014-04-08 19:10:43 +00:00
|
|
|
g_signal_emit (gesture, signals[CANCELLED], 0);
|
2013-01-17 22:57:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
priv->cancelled = TRUE;
|
2014-05-06 16:04:25 +00:00
|
|
|
_gtk_gesture_check (gesture);
|
2013-01-17 22:57:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_gesture_long_press_end (GtkGesture *gesture,
|
|
|
|
GdkEventSequence *sequence)
|
|
|
|
{
|
|
|
|
GtkGestureLongPressPrivate *priv;
|
|
|
|
|
|
|
|
priv = gtk_gesture_long_press_get_instance_private (GTK_GESTURE_LONG_PRESS (gesture));
|
|
|
|
|
|
|
|
if (priv->timeout_id)
|
|
|
|
{
|
|
|
|
g_source_remove (priv->timeout_id);
|
|
|
|
priv->timeout_id = 0;
|
2014-04-08 19:10:43 +00:00
|
|
|
g_signal_emit (gesture, signals[CANCELLED], 0);
|
2013-01-17 22:57:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
priv->cancelled = priv->triggered = FALSE;
|
|
|
|
}
|
|
|
|
|
2014-06-12 23:08:16 +00:00
|
|
|
static void
|
|
|
|
gtk_gesture_long_press_cancel (GtkGesture *gesture,
|
|
|
|
GdkEventSequence *sequence)
|
|
|
|
{
|
|
|
|
gtk_gesture_long_press_end (gesture, sequence);
|
|
|
|
GTK_GESTURE_CLASS (gtk_gesture_long_press_parent_class)->cancel (gesture, sequence);
|
|
|
|
}
|
|
|
|
|
2013-01-17 22:57:06 +00:00
|
|
|
static void
|
2014-03-21 17:57:32 +00:00
|
|
|
gtk_gesture_long_press_sequence_state_changed (GtkGesture *gesture,
|
|
|
|
GdkEventSequence *sequence,
|
|
|
|
GtkEventSequenceState state)
|
2013-01-17 22:57:06 +00:00
|
|
|
{
|
2014-03-21 17:57:32 +00:00
|
|
|
if (state == GTK_EVENT_SEQUENCE_DENIED)
|
2014-04-08 19:10:43 +00:00
|
|
|
gtk_gesture_long_press_end (gesture, sequence);
|
2013-01-17 22:57:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-03-21 17:57:32 +00:00
|
|
|
gtk_gesture_long_press_finalize (GObject *object)
|
2013-01-17 22:57:06 +00:00
|
|
|
{
|
|
|
|
GtkGestureLongPressPrivate *priv;
|
|
|
|
|
2014-03-21 17:57:32 +00:00
|
|
|
priv = gtk_gesture_long_press_get_instance_private (GTK_GESTURE_LONG_PRESS (object));
|
2013-01-17 22:57:06 +00:00
|
|
|
|
2014-03-21 17:57:32 +00:00
|
|
|
if (priv->timeout_id)
|
|
|
|
g_source_remove (priv->timeout_id);
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (gtk_gesture_long_press_parent_class)->finalize (object);
|
2013-01-17 22:57:06 +00:00
|
|
|
}
|
|
|
|
|
2015-02-22 22:48:39 +00:00
|
|
|
static void
|
|
|
|
gtk_gesture_long_press_get_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
switch (property_id)
|
|
|
|
{
|
|
|
|
case PROP_DELAY_FACTOR:
|
2019-08-07 12:09:33 +00:00
|
|
|
g_value_set_double (value, gtk_gesture_long_press_get_delay_factor (GTK_GESTURE_LONG_PRESS (object)));
|
2015-02-22 22:48:39 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_gesture_long_press_set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
switch (property_id)
|
|
|
|
{
|
|
|
|
case PROP_DELAY_FACTOR:
|
2019-08-07 12:09:33 +00:00
|
|
|
gtk_gesture_long_press_set_delay_factor (GTK_GESTURE_LONG_PRESS (object),
|
|
|
|
g_value_get_double (value));
|
2015-02-22 22:48:39 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-17 22:57:06 +00:00
|
|
|
static void
|
|
|
|
gtk_gesture_long_press_class_init (GtkGestureLongPressClass *klass)
|
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
GtkGestureClass *gesture_class = GTK_GESTURE_CLASS (klass);
|
|
|
|
|
|
|
|
object_class->finalize = gtk_gesture_long_press_finalize;
|
2015-02-22 22:48:39 +00:00
|
|
|
object_class->get_property = gtk_gesture_long_press_get_property;
|
|
|
|
object_class->set_property = gtk_gesture_long_press_set_property;
|
2013-01-17 22:57:06 +00:00
|
|
|
|
|
|
|
gesture_class->check = gtk_gesture_long_press_check;
|
|
|
|
gesture_class->begin = gtk_gesture_long_press_begin;
|
|
|
|
gesture_class->update = gtk_gesture_long_press_update;
|
|
|
|
gesture_class->end = gtk_gesture_long_press_end;
|
2014-06-12 23:08:16 +00:00
|
|
|
gesture_class->cancel = gtk_gesture_long_press_cancel;
|
2015-02-22 22:48:39 +00:00
|
|
|
gesture_class->sequence_state_changed = gtk_gesture_long_press_sequence_state_changed;
|
|
|
|
|
2021-03-01 06:40:43 +00:00
|
|
|
/**
|
|
|
|
* GtkGestureLongPress:delay-factor: (attributes org.gtk.Property.get=gtk_gesture_long_press_get_delay_factor org.gtk.Property.set=gtk_gesture_long_press_set_delay_factor)
|
|
|
|
*
|
|
|
|
* Factor by which to modify the default timeout.
|
|
|
|
*/
|
2020-12-26 08:43:08 +00:00
|
|
|
props[PROP_DELAY_FACTOR] =
|
2022-05-11 12:19:39 +00:00
|
|
|
g_param_spec_double ("delay-factor", NULL, NULL,
|
2020-12-26 08:43:08 +00:00
|
|
|
0.5, 2.0, 1.0,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
|
|
|
|
|
|
|
|
g_object_class_install_properties (object_class, LAST_PROP, props);
|
2013-01-17 22:57:06 +00:00
|
|
|
|
2014-04-09 16:28:12 +00:00
|
|
|
/**
|
2014-04-10 11:43:41 +00:00
|
|
|
* GtkGestureLongPress::pressed:
|
2014-04-09 16:28:12 +00:00
|
|
|
* @gesture: the object which received the signal
|
|
|
|
* @x: the X coordinate where the press happened, relative to the widget allocation
|
|
|
|
* @y: the Y coordinate where the press happened, relative to the widget allocation
|
|
|
|
*
|
2021-03-01 06:40:43 +00:00
|
|
|
* Emitted whenever a press goes unmoved/unreleased longer than
|
2020-09-12 16:01:04 +00:00
|
|
|
* what the GTK defaults tell.
|
2014-04-09 16:28:12 +00:00
|
|
|
*/
|
2013-01-17 22:57:06 +00:00
|
|
|
signals[PRESSED] =
|
2015-09-12 13:13:00 +00:00
|
|
|
g_signal_new (I_("pressed"),
|
2013-01-17 22:57:06 +00:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GtkGestureLongPressClass, pressed),
|
2019-06-02 21:07:27 +00:00
|
|
|
NULL, NULL,
|
|
|
|
_gtk_marshal_VOID__DOUBLE_DOUBLE,
|
2013-01-17 22:57:06 +00:00
|
|
|
G_TYPE_NONE, 2, G_TYPE_DOUBLE, G_TYPE_DOUBLE);
|
2019-06-02 21:07:27 +00:00
|
|
|
g_signal_set_va_marshaller (signals[PRESSED],
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
_gtk_marshal_VOID__DOUBLE_DOUBLEv);
|
2021-03-01 06:40:43 +00:00
|
|
|
|
2014-04-09 16:28:12 +00:00
|
|
|
/**
|
2014-04-10 11:43:41 +00:00
|
|
|
* GtkGestureLongPress::cancelled:
|
2014-04-09 16:28:12 +00:00
|
|
|
* @gesture: the object which received the signal
|
|
|
|
*
|
2021-03-01 06:40:43 +00:00
|
|
|
* Emitted whenever a press moved too far, or was released
|
|
|
|
* before [signal@Gtk.GestureLongPress::pressed] happened.
|
2014-04-09 16:28:12 +00:00
|
|
|
*/
|
2013-01-17 22:57:06 +00:00
|
|
|
signals[CANCELLED] =
|
2015-09-12 13:13:00 +00:00
|
|
|
g_signal_new (I_("cancelled"),
|
2013-01-17 22:57:06 +00:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GtkGestureLongPressClass, cancelled),
|
|
|
|
NULL, NULL, NULL,
|
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_gesture_long_press_new:
|
|
|
|
*
|
2021-03-01 06:40:43 +00:00
|
|
|
* Returns a newly created `GtkGesture` that recognizes long presses.
|
2013-01-17 22:57:06 +00:00
|
|
|
*
|
2021-03-01 06:40:43 +00:00
|
|
|
* Returns: a newly created `GtkGestureLongPress`.
|
|
|
|
*/
|
2013-01-17 22:57:06 +00:00
|
|
|
GtkGesture *
|
2018-03-09 05:36:22 +00:00
|
|
|
gtk_gesture_long_press_new (void)
|
2013-01-17 22:57:06 +00:00
|
|
|
{
|
|
|
|
return g_object_new (GTK_TYPE_GESTURE_LONG_PRESS,
|
|
|
|
NULL);
|
|
|
|
}
|
2019-08-07 12:09:33 +00:00
|
|
|
|
|
|
|
/**
|
2021-03-01 06:40:43 +00:00
|
|
|
* gtk_gesture_long_press_set_delay_factor: (attributes org.gtk.Method.set_property=delay-factor)
|
|
|
|
* @gesture: A `GtkGestureLongPress`
|
2019-08-07 12:09:33 +00:00
|
|
|
* @delay_factor: The delay factor to apply
|
|
|
|
*
|
2021-03-01 06:40:43 +00:00
|
|
|
* Applies the given delay factor.
|
|
|
|
*
|
|
|
|
* The default long press time will be multiplied by this value.
|
|
|
|
* Valid values are in the range [0.5..2.0].
|
2019-08-07 12:09:33 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gtk_gesture_long_press_set_delay_factor (GtkGestureLongPress *gesture,
|
|
|
|
double delay_factor)
|
|
|
|
{
|
|
|
|
GtkGestureLongPressPrivate *priv = gtk_gesture_long_press_get_instance_private (gesture);
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_GESTURE_LONG_PRESS (gesture));
|
|
|
|
g_return_if_fail (delay_factor >= 0.5);
|
|
|
|
g_return_if_fail (delay_factor <= 2.0);
|
|
|
|
|
2020-12-26 08:43:08 +00:00
|
|
|
if (delay_factor == priv->delay_factor)
|
|
|
|
return;
|
|
|
|
|
2019-08-07 12:09:33 +00:00
|
|
|
priv->delay_factor = delay_factor;
|
|
|
|
|
2020-12-26 08:43:08 +00:00
|
|
|
g_object_notify_by_pspec (G_OBJECT (gesture), props[PROP_DELAY_FACTOR]);
|
2019-08-07 12:09:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-03-01 06:40:43 +00:00
|
|
|
* gtk_gesture_long_press_get_delay_factor: (attributes org.gtk.Method.get_property=delay-factor)
|
|
|
|
* @gesture: A `GtkGestureLongPress`
|
2019-08-07 12:09:33 +00:00
|
|
|
*
|
2021-03-01 06:40:43 +00:00
|
|
|
* Returns the delay factor.
|
2020-04-20 02:50:35 +00:00
|
|
|
*
|
|
|
|
* Returns: the delay factor
|
2019-08-07 12:09:33 +00:00
|
|
|
*/
|
|
|
|
double
|
|
|
|
gtk_gesture_long_press_get_delay_factor (GtkGestureLongPress *gesture)
|
|
|
|
{
|
|
|
|
GtkGestureLongPressPrivate *priv = gtk_gesture_long_press_get_instance_private (gesture);
|
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_GESTURE_LONG_PRESS (gesture), 0);
|
|
|
|
|
|
|
|
return priv->delay_factor;
|
|
|
|
}
|