[gtk+/multitouch: 23/123] scrolledwindow: Set also a GTK+ grab on p-a-h scrolling



commit e55c83dbc67ad83dd9bb2187c7f593d6f6a9c5d2
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Nov 1 12:45:12 2011 +0100

    scrolledwindow: Set also a GTK+ grab on p-a-h scrolling
    
    This is so the widget is ensured to receive the events
    regardless of the pointer position.

 gtk/gtkscrolledwindow.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 01ff4b6..a90ed2c 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -2846,6 +2846,7 @@ gtk_scrolled_window_press_and_hold (GtkWidget             *widget,
         return FALSE;
 
       gdk_device_ungrab (device, GDK_CURRENT_TIME);
+      gtk_device_grab_remove (widget, device);
 
       if (priv->motion_notify_id > 0)
         {
@@ -2891,6 +2892,7 @@ gtk_scrolled_window_button_release_event (GtkWidget *widget,
   GtkWidget *child;
   gdouble distance;
   GdkEventButton *event;
+  GdkDevice *device;
 
   if (_event->type != GDK_BUTTON_RELEASE)
     return FALSE;
@@ -2904,7 +2906,9 @@ gtk_scrolled_window_button_release_event (GtkWidget *widget,
   if (!child)
     return FALSE;
 
-  gdk_device_ungrab (gdk_event_get_device (_event), event->time);
+  device = gdk_event_get_device (_event);
+  gdk_device_ungrab (device, event->time);
+  gtk_device_grab_remove (widget, device);
 
   if (priv->motion_notify_id > 0)
     {
@@ -3031,6 +3035,7 @@ gtk_scrolled_window_button_press_event (GtkWidget *widget,
   gint threshold;
   GtkWidget *event_widget;
   GdkEventButton *event;
+  GdkDevice *device;
 
   if (_event->type != GDK_BUTTON_PRESS)
     return FALSE;
@@ -3048,13 +3053,15 @@ gtk_scrolled_window_button_press_event (GtkWidget *widget,
   if (priv->hscrollbar == event_widget || priv->vscrollbar == event_widget)
     return FALSE;
 
-  gdk_device_grab (gdk_event_get_device (_event),
+  device = gdk_event_get_device (_event);
+  gdk_device_grab (device,
                    priv->event_window,
                    GDK_OWNERSHIP_WINDOW,
                    TRUE,
                    GDK_BUTTON_RELEASE_MASK | GDK_BUTTON1_MOTION_MASK,
                    NULL,
                    event->time);
+  gtk_device_grab_add (widget, device, TRUE);
   gdk_window_lower (priv->event_window);
 
   /* Reset motion buffer */



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