From 805fa78221efef8bcdbbd8083bd9f7c5492b2914 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 7 Jun 2015 12:45:34 -0400 Subject: [PATCH] GtkTextHandle: add a drag-started signal This will be used to discriminate drags from taps. --- gtk/gtktexthandle.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gtk/gtktexthandle.c b/gtk/gtktexthandle.c index 07a9569603..c816ff2f45 100644 --- a/gtk/gtktexthandle.c +++ b/gtk/gtktexthandle.c @@ -29,6 +29,7 @@ typedef struct _GtkTextHandlePrivate GtkTextHandlePrivate; typedef struct _HandleWindow HandleWindow; enum { + DRAG_STARTED, HANDLE_DRAGGED, DRAG_FINISHED, LAST_SIGNAL @@ -214,6 +215,7 @@ gtk_text_handle_widget_event (GtkWidget *widget, priv->windows[pos].dy = event->button.y; priv->windows[pos].dragged = TRUE; gtk_text_handle_set_state (handle, pos, GTK_STATE_FLAG_ACTIVE); + g_signal_emit (handle, signals[DRAG_STARTED], 0, pos); } else if (event->type == GDK_BUTTON_RELEASE) { @@ -647,6 +649,14 @@ _gtk_text_handle_class_init (GtkTextHandleClass *klass) G_TYPE_NONE, 3, GTK_TYPE_TEXT_HANDLE_POSITION, G_TYPE_INT, G_TYPE_INT); + signals[DRAG_STARTED] = + g_signal_new (I_("drag-started"), + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, 0, + NULL, NULL, + g_cclosure_marshal_VOID__ENUM, + G_TYPE_NONE, 1, + GTK_TYPE_TEXT_HANDLE_POSITION); signals[DRAG_FINISHED] = g_signal_new (I_("drag-finished"), G_OBJECT_CLASS_TYPE (object_class),