[gtk+] colorplane: Select for touch events



commit 7192f9668c3b98c46ed1ff49050e3bc46b27cdb5
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Mar 4 11:21:36 2012 -0500

    colorplane: Select for touch events
    
    We now use long touches to trigger the popup.

 gtk/gtkcolorplane.c |   15 +++------------
 1 files changed, 3 insertions(+), 12 deletions(-)
---
diff --git a/gtk/gtkcolorplane.c b/gtk/gtkcolorplane.c
index c1ca898..33dc026 100644
--- a/gtk/gtkcolorplane.c
+++ b/gtk/gtkcolorplane.c
@@ -299,15 +299,6 @@ hold_action (GtkPressAndHold *pah,
   g_signal_emit_by_name (plane, "popup-menu", &handled);
 }
 
-static void
-tap_action (GtkPressAndHold *pah,
-            gint             x,
-            gint             y,
-            GtkColorPlane   *plane)
-{
-  update_color (plane, x, y);
-}
-
 static gboolean
 plane_touch (GtkWidget     *widget,
              GdkEventTouch *event)
@@ -331,11 +322,10 @@ plane_touch (GtkWidget     *widget,
 
       g_signal_connect (plane->priv->press_and_hold, "hold",
                         G_CALLBACK (hold_action), plane);
-      g_signal_connect (plane->priv->press_and_hold, "tap",
-                        G_CALLBACK (tap_action), plane);
     }
 
   gtk_press_and_hold_process_event (plane->priv->press_and_hold, (GdkEvent *)event);
+  update_color (plane, event->x, event->y);
 
   return TRUE;
 }
@@ -437,6 +427,7 @@ gtk_color_plane_init (GtkColorPlane *plane)
 
   gtk_widget_set_can_focus (GTK_WIDGET (plane), TRUE);
   gtk_widget_set_events (GTK_WIDGET (plane), GDK_KEY_PRESS_MASK
+                                             | GDK_TOUCH_MASK
                                              | GDK_BUTTON_PRESS_MASK
                                              | GDK_BUTTON_RELEASE_MASK
                                              | GDK_POINTER_MOTION_MASK);
@@ -481,7 +472,7 @@ gtk_color_plane_class_init (GtkColorPlaneClass *class)
   widget_class->motion_notify_event = plane_motion_notify;
   widget_class->grab_broken_event = plane_grab_broken;
   widget_class->key_press_event = plane_key_press;
-  widget_class->touch_event= plane_touch;
+  widget_class->touch_event = plane_touch;
 
   g_type_class_add_private (class, sizeof (GtkColorPlanePrivate));
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]