[gtk+/multitouch: 55/123] gtk, textview: Also cancel DnD on ::grab-notify



commit 51197f3771f33827d57a93165a2780c235921dfb
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Dec 11 18:25:36 2011 +0100

    gtk,textview: Also cancel DnD on ::grab-notify
    
    If is about to start when the drag device is grabbed
    somewhere else, unset drag start x/y so DnD doesn't
    happen anyway.

 gtk/gtktextview.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 95e63a7..0b76154 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -4273,8 +4273,15 @@ gtk_text_view_grab_notify (GtkWidget *widget,
   if (priv->grab_device &&
       gtk_widget_device_is_shadowed (widget, priv->grab_device))
     {
+      if (priv->drag_start_x >= 0)
+        {
+          priv->drag_start_x = -1;
+          priv->drag_start_y = -1;
+        }
+
       gtk_text_view_end_selection_drag (GTK_TEXT_VIEW (widget));
       gtk_text_view_unobscure_mouse_cursor (GTK_TEXT_VIEW (widget));
+      priv->grab_device = NULL;
     }
 }
 
@@ -4575,6 +4582,7 @@ gtk_text_view_button_press_event (GtkWidget *widget, GdkEventButton *event)
                 gtk_widget_get_modifier_mask (widget,
                                               GDK_MODIFIER_INTENT_EXTEND_SELECTION)))
             {
+              priv->grab_device = event->device;
               priv->drag_start_x = event->x;
               priv->drag_start_y = event->y;
               priv->pending_place_cursor_button = event->button;



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