[gtk+/multitouch: 41/48] gtk: Add a GdkDevice parameter to ::press-and-hold



commit a660b7709c802f94a25247cb7bbd8fd3ab9ff5a5
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Nov 1 12:30:40 2011 +0100

    gtk: Add a GdkDevice parameter to ::press-and-hold
    
    This would be useful when popping up menus, just so we
    know what device to trigger it for.

 gtk/gtkmarshalers.list   |    2 +-
 gtk/gtkwidget.c          |   11 ++++++++---
 gtk/gtkwidget.h          |    1 +
 tests/testpressandhold.c |    9 +++++----
 4 files changed, 15 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkmarshalers.list b/gtk/gtkmarshalers.list
index e45f1ec..8437151 100644
--- a/gtk/gtkmarshalers.list
+++ b/gtk/gtkmarshalers.list
@@ -27,7 +27,6 @@ BOOLEAN:ENUM
 BOOLEAN:ENUM,BOOLEAN
 BOOLEAN:ENUM,DOUBLE
 BOOLEAN:ENUM,INT
-BOOLEAN:ENUM,INT,INT
 BOOLEAN:OBJECT
 BOOLEAN:OBJECT,UINT,FLAGS
 BOOLEAN:OBJECT,INT,INT,UINT
@@ -37,6 +36,7 @@ BOOLEAN:OBJECT,BOXED,BOXED
 BOOLEAN:OBJECT,OBJECT,OBJECT
 BOOLEAN:OBJECT,STRING,STRING
 BOOLEAN:OBJECT,ENUM
+BOOLEAN:OBJECT,ENUM,INT,INT
 BOOLEAN:INT
 BOOLEAN:INT,INT
 BOOLEAN:INT,INT,INT
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 414851d..324cf2c 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -3147,8 +3147,9 @@ gtk_widget_class_init (GtkWidgetClass *klass)
 		  G_SIGNAL_RUN_LAST,
 		  G_STRUCT_OFFSET (GtkWidgetClass, press_and_hold),
 		  _gtk_boolean_handled_accumulator, NULL,
-		  _gtk_marshal_BOOLEAN__ENUM_INT_INT,
-		  G_TYPE_BOOLEAN, 3,
+		  _gtk_marshal_BOOLEAN__OBJECT_ENUM_INT_INT,
+		  G_TYPE_BOOLEAN, 4,
+		  GDK_TYPE_DEVICE,
 		  GTK_TYPE_PRESS_AND_HOLD_ACTION,
 		  G_TYPE_INT,
 		  G_TYPE_INT);
@@ -6956,6 +6957,7 @@ gtk_widget_press_and_hold_cancel (GtkWidget *widget)
 
   g_signal_emit (widget, widget_signals[PRESS_AND_HOLD],
                  0,
+                 data->device,
                  GTK_PRESS_AND_HOLD_CANCEL,
                  -1, -1,
                  &return_value);
@@ -7044,6 +7046,7 @@ gtk_widget_press_and_hold_timeout (gpointer user_data)
   /* Done, clean up and emit the trigger signal */
   g_signal_emit (widget, widget_signals[PRESS_AND_HOLD],
                  0,
+                 data->device,
                  GTK_PRESS_AND_HOLD_TRIGGER,
                  data->current_x, data->current_y,
                  &return_value);
@@ -7142,6 +7145,7 @@ gtk_widget_press_and_hold_begin_animation_timeout (gpointer user_data)
 
 static gboolean
 gtk_widget_press_and_hold_query (GtkWidget *widget,
+                                 GdkDevice *device,
                                  gint       x,
                                  gint       y)
 {
@@ -7149,6 +7153,7 @@ gtk_widget_press_and_hold_query (GtkWidget *widget,
 
   g_signal_emit (widget, widget_signals[PRESS_AND_HOLD],
                  0,
+                 device,
                  GTK_PRESS_AND_HOLD_QUERY,
                  x, y,
                  &return_value);
@@ -7168,7 +7173,7 @@ gtk_widget_press_and_hold_start (GtkWidget      *widget,
 
   data = gtk_widget_get_press_and_hold_data (widget);
 
-  if (gtk_widget_press_and_hold_query (widget, event->x, event->y))
+  if (gtk_widget_press_and_hold_query (widget, data->device, event->x, event->y))
     {
       gint timeout, begin_ani_timeout;
       GdkScreen *screen;
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index 2442915..369e3d9 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -441,6 +441,7 @@ struct _GtkWidgetClass
   void         (* gesture)                (GtkWidget          *widget,
                                            guint               gesture_id);
   gboolean     (* press_and_hold)         (GtkWidget             *widget,
+                                           GdkDevice             *device,
                                            GtkPressAndHoldAction  action,
                                            gint                   x,
                                            gint                   y);
diff --git a/tests/testpressandhold.c b/tests/testpressandhold.c
index e4fe8c4..b1abadd 100644
--- a/tests/testpressandhold.c
+++ b/tests/testpressandhold.c
@@ -88,10 +88,11 @@ press_and_hold_show_menu (GtkWidget *widget,
 
 static gboolean
 press_and_hold (GtkWidget             *widget,
-	        GtkPressAndHoldAction  action,
-	        gint                   x,
-	        gint                   y,
-	        gboolean               keyboard)
+                GdkDevice             *device,
+                GtkPressAndHoldAction  action,
+                gint                   x,
+                gint                   y,
+                gboolean               keyboard)
 {
   switch (action)
     {



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