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



commit 6a7cb544043a113f31afa3f92db335c0ac5d2509
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 03b3465..01ff4b6 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -233,6 +233,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);
@@ -2824,6 +2825,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)
@@ -2839,8 +2841,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]