[gtk+/multitouch: 43/57] scrolledwindow: Add GdkDevice parameter to ::press-and-hold handler



commit 9925e6634a73c0f76f76f5c1315b9bccd5aa072c
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Nov 1 12:42:15 2011 +0100

    scrolledwindow: Add GdkDevice parameter to ::press-and-hold handler

 gtk/gtkscrolledwindow.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 058ebe4..4c846c3 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -232,6 +232,7 @@ static gboolean gtk_scrolled_window_scroll_event       (GtkWidget         *widge
 static gboolean gtk_scrolled_window_button_press_event (GtkWidget         *widget,
                                                         GdkEvent          *event);
 static gboolean gtk_scrolled_window_press_and_hold      (GtkWidget        *widget,
+                                                         GdkDevice        *device,
                                                          GtkPressAndHoldAction action,
                                                          gint              x,
                                                          gint              y);
@@ -2819,6 +2820,7 @@ gtk_scrolled_window_start_deceleration (GtkScrolledWindow *scrolled_window,
 
 static gboolean
 gtk_scrolled_window_press_and_hold (GtkWidget             *widget,
+                                    GdkDevice             *device,
                                     GtkPressAndHoldAction  action,
                                     gint                   x,
                                     gint                   y)
@@ -2834,8 +2836,11 @@ gtk_scrolled_window_press_and_hold (GtkWidget             *widget,
       /* Cancel the scrolling and send the button press
        * event to the child widget
        */
+      if (!priv->button_press_event ||
+	  device != gdk_event_get_device (priv->button_press_event))
+        return FALSE;
 
-      gdk_device_ungrab (gdk_event_get_device (priv->button_press_event), GDK_CURRENT_TIME);
+      gdk_device_ungrab (device, GDK_CURRENT_TIME);
 
       if (priv->motion_notify_id > 0)
         {



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