+static void
+hold_action (GtkPressAndHold *pah,
+ gint x,
+ gint y,
+ GtkColorScale *scale)
+{
+ gboolean handled;
+
+ g_signal_emit_by_name (scale, "popup-menu", &handled);
+}
+
+static gboolean
+scale_touch (GtkWidget *widget,
+ GdkEventTouch *event)
+{
+ GtkColorScale *scale = GTK_COLOR_SCALE (widget);
+
+ if (!scale->priv->press_and_hold)
+ {
+ gint drag_threshold;
+
+ g_object_get (gtk_widget_get_settings (widget),
+ "gtk-dnd-drag-threshold", &drag_threshold,
+ NULL);
+
+ scale->priv->press_and_hold = gtk_press_and_hold_new ();
+
+ g_object_set (scale->priv->press_and_hold,
+ "drag-threshold", drag_threshold,
+ "hold-time", 1000,
+ NULL);
+
+ g_signal_connect (scale->priv->press_and_hold, "hold",
+ G_CALLBACK (hold_action), scale);
+ }
+
+ gtk_press_and_hold_process_event (scale->priv->press_and_hold, (GdkEvent *)event);
+
+ return GTK_WIDGET_CLASS (gtk_color_scale_parent_class)->touch_event (widget, event);
+}
+
+