[gtk+/gtk-3-22] textview: fix bug on DnD displaced limits of selection



commit 07320200d1e2c0079027c5187a7ab7a6fc160d66
Author: Nelson Benítez León <nbenitezl+gnome gmail com>
Date:   Wed Aug 2 19:03:28 2017 +0500

    textview: fix bug on DnD displaced limits of selection
    
    The fix of commit f2fd655754407103f8fb9b2c3e7586fb595ab917
    should be confined to DnD coords only, because otherwise
    it causes the start and end of the selection to be displaced.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=785736

 gtk/gtktextview.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 61e6f63..c5f76b0 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -8392,9 +8392,6 @@ gtk_text_view_drag_motion (GtkWidget        *widget,
       y > (target_rect.y + target_rect.height))
     return FALSE; /* outside the text window, allow parent widgets to handle event */
 
-  x -= target_rect.x;
-  y -= target_rect.y;
-
   gtk_text_view_window_to_buffer_coords (text_view,
                                          GTK_TEXT_WINDOW_WIDGET,
                                          x, y,
@@ -8454,8 +8451,11 @@ gtk_text_view_drag_motion (GtkWidget        *widget,
       gtk_text_mark_set_visible (priv->dnd_mark, FALSE);
     }
 
-  priv->dnd_x = x;
-  priv->dnd_y = y;
+  /* DnD uses text window coords, so subtract extra widget
+   * coords that happen e.g. when displaying line numbers.
+   */
+  priv->dnd_x = x - target_rect.x;
+  priv->dnd_y = y - target_rect.y;
 
   if (!priv->scroll_timeout)
   {


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