[gtk+] textview: Also cancel DnD on ::grab-notify



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

    textview: Also cancel DnD on ::grab-notify
    
    If a drag operation is about to start when the drag
    device is grabbed somewhere else, unset drag start x/y,
    otherwise the drag will start anyway.

 gtk/gtktextview.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 61961ec..808bdd6 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]