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.
This commit is contained in:
Carlos Garnacho 2011-12-11 18:25:36 +01:00 committed by Matthias Clasen
parent 3ccf4e0896
commit ce23d52592

View File

@ -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;