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