summaryrefslogtreecommitdiff
path: root/gtk/gtkgesturelongpress.c
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2014-03-31 12:27:43 +0200
committerCarlos Garnacho <carlosg@gnome.org>2014-05-23 19:54:24 +0200
commitcdcc536ddc8ab564d93e4c389ca7cbac2caa09fa (patch)
tree01e2ae112a4b11bd80f4f93138aa69da4ecec1eb /gtk/gtkgesturelongpress.c
parent1403ebb09704bab96ecd70a9c0e664f9b0e5ba19 (diff)
downloadgtk+-cdcc536ddc8ab564d93e4c389ca7cbac2caa09fa.tar.gz
longpress: Use xsettings to determine long press duration
GtkSettings::gtk-long-press-time is used to this effect.
Diffstat (limited to 'gtk/gtkgesturelongpress.c')
-rw-r--r--gtk/gtkgesturelongpress.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gtk/gtkgesturelongpress.c b/gtk/gtkgesturelongpress.c
index 7c67fc1548..72637765a0 100644
--- a/gtk/gtkgesturelongpress.c
+++ b/gtk/gtkgesturelongpress.c
@@ -24,8 +24,6 @@
#include "gtkprivate.h"
#include "gtkintl.h"
-#define DEFAULT_TRIGGER_DELAY 500
-
typedef struct _GtkGestureLongPressPrivate GtkGestureLongPressPrivate;
enum {
@@ -92,6 +90,8 @@ gtk_gesture_long_press_begin (GtkGesture *gesture,
{
GtkGestureLongPressPrivate *priv;
const GdkEvent *event;
+ GtkWidget *widget;
+ gint delay;
priv = gtk_gesture_long_press_get_instance_private (GTK_GESTURE_LONG_PRESS (gesture));
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
@@ -102,10 +102,14 @@ gtk_gesture_long_press_begin (GtkGesture *gesture,
event->type != GDK_TOUCH_BEGIN))
return;
+ widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
+ g_object_get (gtk_widget_get_settings (widget),
+ "gtk-long-press-time", &delay, NULL);
+
gtk_gesture_get_point (gesture, sequence,
&priv->initial_x, &priv->initial_y);
priv->timeout_id =
- gdk_threads_add_timeout (DEFAULT_TRIGGER_DELAY,
+ gdk_threads_add_timeout (delay,
_gtk_gesture_long_press_timeout,
gesture);
}