[gtk+/touchscreens: 46/49] gtk, scrolledwindow: Grab only after starting drag
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/touchscreens: 46/49] gtk, scrolledwindow: Grab only after starting drag
- Date: Mon, 5 Dec 2011 01:18:50 +0000 (UTC)
commit 0c405e1ffae9839e5bac4bb4616252d70d21a2c0
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Dec 5 00:17:58 2011 +0100
gtk,scrolledwindow: Grab only after starting drag
This is so the grab doesn't break the implicit grab on the
child widget's window, which avoids that the button press and
release are possibly sent to different windows, and after the
grab was actually broken.
gtk/gtkscrolledwindow.c | 21 +++++++++++----------
1 files changed, 11 insertions(+), 10 deletions(-)
---
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 1314f55..de5a1da 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -2502,7 +2502,6 @@ gtk_scrolled_window_release_captured_events (GtkScrolledWindow *scrolled_window)
/* Cancel the scrolling and send the button press
* event to the child widget
*/
- gdk_device_ungrab (priv->drag_device, GDK_CURRENT_TIME);
gtk_device_grab_remove (GTK_WIDGET (scrolled_window), priv->drag_device);
priv->drag_device = NULL;
@@ -2546,7 +2545,6 @@ gtk_scrolled_window_button_release_event (GtkWidget *widget,
if (priv->drag_device != gdk_event_get_device (_event))
return GTK_CAPTURED_EVENT_NONE;
- gdk_device_ungrab (priv->drag_device, event->time);
gtk_device_grab_remove (widget, priv->drag_device);
priv->drag_device = NULL;
@@ -2566,7 +2564,9 @@ gtk_scrolled_window_button_release_event (GtkWidget *widget,
priv->release_timeout_id = 0;
}
- if (!priv->in_drag)
+ if (priv->in_drag)
+ gdk_device_ungrab (gdk_event_get_device (event), event->time);
+ else
{
gtk_scrolled_window_auto_hide_scrollbars_start (scrolled_window,
AUTO_HIDE_SCROLLBARS_TIMEOUT);
@@ -2648,6 +2648,14 @@ gtk_scrolled_window_motion_notify_event (GtkWidget *widget,
return GTK_CAPTURED_EVENT_HANDLED;
}
+ gdk_device_grab (priv->drag_device,
+ gtk_widget_get_window (widget),
+ GDK_OWNERSHIP_WINDOW,
+ TRUE,
+ GDK_BUTTON_RELEASE_MASK | GDK_BUTTON1_MOTION_MASK,
+ NULL,
+ event->time);
+
priv->last_button_event_x_root = -TOUCH_BYPASS_CAPTURED_THRESHOLD;
priv->last_button_event_y_root = -TOUCH_BYPASS_CAPTURED_THRESHOLD;
@@ -2766,13 +2774,6 @@ gtk_scrolled_window_button_press_event (GtkWidget *widget,
return GTK_CAPTURED_EVENT_NONE;
priv->drag_device = gdk_event_get_device (_event);
- gdk_device_grab (priv->drag_device,
- gtk_widget_get_window (widget),
- GDK_OWNERSHIP_WINDOW,
- TRUE,
- GDK_BUTTON_RELEASE_MASK | GDK_BUTTON1_MOTION_MASK,
- NULL,
- event->time);
gtk_device_grab_add (widget, priv->drag_device, TRUE);
gtk_scrolled_window_cancel_deceleration (scrolled_window);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]